Hi, I'm making a arduino project to control a stationary engine, my engine have a diferential pressure gauge that makes ground whenever the oil pressure falls, so my question is:
-Can I use a LM7805 to convert the 12v signal to a 5v signal attached to a digital pin?
Ok thank you, I will use a photocoupler PC900V it sounds an easier way than the resistor and I really did not understand much of the protection diodes…
cuantoom:
Ok thank you, I will use a photocoupler PC900V it sounds an easier way than the resistor and I really did not understand much of the protection diodes…
Excellent idea, though that particular device is massive over-kill for the purpose.
A common 4N25 is cheap and will do the job just fine. Use a 1k resistor in series with the input LED (yes, you cannot get away without using resistors), connect the output transistor between ground and a digital pin (which automatically includes an analog pin) and set that pin to INPUT_PULLUP.
cuantoom:
Hi, I'm making a arduino project to control a stationary engine, my engine have a diferential pressure gauge that makes ground whenever the oil pressure falls, so my question is:
-Can I use a LM7805 to convert the 12v signal to a 5v signal attached to a digital pin?
Thank you in advance.
If the sensor is a standalone sensor (not connected to any other circuitry), it can be connected directly to the Arduino. If however it is connected to 12v via a warning light, it needs voltage reduction.
cuantoom:
Hi, I'm making a arduino project to control a stationary engine, my engine have a diferential pressure gauge that makes ground whenever the oil pressure falls, so my question is:
-Can I use a LM7805 to convert the 12v signal to a 5v signal attached to a digital pin?
Thank you in advance.
Use this circuit:
(click image for full size)
The resistor pair (1800 and 1000 ohm) divide the input signal so that 14 volts in gives you 5 volts out (because engines usually have more than 12.0 volts available). The two diodes clamp the signal so that it cannot go more than 0.7 volts below 0 or more than 0.7 volts above 5 (this protects the Arduino input pin). The capacitor catches very fast noise pulses that may "sneak through" before the diode(s) begin to conduct and clamp.
If you want just a "12 volts or no volts" indicator, use a digital input. If you want to actually read the voltage, use an analog input, knowing that 14.0 is an analog reading of 1023 and 0.0 is an analog reading of 0 (calibrate it using the map() function).
Except the clamp diodes need to be schottky really. Make the resistances 18k and 10k and
no clamping diodes are needed because the internal diodes will survive that level of current.
Paul__B:
Excellent idea, though that particular device is massive over-kill for the purpose.
A common 4N25 is cheap and will do the job just fine. Use a 1k resistor in series with the input LED (yes, you cannot get away without using resistors), connect the output transistor between ground and a digital pin (which automatically includes an analog pin) and set that pin to INPUT_PULLUP.
Thank you but if I set the pin as input and wire it to ground through the transistor where the signal will come from? I mean does not the transistor need a power source?
weedpharma:
If the sensor is a standalone sensor (not connected to any other circuitry), it can be connected directly to the Arduino. If however it is connected to 12v via a warning light, it needs voltage reduction.
Weedpharma
Yes it is connected to the engine battery but can I power the gauge with 5v instead? considering that the gauge makes ground with the engine case that is connected to the 12v battery ground…
Krupski:
Use this circuit:
(click image for full size)
The resistor pair (1800 and 1000 ohm) divide the input signal so that 14 volts in gives you 5 volts out (because engines usually have more than 12.0 volts available). The two diodes clamp the signal so that it cannot go more than 0.7 volts below 0 or more than 0.7 volts above 5 (this protects the Arduino input pin). The capacitor catches very fast noise pulses that may "sneak through" before the diode(s) begin to conduct and clamp.
If you want just a "12 volts or no volts" indicator, use a digital input. If you want to actually read the voltage, use an analog input, knowing that 14.0 is an analog reading of 1023 and 0.0 is an analog reading of 0 (calibrate it using the map() function).
Hope this helps.
Yes I want a 12v or no volts indicator so my guess of using a digital pin seems legit. I was playing with a voltage divider calculator making 14v to 5v and it says I need a 18k and 10k resistors as MarkT suggested but with the same resistors and 12.7v as input (is the usual lowest voltage of the engine battery) the output is 4.268v so my question is will the arduino still read it as a high?
cuantoom:
Thank you but if I set the pin as input and wire it to ground through the transistor where the signal will come from? I mean does not the transistor need a power source?
Indeed. That is precisely what "INPUT_PULLUP" is.
cuantoom:
I was playing with a voltage divider calculator making 14v to 5v and it says I need a 18k and 10k resistors as MarkT suggested but with the same resistors and 12.7v as input (is the usual lowest voltage of the engine battery) the output is 4.268v so my question is will the arduino still read it as a high?