Signal Conditioning, 0-12v to 5v

Thread Starter

engelbrekt

Joined Apr 21, 2021
10
Hello, I will need some advice from you. I am making a frequency counter, the circuit is meant for displaying the rpm or speed in a car.
The speed and rpm have an amplitude of typically 5v, but I have seen 12v in some cases. The signals are counted with the help of a pic16f controller.
What are the alternatives for a signal processing circuit? The frequency is typically in the low kHz range.
 

Sensacell

Joined Jun 19, 2012
2,917
You need a clean, noise-free pulse into the micro.

If your MCU input has a Schmitt trigger, you could just use a series resistor and a capacitor to gnd.


The Micro has input protection diodes that you can rely on to clamp the input voltage to ~5.6 V (assuming a 5V MCU?)
If you chose the resistor value to limit the peak current to a hundred microamps or so, it will work fine.
The capacitor is optional if the signal is noisy.

If it's a standard TTL input, you might consider an external Schmitt trigger to clean up the edges.

What is the source of this signal?
What frequency range do you expect?
 

Tonyr1084

Joined Sep 24, 2015
6,452
If you're talking about the speed sensor on an automobile, they run on 5V from the MCU. Their output is a 5V square wave at 50% duty cycle. The faster the car travels the higher the frequency. That frequency is converted into an RPM readout.

Had a Tacoma that would read 65MPH while traveling at 54 MPH actual speed. Did calculations to determine engine RPM in drive (not overdrive) and further proved the speedometer was not reading correctly. The fix was to change the driven gear in the sensor. That got me nearly 100% accuracy. I just had to move the speedometer needle slightly below zero MPH to get it right. At 50MPH the speedo was 100%. At 75MPH the actual speed was 74 MPH. At 25MPH the actual speed was 26 MPH. That was close enough for me. The Taco had been previously owned by someone who changed the tire size and hence the speedo sensor gearing. When I bought the truck they put the cheaper tires and rims back on the vehicle but didn't bother with the gearing.

Are you trying to build an alternate speedometer? Or a speedometer from scratch? Using a standard speed sensor will likely run on 5V. I also discovered my sensor put out three pulses per each revolution of the driveshaft. There's a lot to be taken into consideration. First, tire size, then rear end gear ratio. Then the speed sensor gearing. Once you have that worked out you can get a reliable signal and go from there. The electronics to read the number of pulses per minute can then be translated into MPH. Or KPH. That's all in the programming.
 

Thread Starter

engelbrekt

Joined Apr 21, 2021
10
You need a clean, noise-free pulse into the micro.

If your MCU input has a Schmitt trigger, you could just use a series resistor and a capacitor to gnd.


The Micro has input protection diodes that you can rely on to clamp the input voltage to ~5.6 V (assuming a 5V MCU?)
If you chose the resistor value to limit the peak current to a hundred microamps or so, it will work fine.
The capacitor is optional if the signal is noisy.

If it's a standard TTL input, you might consider an external Schmitt trigger to clean up the edges.

What is the source of this signal?
What frequency range do you expect?
The circuit is meant to be very universal, thus the source of the signal can vary. It can be sourced from a canbus rpm/speed converter which typically outputs 4hz per km/h. On older cars, it can be sourced from the already existing speed signal to the tacho or radio unit. The main reason for the 12v compatibility is that I have seen that inductive sensors are fitted aftermarket in some cases. These inductive sensors are normally fed with 12v.
The rpm signal can also be taken from the tacho but also sourced from the crankshaft sensor. I haven't measured the frequency yet but I suppose it in the low kHz range. So 0-20kHz should be fine. Edit: Yes the MCU will be 5v compatible, most likely a 16F1827, because I have a plenty of them lying around.
 
Last edited:

Thread Starter

engelbrekt

Joined Apr 21, 2021
10
If you're talking about the speed sensor on an automobile, they run on 5V from the MCU. Their output is a 5V square wave at 50% duty cycle. The faster the car travels the higher the frequency. That frequency is converted into an RPM readout.

Had a Tacoma that would read 65MPH while traveling at 54 MPH actual speed. Did calculations to determine engine RPM in drive (not overdrive) and further proved the speedometer was not reading correctly. The fix was to change the driven gear in the sensor. That got me nearly 100% accuracy. I just had to move the speedometer needle slightly below zero MPH to get it right. At 50MPH the speedo was 100%. At 75MPH the actual speed was 74 MPH. At 25MPH the actual speed was 26 MPH. That was close enough for me. The Taco had been previously owned by someone who changed the tire size and hence the speedo sensor gearing. When I bought the truck they put the cheaper tires and rims back on the vehicle but didn't bother with the gearing.

