I am attempting to setup the arduino uno (will be replaced with with the arduino pro mini when the bugs are worked out) anyways, I am trying to just get it to start and stop the engine on my vehicle at the moment. I have two relays wired into the dash (both are 12 volt automotive relays) one turns on the power to everything in the vehicle the other engages the starter, this set up works fine with a switch and a momentary contact button). Anyways I am having a hard time getting the arduino to drive the relays.
I started out trying to use a npn transistor with the base coming from one of the arduino pins the collector hooked to +12 volts and the emitter going to one side of the relay coil, I then tried routing the 12 volts through a 5 volt relay I had laying around however it couldn't handle it either (completely vaporized one of the pins).
So not I am trying to use an lm358 dual op amp as a comparator. From what Ive read when used without the feedback resistor, it should swing between full on and full off. So to start off with here is the wiring the arduino pins mentioned are what I named them and if you need to know exactly where they are hooked up that info can be found in the program which I will include in a moment:
I have an lm358 dual op amp set up as a comparator. Pin 8 goes to +12 volts, pin 4 to ground, pins 2 and 6 (the inverting pins) are hooked into a voltage divider with 3 10 ohm + 2 4.7 ohm resisitors in series coming off the 12 volts and a 10 ohm rersistor going to ground (the numbers came out to 39 ohm
from the 12 volt side and a 10 ohm to ground to give me 2.5 volts 250 ma at the inverting side of the comparators but those ressistors were the closest I could get) pin 3 gets hooked up to the RTRAN pin on the arduino, pin 5 goes to the STRAN pin on the arduino, pin 1 goes to the coil on a 12 volt relay to power up the vehicle, and pin 7 goes to coil of a second 12 volt relay to engage the starter (of course the relays the other side of the coils go to ground, the common pins go to whatever the relay is driving, and the normally open pins are hooked up to +12 volts). There is also a wire coming off of pins 3 & 5 which go to LEDs for a visual cue of when the power and starter are engaged. Then there is a lead going from the TLED pin on the arduino to an led for a visual indication if the timer is active or not, and a lead going from the +5 on the arduino to a fourth led just to show it is powered up. I have a lead going from +5 on the arduino to both the buttons, a 1k resistor going from the other side of each button to ground, and a lead going from the lead with the resistor on the green button to the GBUT pin on the arduino and a lead going from the lead with the resisitor on the black button going to the BBUT pin on the arduino. Of course I have a resistor on the cathode side of each led going to ground. I have the arduino powered from the batteries in the back through the jack on the arduino, I am pulling the +12 volts from the vin pin on the arduino to feed the dual op amp. The grounds are being fed through the arduino, and the +5 volts are coming from the +5 volt pin on the arduino.
Anyhow the current configuration that I am having a hard time making work correctly was to use a dual op amp (lm358) with the inverting side hooked up to a voltage divider in such a way that the inverting side recieves about 2.5 volts (this will vary a little bit as I have it hooked into the back batteries which are draining as I use the electronics but I figure since Im only letting it drop about a volt and a half before charging it should be negligible. the vin pin is hooked to tp the vin pin on the arduino, ground to ground. From what ive read with no feedback resistor this should give me full on when I do a digitalWrite(RTRAN, HIGH) (as in the output should be the full 12 volts when the non inverting side
is recieving +5 volts or close to it) and should give me close to ground when low. Unfortunately this is not the way it is working. when I put it in operation Im only getting around 3 or 4 volts going to the relays. I have good 12 volts where there is supposed to be 12 volts, I have almost 5 volts coming from the arduino to the op amps when they are set to HIGH, and I am reading like 2.2 volts at the inverting pins through the voltage divider. I originally had two npn transistors with the RTRAN and STRAN going
to the bases, the collectors hooked to the +12 and the emitters going to the relay coils but couldnt get the full 12 volts through it, thats why I settled on the dual op amps. I tried the experiments out in the digital circuits book I have and it worked (though in the book it calls for a 272 and I have the lm358 however it worked as expected). I tried routing the 12 volts through a smaller relay that operated at 5 volts, however they couldnt handle the current required and fried both of them. I figure the run
relay is probably pulling 10 to 15 amps, the starter relay should only be pulling a few amps as it is going straight to the starter relay in the engine compartment. To be honest I didnt expect those little relays to be able to handle it but theyve been sitting in my parts tray for quite a while now and at least I know.
the code I have will be in the next post as it doesn't like this one being over 9000 characters.