High Voltage AC Sensor To Arduino

Firstly, deepest apologies for posting three items in a row. Don't mean to spam my own thread but I keep having questions as I have been sitting here for around 6 hours straight nutting this out!

I have designed the attached circuit on some software called CircuitLab (a random find). It is based on the help provided in this thread so far. Rather than clip the negative part of the sine wave, I have clipped off the positive. This is solely because I need teh square wave to be positive (high) and this is the only way I could get it to work. I didn't have much luck with non-inverting schmitt triggers. It works........almost!

I have used a clipping circuit that outputs to an inverting schmitt trigger. To be honest my resistor values were complete guesses. I have outputed what the software shows as a simulation based on a 1Hz sine wave that has 8v peak to peak (this simulates the approximate idle speed of the engine on which I will be measuring the RPM). I have run it with a 100v peak to peak and it output the same (that's good). Not sure if simulation software highlights if components are overstressed or not. The clipping diode shown has an output of 3.9v whcih still clips at the low idle speed.

The issues;

  • the square wave output is just over 5v (5.089v). This may be an issue for the Arduino but I do not know how to reduce it. My only thought is to add another zener diode on the output to clip the voltage to 5v or just under.
  • the square wave goes high when the sine wave is a fraction under 0v (around -0.002v) which is fine. However, it then goes low at just over 0v (+0.002v) which is not fine. The actual sine wave I will receive is not continual i.e. it will have a positive peak, negative peak then 0v for a period of time before another set of peaks. Having the square wave go low at over 0v means it will stay positive until the next set of peaks arrives. I guess this isn't technically an issue as I will be telling the Arduino to read the rising edge but it just feels messy. I would rather the square wave goes low at the same voltage point as it went high i.e. just under 0v. Is that possible?

I have tried many times to calculate the trigger points but I never seem to get it to match the simulation (I am of course trusting the simulation is working correctly!!!!!!!)

  1. No problem at all.

  2. You need some hysteresis. Small variations around zero should not trigger a change. The Schmitt trigger should do that. If it isn't then there is something wrong.

  1. Fine for Arduino, it's rated for up to 5.5V. But your output voltage can never be more than the Vcc provided to the OpAmp. If you see anything above 5V (I assume you set Vcc to 5V) then that's a rounding error in CircuitLab's math.

  2. Some hysteresis is good indeed. You may even want a bit more than that - your 0V is never going to be exactly 0V (theres LOTS of RF noise in cars, especially older ones). As long as your signal is symmetrical, hysteresis will simply delay your square wave a little compared to the input sine wave. The wavelength remains the same.

Do look a bit into hysteresis, you can easily find some graphs that show you how it works, and how it won't change the duration of peaks for symmetrical signals.

Changed a few things....

I have now clipped both the +ve and the -ve of the sine wave and added a bias voltage to both.

The switching points are still 0v (set high) and just over 0v (set low) and I just cannot get this to change for some reason. I have read alot about hysterisis and think I understand the theory....putting it into proactice is harder for me :frowning: Feel free to change my circuit if you can work out how to make that change!!!

I bought parts this arvo so will see if I can produce the magic smoke tomorrow :(:frowning:

I know this is an old topic, but there's a chip especially designed for your purpose, look up the Maxim MAX9924, it can operate on signals from millivolts up to 100's of volts and adapts automatically and has zero-crossing detection so you have accurate timing points

Did you ever get your thing going?

1 Like

Thanks for the reply.

I played around for quite some time but ultimately dropped this part of the project. I wanted to try to use this particular sensor as it was what I had but since using hall effect sensors for other things I will just use one of them if ever I get back to the project.