Close

Sound test

A project log for Project Healing Heart

The Healing Heart is a conflict-resolution tool which teaches children to apologize in a way far superior to most adults.

grant-stankaitisGrant Stankaitis 12/29/2019 at 02:080 Comments

After I mocked up and printed out the remaining heart pieces, I moved on to working on the sound.

The sound for the Healing Heart is supposed to play when all 4 pieces are connected. As you can see from the video, when the 4th piece snaps in, the heart plays a sound! I picked a random sound clip that I had lying around on my computer.

The sound is played through a DFPlayer Mini and a MicroSD card that contains a sound file. At this point, I chose to use a DFPlayer Mini because of the convenience of using a MicroSD card. For the final versions of the Healing Heart, I will implement storage with some sort of flash memory that is much more efficient and compact.

When the Arduino detects that all 4 LEDs are connected, it sends a serial command (via SoftwareSerial) to the DFPlayer to play the sound file on the SD card. This allows the Arduino to offload the playback to the DFPlayer so it can continue running the main loop, thus allowing the Arduino to continue to switch the power on/off to the LED pins if a piece is disconnected while sound is playing.

I believe this is an effective way to implement sound playback because the sound playback doesn't take up the processing power/time of the microcontroller (microcontroller doesn't freeze and wait for sound to finish). It is instead offloaded to a separate processing element that decodes the serial command and handles audio playback.

Discussions