Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

Music Maker Shield for Arduino -sound to light question
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Music Maker Shield for Arduino -sound to light question

by robot_1 on Wed Mar 04, 2020 1:19 am

I'm using an Arduino UNO with an Adafruit Music maker shield for a model robot project. I have set up blinking LEDs and an IR remote that will play certain sound files (voice) whenever numbered buttons are pressed on the remote. The project is almost done and everything seems to work fine but the final part is to make an LED blink during the voice sounds to simulate "talking". My plan was to connect two LEDs, connected in parallel, across one of the stereo speaker terminals to activate the LEDs when the sound was played.
They are 5mm LEDs with 100 ohm resistors on each positive lead. The problem I'm having is the LEDs are partly lit up, even when no sound is playing, when they are connected. I could add a higher value resistor until they don't light at all, but then they will not be very bright when lit normally. I thought it would be possible to use this method for lighting the voice LEDs but maybe there is a better way. Why is there current on the speaker terminals when no sound is playing, and what would be a solution for my sound to light (LED) problem? I will try to post the sketch I'm using below.

Thanks
Attachments
Music.ino
(8.13 KiB) Downloaded 5 times

robot_1
 
Posts: 5
Joined: Wed Mar 04, 2020 12:40 am

Re: Music Maker Shield for Arduino -sound to light question

by robot_1 on Sat Mar 07, 2020 8:25 pm

I solved the problem by using a TIP31 transistor circuit connected to the line out of the shield.

robot_1
 
Posts: 5
Joined: Wed Mar 04, 2020 12:40 am

Re: Music Maker Shield for Arduino -sound to light question

by robot_1 on Tue Mar 10, 2020 10:18 pm

The problem I was having with the LEDs lighting up when they should be dark has come back.
The TIP31 transistor in the circuit makes things work the way I want to light up the LEDs with the voice and then go back to dark when the voice file stops playing. But...after a couple of minutes without a sound file being played, the LEDs gradually return to half brightness again. If you turn off the battery power to the LEDs and turn it back on, they return immediately to half brightness. That points to a current leakage from the Music Maker board amp to the speakers and line out. I saw there was a way to mute the amp by connecting the "SPK off" pin to ground and I tried this but it cuts off all sound from the card, not just the speakers. Is my board defective? I could try a workaround where the code toggles a switch on the breadboard to connect the SPK off pin to ground when a file is done playing and disconnects it to play again. After a sound file plays the LEDs are dark for a minute or so. That's why I thought the problem was solved.

robot_1
 
Posts: 5
Joined: Wed Mar 04, 2020 12:40 am

Re: Music Maker Shield for Arduino -sound to light question

by robot_1 on Sat Mar 14, 2020 8:19 pm

The problem with the LEDs lighting up gradually after a while when no sound was playing seems to have been related to jumpers from the breadboard connected to the Music Maker shield. When the wires to breadboard were disconnected, and the amplified speakers were disconnected from their terminals, the LEDs stayed dark unless a sound played. I then soldered my connections to the transistor and the speakers were connected to an external amp from the audio line out port and things worked properly. An LED connected to either channel of the Music Maker's amplified speaker terminals will still light up, however. I am using separate model train flasher boards for my other LEDs to avoid interference.

robot_1
 
Posts: 5
Joined: Wed Mar 04, 2020 12:40 am

Re: Music Maker Shield for Arduino -sound to light question

by jim_lee on Mon Mar 23, 2020 6:56 pm

Well, lets see a video. Sounds kinda' neat.

-jim lee

jim_lee
 
Posts: 600
Joined: Thu May 24, 2012 8:24 pm

Re: Music Maker Shield for Arduino -sound to light question

by robot_1 on Wed Mar 25, 2020 10:42 am

I'm still putting everything together. Using the TIP31 transistor circuit worked fine for regular 5mm LEDs in testing, but I had installed "straw hat" type LEDs in the robot which apparently need more current. I thought the straw hat LEDs would be brighter. Anyway, I had to find a workaround for it since the LEDs were not replaceable without damaging the model. I did my tests with regular LEDs to avoid possible damage to the installed ones as the specs are similar.

I ended up adding a second Arduino board. The first board runs the Music Maker shield and its code and sends its line out audio to a PAM8403 amplifier to speakers for volume adjustment. The second Arduino board takes in the line out audio from a Y-splitter of the Music Maker and feeds it to a KY-038 Microphone sound sensor module with the microphone replaced by a phono jack. The sound sensor code was incompatible with the code for the Music Maker, making it unreliable, so it had to be run from a second Arduino board. The Arduino had trouble "multitasking". There are other ways of doing the same thing but this was an economical and quick way to do it. The voice LEDs get the full 5 volt current from the Arduino board and the effect is adjustable with the pot on the sound sensor.

robot_1
 
Posts: 5
Joined: Wed Mar 04, 2020 12:40 am

Please be positive and constructive with your questions and comments.