Arduino Due and tone()

The code is OK but there is a limit on how much current the Arduino can deliver per pin (40mA) and total board (200mA). So you won't be able to drive headphones directly as their impedance may be too low.

V = IR R = V/I = 5V/40mA = 125ohms So trying to drive any impedance less than 125 ohms would damage an arduino pin.

Ideally you would feed the arduino tone to a "line in" input on an amplifier, with the headphones connected to the amp.

As a minimum you need to add a resistor into a power transistor between the TONEpin and the headphones.

I think at the arduino due it is even 3.3 V, so 3.3/40 = 82.5ohms. So to not destroy the pins, I have to put a resistor between the arduino pin and the headphones that is let's say about 100ohms?

Oops yes 3.3V for Due. Looking at the Due Tech specs the max total current (all pins) is 130mA. It doesn't mention single pin limit, so I'd stick with 40mA/pin.

Interfacing to the headphones is not as easy as simply adding a 100ohm resistor because you also need to get enough power (I*I*R) into the headphones. If the headphones are say 10 ohms then less than 10% of the power will get to the headphones, most being lost in the resistor. You can try it, but you'll probably hear nothng.

So you need a (power) amplifier .. and that can be a simple transistor fed with through the 100ohm resistor to the transistor base, the emitter to earth and headphones driven off a power supply and the transistor's collector.

The solution also depends on the specs of your headphones.

There may be easier or better solutions and I may be leading you up the garden path. So I suggest you Google "how to drive headphones" ...

good luck!

there ars some really cheap mini-amplifiers on eBay based on the LM386 chip that may be useful ...

Apparently, I tried to take a random resistor (7.5k ohms), and it works. No idea why. Anyways, I ordered the amplifier so that I can easily handle the volume of the headphones...

Thank you very much!

nice [random] work ! :)

keep in mind you always have the option to award 'Karma' points in this forum... (but not randomly)

I would also like to know why the lib is not just added for the due?

There is an easy workaround; Tc_lib from antodom on github provides examples to output a pulse for a specific frequency. A look-up table is an easy way to make a correspondance between any note and the frequency to output with Tc_lib.

1 Like

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