I am looking for a circuit that can help me convert the higher (12-14.5 V) PWM signal (RPM signal in a car) to stable 5 V PWM that arduino can process.
I´ve seen some topics discussing this. I am not sure if a simple resistor voltage divider is the right route, because the car electronic environment is quite noisy and the voltage fluctuates between 12 - 14.5 Volts, that means the output will probably fluctuate, too.
Also, for the same project, I need to step down the car´s 12-14.5 V to around 9 V to power up the Arduino and also to around 5-6 V to power up a 5 V rgb led strip.
So I am looking for relatively simple circuits that will get me those required values without having to worry about burning the arduino circuitry because of the car´s fluctuating voltage.
What is the source of the PWM signal and what are the specifications (frequency and max load current)?
Without knowing this, the simplest circuit that comes to mind is just a 10K series resistor / shockley diode with its cathode tied to 5V ... this would clip the signal at the anode to about 5.3V peak.
I would recommend an opto-isolator, I think. The rpm signal would drive the led in the opto-isolator through a suitable series resistor, perhaps 2K2 or 4K7. The output of the opto-isolator would be connected between the Arduino pin and ground, which would be set to INPUT_PULLUP mode.
You don't need 9V. Get a 12V-5V DC-DC converter module with enough current for your led strips, one that is suitable for automotive use. This can also power the Arduino through its 5V input.
dlloyd:
What is the source of the PWM signal and what are the specifications (frequency and max load current)?
The source is a crankshaft sensor. I honestly don´t know the value of the current (haven´t had a chance to measure it).
The frequency is 50 - 300 Hz.
So far I used a voltage divider with R1 = 20 kOhm and R2 = 10kOhm. It seemed ok, but I would like something more reliable.
PaulRB:
I would recommend an opto-isolator, I think.
Opto-coupler may be a good idea.
PaulRB:
which would be set to INPUT_PULLUP mode
I am using pulseln() function, so the PULLUP mode is not needed, I guess.
I´ve seen a topic where they used a BJT transistor for the exact same application. I like that idea.
They didn´t include a diagram though, so I am not quite sure what type of transistor could be used.
The reason I suggested an opto-isolator was that it will protect the Arduino from any high voltage spikes that might occur, and the variations in the normal voltage won't matter much. But your crank sensor will need to be able to source or sink around 5~10mA current. A damaging voltage spike would at worst blow the opto-isolator, so maybe put that in a chip socket for easy replacement.
An opto-isolator is a transistor. But instead of being switched on by a current flowing into its base, it's switched on by ir light from the led. This means no direct electrical connection between the 12V & 5V parts of the circuit. Even the grounds can be separate (although the DC-DC convertor may connect them anyway).
I think the OP is a little confused. He is trying to read the signal from a crankshaft position sensor.
This is not PMW, it is an AC signal that increases in voltage as RPM increases.
This thread might help.
PaulRB:
You don't need 9V. Get a 12V-5V DC-DC converter module with enough current for your led strips, one that is suitable for automotive use. This can also power the Arduino through its 5V input.
I'm new to the Arduino, but I'm gonna agree with Paul...
Thats exactly what I'm doing for my car LED strip lights; Powering both the Arduino and LEDs with a DC12/24v to 5v "buck converter". Obviously ill be protecting with fuses and possibly smoothing out the current to the UNO if the buck converter doesn't do it well.
So you could half-wave rectify that and feed that to the opto-isolator through a suitable resistor. The resistor would need to be chosen to avoid exceeding the max current of the led in the opto-isolator at max revs. Hopefully at low revs the voltage will still be enough to trigger the opto-isolator for a moment at the peak of each cycle.