A nano can use tone() to make a square wave tone analogue. I would like to feed that out via a sterieo plug. I have tried with some old M-M sterieo cables i had but it did not work well. Does anyone have a simple solution for this? Thank you in advance. In addition i would like for a second nano to be able to read the tone and identify the (audio) frequency.
Hi Sam.
An Arduino Nano’s tone() output is a 0–5 V square wave, which is not suitable for direct connection to a 2.5 mm audio input. To use it as an audio signal, you must reduce the level and remove the DC offset. The simplest method is: tone pin → 1 kΩ resistor → 10 µF capacitor → audio jack left/right inputs. The capacitor blocks the DC component, and the resistor lowers the amplitude to an audio-friendly level. Ground of the jack must be tied to Arduino ground.
A second Nano cannot read the audio signal directly because it is low-level AC. You need to convert it back to a clean 0–5 V digital pulse. A small NPN transistor or an LM393 comparator can do this. Once converted, you feed the resulting square wave into a digital pin and measure the frequency using either interrupts (attachInterrupt) or pulseIn(). This allows the second Nano to reliably identify the transmitted tone frequency.
What happened? To what did you connect this output?
a7
Kind of hard to suggest something when we do not know what that means to you!
Tone output is just a square wave at logic levels. It can certainly be used as an input to a process which could figure out the frequency.
Whether that's the best way to go about whatever the OP wants to accomplish is another matter.
a7
That’s true if the signal is going directly from one digital pin to another, but in the OP’s setup the tone output is being sent through a 2.5 mm stereo audio cable. Audio wiring is designed for low-level AC signals, not 5V logic, so the DC component and the full-swing square wave don’t pass cleanly. The result is an attenuated or distorted waveform that the second Arduino may not detect reliably.
If both Arduinos were connected directly, the logic-level square wave would work fine for frequency measurement. But once it goes through an audio cable, the signal needs to be conditioned (at minimum AC-coupled and attenuated) to behave correctly on the receiving end .
@felipecmaismais gave you a good answer, but note the value of the components is dependent on the frequency. The characters of the conversion are controlled by the R and C, Either to large or small and you will get nothing of any value.
Check this link, it may help: Confused by oscilloscope - square wave signal to RPM
Nonsense. I don't disagree that it is suboptimal, but it would work fine for audio frequencies and a non-ridiculous run length.
The AVR inputs have hysteresis, which would only help as a signal gets worse enough on its way to being unusable.
That looks like the circuit recommended to turn PWM analog output into a smooth voltage. Tone() does not use PWM, its output is just a square wave at the frequency you call it with at 50 percent duty cycle.
Unless you are presenting a model of the coax cable to show what might happen to such a square wave.
a7
You’re right that the Tone() output is just a 50% duty cycle square wave, so in principle it should travel over a short audio cable without major issues. My point about the RC values being frequency-dependent was more about using a simple RC filter to try to smooth it if you pick the wrong R or C for the frequency you’re generating, the filtering might not work as expected.
I agree that for audio-range frequencies and reasonable cable lengths, it’s not a huge problem, and the AVR’s input hysteresis definitely adds some tolerance. I just wanted to caution that if someone tried this with much higher frequencies or a very long cable, the circuit behavior could be different than expected.
It is possible to have have an Arduino without D/A converter make a sine wave (any wave) with the help of a lookup table and a much higher sample frequency.
Here I made a rooster crow at sunrise on an ESP32 without D/A converter, with the help of a lookup table.
Leo..
@SamBrownADK
Still need help?
I am still reading through the comments and going to try the DC blocking with a cap.
Not a good idea if you are connecting to another Arduino, you could damage both Arduinos.
If you still need help just say so.
Hi, @SamBrownADK
Can you please post some images/schematic of how you connected the Nano to the stereo cables?
Tom....
![]()
I guess what i would like is some sort of device that can be controlled by a nano via either pins or UART to generate true, pure tones (not square waves). So the nano can tell the gizmo to make a 450Hz tone or a 1200 tone and so on. At this slave device the nano will controll tone, duration, duty cycle etc. Much as tone() does but for a true “musical” sound. I have not seen such a beast for sale anyplace.
- Record each tone (freq, duration, duty cycle, et c.). [edit] forgot link: https://onlinetonegenerator.com/
- Save to SD.
- Use Nano to command DFPlayerMini to play any stored tone file.
- Five for US$2.00 each.
@SamBrownADK might like DDS, direct digital synthesis.
Either get a module:
or use software all the way; Arduino UNO is fast enough. A library helps:
https://docs.arduino.cc/libraries/mozzi/
or code it yourself: google is your friend
arduino dds
a7
Thank you! I will start with mozzi first and see how it goes.
Thank you. I am going to see how far i can get with mozzi first.

