fbpx

Audio Speaker and Headphone Jack (H07R30)

$15.60

SKU: H07R30 Category:

Audio Speaker and Headphone Jack

Stage: Alpha

In stock

Description

H07R30 is an audio amplifier and speaker module based on ST TS4990 1.2W audio amplifier and STM32F0 MCU. This module features an on-board 8-ohm rectangular CUI speaker and a headphone output jack. Use this module to play sounds and tunes stored in the MCU embedded Flash or streamed from an external hardware/another module via array ports.

Specifications

Front-end

  • ST TS4990IST audio power amplifier:
    • 1.2W output power at VCC = 5V, THD = 1%,
      F = 1kHz, with 8Ω load.
    • 62dB PSRR at 217 Hz in grounded mode.
    • Near-zero pop and click.
  • CUI CDS-15118B 1W, Nd-Fe-B, 8Ω speaker.
  • CUI SJ-3524-SMT-TR 3.5mm, headphone stereo audio jack.
  • 50kΩ potentiometer to adjust audio level (amplifier gain).

Back-end

  • STM32F091CBU6 32-bit ARM Cortex-M0 MCU.
  • 8MHz external oscillator.
  • Five array ports and six power ports (+3.3V and GND).
  • Access to 5xUART, 2xI2C, SWD, BOOT0, RESET.

Physical Properties

  • Shape: Hexagon
  • Size: 30 mm short diagonal, 17.32 mm side
  • Area: 7.8 cm^2
  • Weight: 3 g
  • Soldermask Color: Dark green
  • Surface Finish: ENIG (gold) or HASL-LF (tin)

Bill of Materials

H07R30 BOM

Quickstart Guide

Connection

  1. Power your module from the 3V3 and GND pads. If you are using the FTDI 3.3V USB-UART cable, then the red wire should be connected to 3V3 (top) and the black one to GND (bottom).
  2. Connect the USB-UART cable to any of the module array ports (i.e., communication ports P1 to P5) using the wired Kelvin clamp or by soldering header connectors. The top pad is MCU TXD and the bottom one is MCU RXD. Thus, you should connect the top pad to the cable RXD (yellow in the FTDI cable) and the bottom pad to cable TXD (orange).
  3. If your module already has firmware on it (it showed one or multiple red indicator LED blinks when you powered it on), then you are ready to connect to the CLI in the next section. If your module doesn’t have a firmware yet, follow the firmware update guide here.

Let’s play some music tunes!

Follow the instructions to setup and connect to module CLI and try the following commands (Note all CLI commands are case-insensitive):
  • Type ping (and press enter), you will see a single indicator LED blink and a response message.
  • Type help to get a list of available module commands.
  • The command play tune plays a series of musical notes. You can use either English representation (C, D, E, F, G, A, B) or Italian/Latin representation (Du, Re, Mi, Fa, Sol, La, Si). The note name is followed by its octave number 1 to 9, where 5 is the middle octave. For example, middle C is C5 or DO5. (Note: all CLI commands are case insensitive.) If you don’t mention an octave number, then the middle one (5) is assumed.
    • Different musical notes must be separated with a space. Once you hit ENTER, all notes will be played in series.
    • You can add # after the note to raise it by a semitone (i.e., half step).
    • Note duration in seconds is added right after the note in []. If you don’t specify a duration, then default 1 second is assumed. Duration can be a decimal number.
    • You can add a silence period of t seconds by typing [t] without a note.
  • Try the following examples:
    • play tune Do4 Re4 Mi4[2] Fa4 Sol4[0.5] La[3]
    • play tune c[0.25] d[0.5] [2] e
  • Now let’s use C APIs to play a song.  You can use API macros to play musical notes similar to CLI commands. By combining multiple musical notes with delays and loops, you can create any musical piece you want! Here’s a section of “Mary Had a Little Lamb!” song. Add this C code in the FrontEndTask() in main.c inside the infinite for loop. Check this article for a guide on how to load a new firmware on the module.

/* Mary had a little lamb! */
E7(0.5); D7(0.5); C7(0.5); D7(0.5); E7(0.5); E7(0.5); E7(1);
D7(0.5); D7(0.5); D7(1); E7(0.5); G7(0.5); G7(1);
E7(0.5); D7(0.5); C7(0.5); D7(0.5); E7(0.5); E7(0.5); E7(0.5); E7(0.5);
D7(0.5); D7(0.5); E7(0.5); D7(0.5); C7(1);
Delay_ms(1000);

  • Now let’s connect a push button and use it to trigger some sounds.
    • Connect a push button switch to port P3 and type in the CLI add-button momentary-no p3 to define a momentary button at port P3. You can reference this button in the CLI as B3.
    • Now, type the following commands each on a separate line followed by pressing ENTER:
      if b3.clicked
      ping
      play tune do[0.25] re[0.5] mi[0.25] end if
      If you click the push button, the indicator LED blinks and the tune is played each time.
  • Check module factsheet for more commands and APIs and their documentation!

Playing Embedded WAVE Files

  • You can embed short WAVE files in the module and play them for sound or speech effects. You can store about 5-6 seconds of WAVE audio (mono, 8 bits/sample) in the internal MCU Flash memory. Check this project for instructions on how to convert any WAVE audio file to the appropriate format to add your module code. The release firmware comes with two embedded speech audio examples, one saying “Hi there!” and the other “How are you?”.
  • Type the command list to show a list of embedded audio files with their file name and length.
  • Use the command play wave waveName to play an embedded wave where waveName is the name displayed in the list command. You can also use the PlayWave() C API to do the same thing in code.

FAQ

Frequently Asked Questions

Load More

Have more questions? Please check our main FAQ page and feel free to contact us for any unanswered questions.

Resources

  • Schematics (PDF)
  • Hardware Design Files (Circuit Maker)
  • Source Code (Bitbucket)
  • Documentation / Factsheet (PDF)
  • Projects & Examples: Please check our account on Hackaday.io for demo projects and examples.
Contact Us

Have anything to ask? Send us any questions or comments and we will get back to you asap.

0