• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

low voltage AC to square wave Arduino input

Scarr

Member
Hi Everyone,

I have a low voltage AC sign wave 4vPP and I want to feed this into a Arduino digital input as a square wave. The sign wave is the output of a crank position sensor. Can anyone suggest/post a schematic that will do this ideally using minimal components e.g. an IC. the input can be just the positive side of the wave and I will simply double it to get a RPM (attached a pic of the output)

Thanks for the help in advance

P.S. as this is a crank sensor it should not interfere with the original sinewave
 

Attachments

Last edited:

rjenkinsgb

Well-Known Member
Most Helpful Member
A simple centre-biassed and capacitor coupled comparator such as can be done with an LM311.

Example - using the LM322, it would also need a pull-up resistor to logic power. Plus a coupling capacitor at the input, if the signal is DC coupled.

R1 and C1 should have a long enough time constant so there is no significant drift within a single cycle of the input signal, but not so long that it does not settle to the correct bias point in a reasonable time.


 

Scarr

Member
Thanks for the reply but that lost me as I don't really know to calculate those values, could a optocoupler with schmitt trigger not do the job (only stabbing in the newbie dark here :)

Steve
 

Les Jones

Well-Known Member
Most Helpful Member
Are you trying to detect the missing tooth position (Which will be a timing mark.) or just the total number of transitionsb per revolution ?Either could be useed to display RPM. (But with a different calculation in the software.
Edit. I have just re read your first post and that indicated that you want to detect the missing tooth part of the waveform. Are you atempting to detect the missing pulse in software or do you require the hardware to do that ?

Les.
 
Last edited:

rjenkinsgb

Well-Known Member
Most Helpful Member
It could, but you would need a driver of some sort to supply the LED current while not significantly loading the sensor output.
That would likely be not all that different to the circuit above.

You may get away with just a CMOS schmitt trigger gate fed via eg. a 0.1uF cap and 10K resistor, with a couple of 1M resistors from input to logic power and ground.

That would do a similar thing to the LM311 comparator circuit, as long as the signal amplitude is always high enough & if everything is running from supplies sharing the same ground, no opto isolator is needed.

If it must be isolated, the output of the schmitt gate could be used to drive the opto LED via a resistor.
 

Scarr

Member
Are you trying to detect the missing tooth position (Which will be a timing mark.) or just the total number of transitionsb per revolution ?Either could be useed to display RPM. (But with a different calculation in the software.

Les.
Once I get a square wave into the Arduino can work out the calc, but I suspect looking at it it's one pulse per revolution.

Steve
 

Les Jones

Well-Known Member
Most Helpful Member
As the frequency will vary over quite a large range isimple monostable missing pulse detector would not work. The only way I can think of detecting the missing pulse would be to use a phase locked loop synchronised to the basic sine wave frequency. Would is not be simpler to use a pulse from the ECU that triggers the injectors or spark plugs ?

Les.
 

Scarr

Member
As the frequency will vary over quite a large range isimple monostable missing pulse detector would not work. The only way I can think of detecting the missing pulse would be to use a phase locked loop synchronised to the basic sine wave frequency. Would is not be simpler to use a pulse from the ECU that triggers the injectors or spark plugs ?

Les.
I'm not looking for a missing pulse, I just want the pulse (ignore that scope where it looks like one pulse is missing, I am not sure what that is about but I'm not worried about it)

Steve
 

Mickster

Well-Known Member
Most Helpful Member
I'm not looking for a missing pulse, I just want the pulse (ignore that scope where it looks like one pulse is missing, I am not sure what that is about but I'm not worried about it)

Steve
That is exactly what it is, a missing pulse. It is used by the ECU to calculate spark timing, and it occurs once per crankshaft revolution. ;)
 

Scarr

Member
That is exactly what it is, a missing pulse. It is used by the ECU to calculate spark timing, and it occurs once per crankshaft revolution. ;)
Ah :rolleyes: why do they not use just a pulse per revolution at the TDC or a known point. why use a missing pulse?

Steve
 

Scarr

Member
I'm not looking for a missing pulse, I just want the pulse (ignore that scope where it looks like one pulse is missing, I am not sure what that is about but I'm not worried about it)

Steve
As the frequency will vary over quite a large range isimple monostable missing pulse detector would not work. The only way I can think of detecting the missing pulse would be to use a phase locked loop synchronised to the basic sine wave frequency. Would is not be simpler to use a pulse from the ECU that triggers the injectors or spark plugs ?

Les.
I'm still learning the whole wiring of the bike, so I will go look for something that comes from the ECU, I hope there is something (any pointers would be great, I have added the wiring diagram)

As always big thanks
 

Attachments

Mickster

Well-Known Member
Most Helpful Member
The missing pulse is used much in advance of TDC. The missing pulse creates a point which can be reliably detected to be used as the basic timing reference.
The other teeth are also used for misfire monitoring. The waveform does not have the same amplitude over a complete revolution, due to crankshaft acceleration/deceleration, the amplitude variation becomes more noticeable at lower RPM and is indicative of the compression/power strokes.
Where there is a lack of expected crankshaft acceleration on the power stroke, the ECU recognizes that a misfire has occurred.....exceed a certain threshold of misfire counts and a fault code will be set and the MIL will illuminate, in extreme cases the MIL will start flashing.
 

Mickster

Well-Known Member
Most Helpful Member
There may be a wire coming from your ECU, to the instrument cluster, which has a tachometer signal - could you use that?
What are you trying to do?
 

Scarr

Member
There may be a wire coming from your ECU, to the instrument cluster, which has a tachometer signal - could you use that?
What are you trying to do?
Yes, think I've been barking up the wrong tree, it looks like a digital tacho so going to check this out tomorrow. Thanks for all the help so far though.

Steve
 

Mickster

Well-Known Member
Most Helpful Member
The schematic doesn't do a good job of labelling the wires, but I'd probably start with checking the yellow/black to the instrument cluster.
 

Latest threads

EE World Online Articles

Loading
Top