Page 1 of 4

Adding sound to my train controller

PostPosted: Tue Jun 07, 2016 1:28 pm
by grandpa jay
Gentlemen
I am adding a MP3 module DFPlayer Mini SKU:DFR0299 to my train controller. I now have it working with a little static. I had to set the pin 12 high in the initialization and have the program pull it low for 100ms.

Would it be better to add a pullup resistor to pin 12? Any suggestions on reducing the noise from the small speaker?

I am new to this form and not sure about adding files.

Jay

Re: Adding sound to my train controller

PostPosted: Tue Jun 07, 2016 6:41 pm
by Ian.M
I though the Microchip forum had mangled the schematic, but it looks like it got mangled your end. Please repost it as a GIF or PNG (both lossless image formats) with enough resolution for component designator and value text to be readable.

I suspect the noise is due to interference from your digital circuits. We'll probably also need to see photos of both side of the board so we can check the wiring layout. Worst case, it may well need its own regulator, and may even need the control signals isolated.

Re: Adding sound to my train controller

PostPosted: Tue Jun 07, 2016 7:46 pm
by grandpa jay
Ian
This is exported from eagle. The eagle schematic file is not allowed.
Jay

Re: Adding sound to my train controller

PostPosted: Tue Jun 07, 2016 7:50 pm
by grandpa jay
Ian
The H-bridge is not installed on the PCB or the two relays.
Jay

Re: Adding sound to my train controller

PostPosted: Thu Jun 09, 2016 2:04 pm
by grandpa jay
Gentlemen
This is the PCB that I am using.
Jay

Re: Adding sound to my train controller

PostPosted: Thu Jun 09, 2016 2:57 pm
by drh
There should be a 0.1uF capacitor at the Vdd-Vss pins of the PIC. Also, your speaker traces are running next to the L293 which will be generating large current spikes, also known as noise.

Re: Adding sound to my train controller

PostPosted: Thu Jun 09, 2016 4:46 pm
by grandpa jay
drh
Thank you for the reply. I will add the 0.1uF cap to the back of the PCB. The L293 is not installed at this time so the noise is not from there. I do not have a scope but the noise is very uniform.
Jay

Re: Adding sound to my train controller

PostPosted: Fri Jun 10, 2016 9:32 am
by Roche
Maybe try a few things - a largish capacitor across the supply to the MP3 player - maybe 220uF right on the pins of the connector.
Also, the 100ms trigger pulse - do you send a single pulse, or does it get re-triggered multiple times - you could try manually triggering, by lifting the pic pin, or turning it into an input...

Re: Adding sound to my train controller

PostPosted: Fri Jun 10, 2016 1:36 pm
by grandpa jay
Roche
Thank you, I will try the 220uF cap. The 100mx trigger is a single pulse, if I make it longer the module is setup to repeat the sound file.
Jay

Re: Adding sound to my train controller

PostPosted: Fri Jun 10, 2016 3:19 pm
by drh
Is the noise always there or just when you "play" a selection? Noise could actually be on the MP3 file. (Not too likely)

The module may be picking up noise generated by the PIC. If you remove the PIC and manually trigger it is the noise still there?

You really need to use an O'scope to check for noise on the Vcc line. It would make it a lot easier to identify the source of
the noise if we could "see" it.

It may just be a crappy PCB layout. Don't ask me how I know. :oops: