Hi all,
I have a rectangular signal that goes from 0V to about 18V.
i can set the frequency of this signal from 2kHz to about 30kHz.
Now I want to measure this frequency with an arduino and display it.
I see two issues here:
a) getting the signal voltage down to a 5V or 3,3 V level.
b) measuring the frequency with an arduino.
There are plenty of examples online - however I thaught I ask for a recommandation what example or tutorial ist best to use for my need?
Thanks,
Andreas
a) getting the signal voltage down to a 5V or 3,3 V level.
A resistor divider would work
b) measuring the frequency with an arduino.
Count the number of input voltage transitions in a period of time using millis() for timing
Andreas1984:
a) getting the signal voltage down to a 5V or 3,3 V level.
Depending on the signal type a diode may do the job (pointing away from the Arduino allowing the external signal to pull the pin low, use the internal pull-up for the high signal).
b) measuring the frequency with an arduino.
Count number of pulses for a certain time, or measure how long it takes for a certain number of pulses to arrive. Just poll the pin and use state change detection; no need to use interrupts for such rather low frequencies.