Hi,
I need to use a 12V 30A Dual headlamp relays. These types are used for switching the beams of a head light in a car. The picture of the relay and the schematic for the same is attached.
I am using a Transistor driver circuit, consisting of BC639 NPN, with a flyback diode across the inductive relay coil. Pins 4 and 8 on the UNO are triggers for the LOW and HIGH beam respectively. The relay is triggered by providing 12V DC across it; the relay coil has a resistance of 76 ohms and so I calculated that a current of 150mA is required to turn on the relay.
I have connected the 12V power supply and arduino GND together, after frying my first arduino and reading through various posts on this forum for similar relay switching problems.
THE PROBLEM: When I set PIN 4 to HIGH the LOW beam is triggered and the bulb lights up in LOW BEAM MODE. Then after a delay of 2 sec, I set PIN 4 to LOW, which triggers the LOW BEAM to switch off, and so the head light turns off. And give a delay of about 2 sec for the back EMF to safely dissipate. Then, when I set PIN 8 to HIGH, I expect the headlight to turn on in HIGH BEAM MODE, but it turns on in LOW BEAM itself.
After rewiring the circuit again, (removed it and put it back together) I found something more puzzling!!!
Now, when I set either of the pins high (alternately, obviously and never together!) BOTH THE HIGH AND LOW BEAM filaments of the Headlight turn on !! SO it does not matter whether i set PIN 4 or PIN 8 to HIGH, its always this "mixed beam" that I get. Why isn't the driver circuit switching off, like it should when i set the respective pin LOW?
So, please correct me if I am wrong, what I think is both the relay driver circuits are on no matter what delay I give.
Any help will be much appreciated. Thank you in advance.
Please check the schematic that I have uploaded and the code for doing the same is as follows:
#define lowBeam 4
#define highBeam 8
void setup() {
pinMode(lowBeam, OUTPUT);
pinMode(highBeam,OUTPUT);
}
void loop() {
digitalWrite(lowBeam, HIGH);
delay(2000);
digitalWrite(lowBeam, LOW);
delay(2000);
digitalWrite(highBeam,HIGH);
delay(2000);
digitalWrite(highBeam,LOW);
delay(2000);
}