Help needed concerning audio output of ardunio mega volume in toneAC.h

hi every one ,

I did not know were to post this question but since it concerns arduino mega 2560 i think this is the right place , i need to know exactly when we use arduino mega 2560 with toneAC.h library and set the volume to lets say 80% using the code , what does the audio signal amplitudes in terms of voltage and current will reducing the volume to 50% for instance reduce voltage or current or both, is there any rough equation to estimate the output voltage or current or both? thank you all

The pin on the Arduino is either on or off. If it is on, the voltage is 5.0V. If it is off, the voltage is 0.0V.

The current that the pin can provide is a function of the width of the traces on the circuit board. Safe limit is 20mA continuous, with a 40mA max.

The current that pin does provide is whatever the circuit it is driving pulls.

Changing the duty cycle does nothing, from the pin's point of view, with respect to current or voltage. The pin does not push current.

The circuit may draw more current, but the voltage is always exactly the same.

The APPARENT voltage to the circuit will vary as the duty cycle changes. The actual voltage does not.

And just to be clear, lowering the "volume" just reduces the duty cycle of the PWM. i.e. it spends less time at 5V and more time at 0V. It's a little more complicated than that since toneAC uses two PWM pins in push-pull configuration but that's the basic idea.


ok , the reason I asked this is that i am planning to use a push pull transistor B amplifier assembly just after the pin out and before the speaker to have something like 1.2 watt out put of the speaker I considered using two complementary transistors TI P41C & TIP42C their hFE is averaged at 20 so as I read the out put is input current multiplied by Hfe so if get 15 ma from the out pin of uC that means 15X20= 300 ma Multiplied by (4.3 or 4) V which VCE - transistor drop voltage that means around 1.2 watt for the speaker so am I right? will this work without problems ?

if so do you think i should use a capacitor 10uF before the 8 ohm speaker?

thank you,