Are you trying to build an alternate speedometer? Or a speedometer from scratch? Using a standard speed sensor will likely run on 5V. I also discovered my sensor put out three pulses per each revolution of the driveshaft. There's a lot to be taken into consideration. First, tire size, then rear end gear ratio. Then the speed sensor gearing. Once you have that worked out you can get a reliable signal and go from there. The electronics to read the number of pulses per minute can then be translated into MPH. Or KPH. That's all in the programming.
Yes, you could call this a type of "add-on" speedo. Many older car clusters malfunction, but the signals are still intact and working. I know the real speed is affected by tire size and gear ratios, all of that will be taken into consideration, but that is for the software part. I am more interested in how to make a clean signal for the controller to count.
 

eetech00

Joined Jun 8, 2013
2,644
Hello, I will need some advice from you. I am making a frequency counter, the circuit is meant for displaying the rpm or speed in a car.
The speed and rpm have an amplitude of typically 5v, but I have seen 12v in some cases. The signals are counted with the help of a pic16f controller.
What are the alternatives for a signal processing circuit? The frequency is typically in the low kHz range.
use a simple BJT circuit as a signal conditioner.
 

Sensacell

Joined Jun 19, 2012
2,917
The circuit is meant to be very universal, thus the source of the signal can vary. It can be sourced from a canbus rpm/speed converter which typically outputs 4hz per km/h. On older cars, it can be sourced from the already existing speed signal to the tacho or radio unit. The main reason for the 12v compatibility is that I have seen that inductive sensors are fitted aftermarket in some cases. These inductive sensors are normally fed with 12v.
The rpm signal can also be taken from the tacho but also sourced from the crankshaft sensor. I haven't measured the frequency yet but I suppose it in the low kHz range. So 0-20kHz should be fine. Edit: Yes the MCU will be 5v compatible, most likely a 16F1827, because I have a plenty of them lying around.
If it's supposed to be "universal" you would be wise to define what that means very carefully, and design a circuit that will be universal- within that specification.
 

MisterBill2

Joined Jan 23, 2018
9,793
OK, you are asking us to do your product development engineering for free. I don't think so!. What you need is a completely isolated signal input that has a fairly high impedance, at least 1K ohm, 10K would be better, and then a solid amplitude clamp so that any input, 12 volts or 100mV will deliver the same signal to your processor. But it has to be a clamp circuit, not a simple attenuator because all signals must be clamped to the same level.
 

InTheSky

Joined Sep 28, 2018
1
Hello, I will need some advice from you. I am making a frequency counter, the circuit is meant for displaying the rpm or speed in a car.
The speed and rpm have an amplitude of typically 5v, but I have seen 12v in some cases. The signals are counted with the help of a pic16f controller.
What are the alternatives for a signal processing circuit? The frequency is typically in the low kHz range.
You could try an optocoupler like a simple PC817. The LED driving side is mostly voltage agnostic with a series resistor while the transistor side can generate clock pulses for the Mcu.
 

MisterBill2

Joined Jan 23, 2018
9,793
One device intended for exactly that application is the LM2917 tachometer IC, originally created by National Semiconductor. I am not sure who makes them now. That device is specific to the application and the application notes cover all kinds of voltage inputs. I have used them and they work very well.
 

graybeard

Joined Apr 10, 2012
19
This can be very tricky depending on how universal you want it to be. I use a BAT54S diode array and a resistor sized to protect the BAT54S but also to provide low enough impedance for the PIC input. If you are connecting to a traditional points/coil setup, the voltage on the signal can go up to several hundreds of volts. You can also get that level of voltage from the battery voltage if the battery becomes disconnected while the alternator is spinning and charging the battery. Don't forget to protect the power supply from voltage spikes and reversed polarity (from mistakes with jumper cables).

An internet search about automotive circuit protection will yield a lot of good information about how to protect your circuits.

I use a comparator input set to interrupt at 1V (internal Vref) on a rising edge. I then read and reset Timer1. If I get a Timer1 overflow interrupt, I assume it is stopped and set the RPMs/Speed to 0. The value read from Timer1 allows you to calculate the RPMs or speed.
 
Top