Weak audio signal from Arduino Nano

Hello everyone,

I am working on a PA system-like project in which there is an electret mic and an Arduino Nano to play 3 different horn sounds(WAV) using the TMRpcm library on different button presses. In this project the audio positive side is switched between the mic and the arduino using a switch. Both the arduino and the mic share the same ground wire, so the only thing determining which one is on the positive wire, is the switch.
Everything is powered by a 12 volts DC supply and the wire coming from the switch and the ground wire go to a 3.5mm jack that can be connected to an amplifier.
Since the electret mic does not have sufficient level for the audio amplifier, I have to use a circuit to pre-amplify it (I will leave a picture of the circuit below).
At first, it was opporating normally on the correct volume level* without any issues while I tested with my pre-amp + guitar amp. Then I was testing it with my pre-amp + own amplifier** to figure out if everything is working fine before putting them all in their final place; here is when I noticed that the sound level is significantly lower and does NOT change with my amplifier volume knob (It did change before this issue, however, now volume change can only be noticed in the starting position of the volume knob and after that the volume is constant, even if you turn the volume to the max.).

*By "correct volume level", I mean that if you were to set the amp volume to half, the output sound is really loud, as oppose to the Nano output where even if you max out the volume, it is barely any loud.

**My own amplifier consists of 3 components. First the audio runs through the my pre-amplifier circuit for the electret mic to be on the correct level. Then it is run through a passive pre-amp for me to be able to control the volume, bass and treble, and lastly, it goes in my TDA8932 amplifier.

Here are the things I tested to make sure that it is NOT related to my code or my wiring:

  1. I tested with a simple code using tone() function, outputting on the same arduino pin and got the same resaults. The signal was weak.

  2. I tested the same codes (both the TMRpcm code and the simple tone()) on a Leonardo and got the correct volume level.

I am posting here because I did not change any wirings or code when this happend. As I mentioned, it was outputting at the correct volume level before connecting it to my own amp circuit.

And one last important fact to keep in mind:
As mentioned above, both the arduino and mic, opporate on the same audio wire, just not at the same time. Given that, due to lack of space, both of them have to go through my pre-amp circuit, although it is unnecessary for the arduino (because it is already at the correct signal level for the amplifier).

So, do you have any ideas about what might have caused this to happen? I would be happy to give more information if needed.

Can you expand your circuit showing the Nano, and all of your connections and power sources?

TMRpcm isn't analog (or PCM). It's PWM which (if unfiltered) is a 5V high-frequency signal. The voltage is always 5V which can push the amplifier to full-power, and only the pulse width varies to "simulate" analog.

That can do "bad things" to an amplifier and I wouldn't use it with a good amplifier that I cared about.

What might be happening is that you're over-driving the amplifier with high frequencies you can't hear and that's wiping-out any actual audio signal.

I will as soon as I get a chance.

Thank you for your explanation, but what I don't understand is why was the output audio louder in the past and now suddenly it became like this? As I said, I tried with a Leonardo and it outputed what the Nano could output before this issue.

Possibly, you damaged something.

DO NOT feed 5V PWM directly into an audio amplifier. Use something like this combination voltage divider and low pass filter (3 dB rolloff 3.7 kHz) instead.

Capture

Putting 5V high frequency into an audio amplifier can cause it to over dissipate internally cooking itself and and or fry your speakers for starters.

Well, that explains a bunch of issues I had in the past and I will avoid connecting them directly in the future, but I think that my current problem is not related to it, because I am sure that my amplifier is working fine.
One thing that I measured both on the Leonardo and the Nano was the DC voltage coming from the pin9 (PWM pin for audio). While I measured around 2.5 volts DC on the Leonardo, I bearly measured 1.3 mV DC on the Nano. I am not sure if it is the best method of testing, but do you have any idea what might be wrong with my Nano?
By the way, than you for the circuit.

You might have destroyed the output pin on the Nano, due to excessive current draw.

An Audio Shield should work better. The DFPlayer seems to be super-popular.

PWM should average 2.5V (half of the peak) while it's playing/active. But multimeters are designed to measure DC or AC sine waves and you can't always count-on getting the average.

You can try the tone() function. Maybe 1000 Hz, which any speaker can reproduce. It should be "loud". 5V peak-to-peak is a strong audio line level signal, so hopefully your amp has a volume control.

That is a grat suggetion. I might switch to df player instead of trying to use the arduino for audio.

And about the rest of your comment, I did measure around 2.5 volts from the Leonardo and the audio, as you mentioned, was really loud, however, I did not measure any noticeable voltage from the Nano and the audio comming from it, even with the volume knob maxed out, was not loud at all.

Check to see if the output still works, using a simple program to blink an LED (with series resistor, of course).

Hi, @pejmanjohnson

Check ALL your wiring and connecting components.
Especially the connections in the jacks/plugs.

Tom.. :grinning: :+1: :coffee: :australia:

I suppose you mean the "L" LED. In that case it works. All of the LEDs work and I am able to upload on the board.

I did check my wiring multiple times, but everything looks fine.

Hello again. Just to give a quick update, the Nano seems to be doing everything normally except my issue which was weak PWM output. I have now swithced to using a DFPlayer as you suggested and it works beautifully while combined with my Nano. I just had a question, in the DFPlayer documentation, it is said that the DAC_audio pins can be used with external amplifiers, but using it with my amp, makes the audio really loud. My question is that is the DAC pin outputting the same PWM as the Arduino does? And if not, is it okay to connect it directly to my amp?

Ok guys, I found out what caused my Nano to become like this. I was powering it through the Vin pin and because of that (I'm not sure why it caused a problem though) it did something permenant to my Nano. Even when powered a DFPlayer with the same Nano that was running on Vin, caused the same issue to the DFPlayer. I could avoid causing any more problem to other modules or Arduinos by powering them with regulated voltage and directly from 5V (or 3v3 depending on the board). I will leave this topic open for any of you who might have an explanation for why powering it with Vin pin caused the output PWM to become permenantly weak.

Just checking the datasheet... The TDA8932 has a voltage gain of 30dB. "Coincidently" that's a gain of about 30X. Assuming the DFPlayer is putting-out 5V, and with a 12V supply the amplifier can put-out about 12V, you could max-out (clip/distort) the amplifier with a gain of a little more an 2X.

It should be about the same voltage (about 5V peak-to-peak) but the DAC is putting-out analog audio, not PWM. :wink:

You need a volume control and/or voltage divider/attenuator, if it doesn't already have one. It's probably best to have both so you can make use of most of the volume control range... Add a resistor to the "input" of the pot so the pot becomes part of the voltage divider. And if you want to use it as an everyday volume control, make sure to get an "audio taper" pot.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.