Hey guys,
Just curious. Researching what I can on my own and getting some advice from those that I can. And I'm coming up a little confused on something.
I retrofitted a newer engine into my 67 Nova and I'm going to use an Arduino with a motor shield to control the fuel pump. The engine control module (ECM) has a "fuel pump turn-on" wire coming from the ECM and it is a 12V+ signal. The signal is sent when the key is first turned on, If it doesn't sense a few other things (cranking, engine running, etc) it'll de-energize the wire and the pump shuts off again. If it senses the car is cranking or running, it'll keep the wire energized until otherwise.
I'll need to use this wire as an "A" input on the Arduino. I'm looking for the a way step the 12v down to 5v (or lower) while having the installl look as clean as possible. I plan to put a blank protoshield on top of the motor shield and would like to use the protoshield to hold the voltage reducing equipment.
I was looking at a step down voltage regulator like this:
Or an analog voltage divider like this:
http://www.robotshop.com/en/gravity-voltage-divider.html?gclid=EAIaIQobChMIrbya76LL1gIVBw5pCh3VWACnEAQYBSABEgLfAfD_BwE
Or I was just going to build a voltage divider from two resistors (R1 being 8K and R2 being 5K).
My questions are:
- Will either of the first two work since the 5v is being used as a "signal" rather than a "power source"? I like those because they'll look like a nice clean install.
- Is there anything wrong with doing the resistor based divider on my own? I know it'll be kinda ugly, but is there any downfalls to doing that?
For feeding to the Vin on the Arduino, I was going to use the Ignition wire (key forward wire....ACCY wire...whichever you prefer to call it) to turn the Arduino on. I know the Arduino can handle 12v, but the literature states it can cause trouble if you exceed 12v....and with automotive systems, voltage can be as high as 13.8-14.2 or so.
Sooooo..... I was looking at this step down voltage regulator (same as the 5v version, but it is 9v):
My questions with that are:
3. Will that work out OK for supplying power?
4. Or am I better off doing a resistor based voltage divider with that?
Thanks in advance for any replies!! Much appreciated!!
Sounds like the 12V signal will only be digital (high/low), not analog, so there's no need to use a voltage divider on it. Technically you could use a voltage regulator to step it down, but really that just creates heat and you shouldn't do that.
What I would recommend is a voltage comparator that compares your signal/logic line with a reference voltage like the voltage of your Arduino (5V). The output of the comparator would then be fed into any digital pin on the Arduino. When the signal line is at 0V the comparator outputs logic low (0V), and when the signal goes to 12V (higher than 5V), the comparator outputs logic HIGH (5V) for your Arduino to read.
Keep in mind that there are different types of comparators. The logic I just mentioned is for a "push-pull" comparator, where it pushes to the rails of the supply voltage and therefore will output 0V or 5V if you power it with 5V. This could work, but don't power it with anything other than your Arduino VCC!
What you could also use is a comparator with an active-low "open-drain" output, which means that it will be electrically disconnected when it's supposed to output HIGH (when the signal goes above 5V), but it will "pull" the output to 0V when the comparator outputs low. However, with an open-drain make sure to use the line "pinMode(pinNum, INPUT_PULLUP) to use the internal pull-up resistor so that the logic is normally HIGH and only goes LOW when the switch from 0V to 12V (or vice versa) occurs, depending on which way you wire your comparator references.
Also note that you can switch the pins of the comparator so that it inverts the logic. For example, if you put the 5V reference on the "+" side and signal on the "-" side, the comparator will output HIGH (or open-drain) when the signal is lower than 5V and LOW (0V) when the signal is > 5V.
Hope that helped!
Hi,
@androidfanboy
Sounds like the 12V signal will only be digital (high/low), not analog, so there's no need to use a voltage divider on it.
Why not, its simple, a couple of caps to bypass and you have 0 to 5V output for 0 to 12V input.
Tom.... 
True, you could use a voltage divider.
Androidfan thank you for the reply!!! I'm a little... Well, a lot.. Lost with all of the comparator info. I followed pretty well for most of it though. But if in fact a divider will work, I think that's the way I'll go. Can't say it'll look slick, but function needs to come before form. I thought those regulators would look nice paired up side by side lol. But I need to do what works best and not worry about the looks.
Thank you again for the reply!
Sorry, I might've just confused you more than anything. A voltage divider would be the simplest way, but if you want to, say, wake up your Arduino from deep sleep when the voltage goes from 0V to 12V or vice versa, the comparator could be nice to provide a clean interrupt, or if you need to minimize power consumption.