Signal conditioning AC/PWM for arduino analog read

Thread Starter

thetinman86

Joined May 6, 2019
2
Hello all,

I am working on a project where I am trying to control a few things in my car using Arduino. One function is to start the vehicle. As a safety function my code checks to see if the vehicle is running. To do this I am tapping into the engines crank position sensor. Some of these are 5v PWM some are 5-8V peak to peak AC. I would like this to be compatible for both types of systems so I was thinking of converting both signals to an analog voltage. Doesn't need to be super accurate like an actual RPM reading, just looking to see if its running. The 5v PWM I'm just using a RC circuit, the AC I am using a diode to cut off -V then the RC circuit. Where I am getting stuck is making sure the voltage stays under 5v regardless of input voltage so my Arduino don't blow up. I am open to any suggestions. I have attached the tinkercad schematic I was playing with. Thank you in advance.
R: 3.9K
C: 10uF
Zen: 5.10V

Capture1_thetinman86.jpg

Mods Note:
Please don't use .png file for colorful image or too many color scales.
The file has been modified and converted to the .jpg from 584,606 Kb to 73,348 Kb.
 

Attachments

Last edited by a moderator:

wayneh

Joined Sep 9, 2010
16,384
Hello all,

I am working on a project where I am trying to control a few things in my car using Arduino. One function is to start the vehicle. As a safety function my code checks to see if the vehicle is running. To do this I am tapping into the engines crank position sensor. Some of these are 5v PWM some are 5-8V peak to peak AC. I would like this to be compatible for both types of systems so I was thinking of converting both signals to an analog voltage. Doesn't need to be super accurate like an actual RPM reading, just looking to see if its running. The 5v PWM I'm just using a RC circuit, the AC I am using a diode to cut off -V then the RC circuit. Where I am getting stuck is making sure the voltage stays under 5v regardless of input voltage so my Arduino don't blow up. I am open to any suggestions. I have attached the tinkercad schematic I was playing with. Thank you in advance.
R: 3.9K
C: 10uF
Zen: 5.10V
Just put a 5V zener across the inputs to your Arduino. It's common to use two in anti-parallel to limit the voltage in either polarity.
 

Wolframore

Joined Jan 21, 2019
1,743
The Arduino is fast enough to calculate RPM using interrupts. You can clamp the voltage using zener or resistor dividers... no need to rectify whether you count or not.
 

Reloadron

Joined Jan 15, 2015
5,362
Depending on the vehicle have you given any thought to looking at the signal from the oil pressure sending unit? If you have an oil pressure gauge the sending unit (sensor) changes resistance with changing pressure sending an analog signal to the oil pressure gauge and maybe ECU, all of which is subject to what you have. If you have a light rather than a gauge the sending unit is normally a pressure switch. Either way using oil pressure might be an easier way to know if the engine is running than measuring frequency from a tachometer sensor. Merely something to think about.

Ron
 

Thread Starter

thetinman86

Joined May 6, 2019
2
I guess my real problem is 2 things. the square wave will always be 0-5V but the AC waveform can be like 2V-10V p-p (varies in freq. and magnitude with RPM). The Arduino triggers at 3v so if I half wave rectify to ignore -V I may not have enough voltage to trigger the input. So is there a way to maintain a voltage between 3V-5V+ so I can use a digital pin? Or would it be best to DAC and read on an analog pin? I apologize for my ignorance if this is straight forward or my question is unclear.
 

Wolframore

Joined Jan 21, 2019
1,743
You could read it on the ADC pin just trigger on > 0xCD or about 1v on 5v system. I believe it has to be 10k or less especially for faster reads. I’ve had reliable reads at 100k but haven’t tried higher than that.
 
Last edited:
Top