Soundboard

soundboard build from DFPlayer and Atmega328



Created by: J. de Waal, 2021-11-18


Homemade Soundboard

The goal was to create a soundboard. The minimum requirement was to play a sound as soon as a button is pressed. This can be done in software, but then some host device is required. In this case, it was preferred to have a portable self-contained system with dedicated buttons for playing different sounds.

Hardware

The hardware consists of the circuit board containing most of the electronics, a battery holder including 3 AA batteries, a speaker, and a laser-cut enclosure holding the buttons, switch, leds, and loudspeaker.

Electronics

The electric circuit is built around a DFPlayer Mini audio module and an ATmega328 microcontroller. Other components are placed around the microcontroller. This includes the following:

  • A 16 MHz crystal and loading capacitors, as shown in the datasheet.
  • Pull-up resistor on the reset pin of the microcontroller. The reset pin is also connected to the programing header.
  • ISCP header so the microcontroller can be programed without having to remove it.
  • Leds and current limiting resistors.
  • Colored input buttons to control the soundboard.

The resistors in series with the buttons protect the microcontroller if something goes wrong. They provide protection but does not hinder the function as input.

The audio module can directly drive the speaker. The connection to the speaker is made underneath the sound module. The microcontroller has a socket for easy replacement. A socket for the audio module is created by soldering two female headers onto the circuit board. Male pin headers and matching wire connectors are used for all other connections to the circuit board.

Audio Control

To generate the audio signal and drive the speaker a DFMini player module is used. This module can play mp3-files from a TF-card. It is possible to control this module using only buttons and resistors, but to allow the use of its full potential a more sophisticated method is applied. Via serial communication, the microcontroller controls the sound module. This microcontroller senses the inputs from the buttons and passes commands to the sound module.

Power

To keep de system self-contained it can run on battery power. A switch is placed in series with the battery so the system can be turned off when not in use.

Software

The microcontroller is controlling the MP3 player module. The interface to the module is done over an asynchronous serial communication bus. The circuit makes use of the UART in the atmaga328 ((atmega88)), eliminating the need to implement bit banging.

The buttons connect to port C of the microcontroller. These pins are set as input pins with the internal pull-up enabled. This internal pull-up keeps the input high when no button in pressed. Interrupts are not supported on these pins, so the microcontroller is constantly polling the inputs to detect button presses.

Two status leds are connected to output pins of the microcontroller. These leds can be turned on or off, or receive a pwm signal to set the brightness on some value. A led is used to indicate that the system is powered on and ready to go. Possible errors can also be coded in flashing the led. Errors mainly consist out of problems with the MP3 player or the serial communication.

Volume control can be done in software by sending a command to the audio module. This is done during the setup after a reset. Special key combinations can be used to modify the volume.

Conclusion

This build completes the set goal to build a self-contained soundboard. By packaging everything inside to box, it can be used at a variety of locations. The mechanical side of this project took longer than expected. Luckily, the box itself turned out quite nice.

Recommendations

The microcontroller can be reprogramed to use the internal oscillator at 8MHz. this removes the need for an external crystal and reduces the power consumption. With the lower clock frequently, the microcontroller can run at lower voltage, so it continues to run longer when the battery is almost empty.

In addition, an automatic power off feature would be a nice to have. If the current circuit is accidentally left powered on, it quickly drains the batteries.