(Nano) Sound glitches on digital pin when powered over USB

Hey there,
when I set "pinMode(11, OUTPUT);" on my original Arduino Uno and put there a tiny loudspeaker (8 Ohm) on it. There I get no glitches in Audio when its connected over USB.
When I connect my Nano (CH340G) there are a lot of glitches in the signal even when I move my mouse. I assume that these is caused by the nano's missing voltage regulator that the uno has on its board (or even the different usb controller).
Is this is caused by the misssing voltage regulation circuit or the different usb driver chip (CH340G)? Before digging deeper in this problem and get my oscilloscope hooked up to +5V to analyze I just want to ask if someone else has discovered these behavior?

It is hard to tell without knowing what your nano is actually doing. Mouse movement should not effect anything unless your sound signal is coming from the computer.

However, you should never connect an 8R speaker direct to an Arduino. While the inductive reactance will keep the current down when playing a note, when it is not playing the DC output will overload the output pin. If you must do a direct connection then include a 120R and 100uF in series with the speaker.

Thanks for that advice I have done over new Year a new build. There I have combined 3 pwm pins together with 150 Ohms each connected to the Loudspeaker and to GND. I want to mix the signals so that i get an max. output voltage from 0-1V.
Replacing the speaker with an high enough resistance as a voltage divider should do the job or am i wrong and this build will extremely cause the digital pins to overload and break down the chip before his normally lifespan?

First off, you description of " combined 3 pwm pins together with 150 Ohms each connected to the Loudspeaker and to GND." I find difficult in knowing exactly what you did. Can you please supply a schematic.

Basically connecting outputs together is a big no no. Also you NEED a capacitor in series with the speaker to prevent excess current flowing when the audio stops. It blocks DC which is a bad thing to put through a speaker.

Capacitor is the wrong way round.

You are best using a summing amplifier to mix signals.

Didn't know how to turn things in fritzing was one of my first sketches :confused:

I will do a long term test, maybe this config works for me (with cap right round), why use an IC when you can keep it simple :grinning:.
Will use an oscilloscope to track down problems if it doesn't go over the pin's specs in datasheet it maybe just got fine...
Anyways thanks for your advice :slight_smile:

will do a long term test, maybe this config works for me

No it is useless doing a test in only one unit. How will you measure damage? The still working is insufficient.

I used to do reliability testing for a major consumer electronics company so I know these things are not that simple. The first thing you do is to make sure the design is right, which it isn’t.

If I replace the speaker in the final product by a line out (0-1V spec) there couldn't be a mechanical part that swings forth and backwards to produce such spikes you mentioned. The Pullup resistors of 328p are around 20-50k so even 20k with 150 and 8 ohm from speaker in row tell me that even when i have 5V full bursting on one output other outputs are getting only 1.4mV. That shouldn't harm the chip at all. :smiley:

It’s not the voltage it is the current you are driving into an output from another output. Pull up resistors are irrelevant as they only concern inputs.

When looking at the sheet the digital pins have a max. output current of 40mAh. This should be fine also, but will do my math and measurements to be safe :slight_smile:

When looking at the sheet the digital pins have a max. output current of 40mAh.

No it doesn't.

The term 40mAh is a rating applied to batteries saying ( roughly ) it can provide 40mA for an hour, or some multiple of this, like 80mA for half an hour.

So the absolute maximum current is 40mA, this means that if an output pin is connected to a load that results in a 40mA current then damage will be done. It is not a safe level.

If you short an Arduino output pin through 8 ohms, it will draw about 150mA and destroy(*) itself,
since the output impedance of the pin driver is quite low, 30 to 40 ohms or so.

An "absolute max" rating is telling you the threshold of damage(*), its not saying that the chip is limiting
the current. These values are sometimes described as "absolute maximum never exceed", which more
clearly indicates its a warning !

(*) damage may be complete failure of the chip, of the pin, or some degradation of the pin's drivers
which may not be obvious without measuring things like quiescent current draw, leakage current,
output voltage/current curve. Basically stay (well) below the abs max ratings at all times for reliable operation.

Have experimented a lot with my arduino, luckily it didn't happen to me, even when I connect it directly.
I'm using now an LM4562 as summing opamp. The signals go through a voltage divider each and then summing it with the opamp. Works perfectly. I'm driving the speaker from the opamp but with another 150 ohm resistance and a cap to be safe. Thanks a lot for your advices :slight_smile:

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