Hi, I'm just getting starting with Arduino and electronics.
For my project I'm measuring a magnetic pickup sensor, and I want to detect with Arduino every time the signal crosses 0 from + to - and measure timing.
Problem is, when speeds are high, the voltage generated can go up to 40+V (and consequently also down to -40V).
How do I limit the voltage to 5v for the Uno without degrading readability or timing of the AC signal?
I only need to obtain the timing of the signal crossing 0 from + to -, measuring amplitude is not necessary.
I'm sorry if the answer to this is obvious lol
I thought the blue signal was supposed to give a single pulse every time 0 is crossed, not just when it's positive. Am I doing something wrong? I imported the simulation model through the TI website
No, that is how a simple zerocrossing detector works.
You can make it more complicated if you want by adding an edge detector but
in your arduino you can detect both edges. Let the software do some of the work.
You can use an interrupt to "catch" the rising edge.
Even a short pulse has a finite pulse width...
Here are some simple over-voltage and negative voltage protection circuits.
You can increase the current limiting resistor to between 1K and 10K. The 100 Ohm resistor MAY result in too much current-draw from whatever is generating the signal.
Optical isolation is also pretty-much foolproof, but at 40V the opto-isolator may also need some protection.
I've bought the components and done the wiring, and I'm not getting the results I see on my ltspice simulation and I don't understand why.
First of all it doesn't vary from 0 to 5v but from around 1.5v to -4.5v at lower frequencies, and between 3v and -2v at higher frequencies. I thought this could still be usable for my arduino code, but at higher frequencies the voltage dips in the middle of the the HIGH value:
I've checked my wiring and it's correct, the only issue I can see is how I've wired my ground connections, I've used the bus strip to connect all ground connections to the Arduino GND.
Also, although I don't think this should change anything, it's worth mentionning that I've used a LM393P, 1N914TR and a 0.1uF capacitor instead of the indicated components as those were the available ones. I have also connected one of the connectors of the input signal to the gnd bus strip.
Other thing is that the 12v source used is also connected to a dc motor controller for spinning the distributor. The circuit uses the positive terminal of the 12v generator and the ground terminal isn't used.
What @TomGeorge already pointed out
Those pickups don't output a sinewave but something that looks like a positive spike followed by a negative spike. It may be crossing zero at those dips.
Don't know if you scope is fast enough to see narrow glitches
Thanks, selecting dc coupling has solved the 0 to 5 issue, but the dips are still happening, and they're definitely not supposed to be there.
My wiring is messy, but the crocodile clips you see are the 12v connected to the dc motor controller.
The black and grey wires is the input signal.
My oscilloscope is a single channel, thats all I have for now. I can send a picture of what the input signal looks like tomorrow, but from what I could see those dips in the high value aren't supposed to happen.