Headlight control

I recently purchased an arduino and a relay board for a project. I am trying to write a program that can control my trucks HID headlights. The problem with my vehicles headlights is when you change over to high beams the low beams cut off and if you meet someone you have no headlights for a good 10 seconds. I am trying to write a code that can take the input off one sides headlight connectors (yes i know you dont send 12 volts to aurduino pins got that part covered) to control the relay board and activate the headlights accordingly. The basic idea goes something like low beam=high send 2 pins high then if the lowbeam input goes low for a short period of time (maybe a second at the most) but the highbeam input goes high it sends all 4 pins high if no input is seen after that short delay all the pins go low

What have you tried so far ?

Nothing...i have no idea on how to write an if-then statement that encompasses all of those parameters

Do you know how to write an if statement that uses only one condition ?

My understanding is quite limited

Have a look at the Control examples in the IDE

sounds like instead you should just rewire the low beams or figure out what's the deal.

normally you drive low beams or high, then a wheel lever allows you to drop low in an instant.

this is overkill :stuck_out_tongue:

Ogmudbones:
The basic idea goes something like low beam=high send 2 pins high then if the lowbeam input goes low for a short period of time (maybe a second at the most) but the highbeam input goes high it sends all 4 pins high if no input is seen after that short delay all the pins go low

I find this description confusing. Could you write it out with each step on a separate line.

I suspect if you describe what you want clearly you will also understand how to implement it.

Why isn't there an instantaneous switch-over from High to Low and Low to High
How do you control the lights while you are driving?
Can you have High and Low on at the same time, or does that require too much electricity?

...R

How long does it take for your high beams to go from off to normal brightness?
How about low beams?

f you meet someone you have no headlights for a good 10 seconds.

This seems to to be simply wrong. What is it that causes the 10 second delay ? It seems to me that you should fix that rather than trying to paper over the cracks by introducing an Arduino into the circuit.

Perhaps if you had read the description as to the type of headlight you would know why they take 10 seconds to come up to full power. The're hid's and they dont just come on instantatly they must warm up.

Robin2:
I find this description confusing. Could you write it out with each step on a separate line.

I suspect if you describe what you want clearly you will also understand how to implement it.

Why isn't there an instantaneous switch-over from High to Low and Low to High
How do you control the lights while you are driving?
Can you have High and Low on at the same time, or does that require too much electricity?

...R

Well the steps are more or less like this
On startup read the state of the 2 input pins if the pin for high beams is on send all 4 relays high
If the pin for low beams is high send only 2 relays high
If both inputs go low after that condition is met wait 2 seconds before sending the relay pins low
If there is an input between those 2 seconds do the action that corresponds to the state of the pins if there is no input send the relay pins low.
As for power im running a hard hot line from the battery to the relay board so avalible energy isnt the problem. Gm just decided you dont need both at the same time during its model year.

Ogmudbones:
Perhaps if you had read the description as to the type of headlight you would know why they take 10 seconds to come up to full power. The're hid's and they dont just come on instantatly they must warm up.

Describing a headlight as a HID means nothing to me and I don't see why I should be expected to do research when a simple explanation of the acronym and how they work would have made things clearer. Your description of the problem did not make the problem clear as far as I am concerned and I suspect that others will be in the same position. Your requirements for pins to go HIGH and LOW did not help me either because it is not clear what HIGH/LOW do in the circumstances.

Can you please describe what should happen in terms of the lights ? At the moment it seems as though you simply want the low beams to stay on for 10 seconds when the switch controlling the headlights is changed from low beam to high beam. Is that what you want, assuming of course, that you cannot simple have the low beam lights on at the same time as the high beams.

UKHeliBob:
Describing a headlight as a HID means nothing to me and I don't see why I should be expected to do research when a simple explanation of the acronym and how they work would have made things clearer. Your description of the problem did not make the problem clear as far as I am concerned and I suspect that others will be in the same position. Your requirements for pins to go HIGH and LOW did not help me either because it is not clear what HIGH/LOW do in the circumstances.

Can you please describe what should happen in terms of the lights ? At the moment it seems as though you simply want the low beams to stay on for 10 seconds when the switch controlling the headlights is changed from low beam to high beam. Is that what you want, assuming of course, that you cannot simple have the low beam lights on at the same time as the high beams.

Well there are 2 pins for input and due to the nature of vehicle neither one can be on while the other one is on so i want to assign it so if the pin i am using to read the lowbeam headlights state is high then 2 output pins will go high and activate 2 relays one for each low beam hid on each side. But when i flip over to high there will be a short delay when the low beam relay on the truck shuts off and the high beam relay switches on so i want it to hold the low beams on long enough for the relay on the truck to switch over and send the high beam pin high. I want the high beam pin to send 4 output pins high to activate all 4 relays, and like the low beam when I switch it back over to low beams i want it to hold the 4 pins high until the relays swap over. Once the relays swap over i want that to cause the state change on the output pins. If the timer expires it just sends all the pins low.

That is NOT describing what you want the lights to do. That is another confusing attempt to describe what you think the Arduino should do.

If the low beam lights take 10 seconds to come on, how can using the Arduino and a relay or 4 make them come on faster?

PaulS:
That is NOT describing what you want the lights to do. That is another confusing attempt to describe what you think the Arduino should do.

If the low beam lights take 10 seconds to come on, how can using the Arduino and a relay or 4 make them come on faster?

The aurduino keeps the low beams on all the time and also keeps them on during the transition from the low beam relay to the high beam relay by keeping the lows on all the time they dont have to warm up.

Hi,
Are these lights original equipment on your truck, or have you fitted them as after market.

These sort of lights are in Australia only allowed in vehicles equipped to do so, aftermarket fitting is not allowed in vehicles not designed for them.
If you do fit them, then your vehicle has to go through another road worthy check.
I would be ringing my insurer if they are after market fitted, to see if I was still covered.

A lot of people are not aware of what is in the fineprint, you are not insured if your car is unroadworthy.

Tom.... :slight_smile:

They're aftermarket and in my state there are no road worthyness checks. People drive around here with 8 inch lifts on there trucks with black smoke coming out the tailpipe. As for the insurance aspect of it im covered.

Hi,

The aurduino keeps the low beams on all the time and also keeps them on during the transition from the low beam relay to the high beam relay by keeping the lows on all the time they dont have to warm up.

Well wire the low beams to the panel switch that turns your lights on, and leave the high beam connected to high beam switch.
But be careful of over heating the lamp and the driver.

I think you want the low beams to stay on after you switch to high beams UNTIL the high beams light up, then low turns off.
Why do you not have the same problem going from high to low, the lows must have to warm up.
Or does the heat from the high beam keep the low beam area heated.

Tom... :slight_smile:

TomGeorge:
Hi,
Well wire the low beams to the panel switch that turns your lights on, and leave the high beam connected to high beam switch.
But be careful of over heating the lamp and the driver.

I think you want the low beams to stay on after you switch to high beams UNTIL the high beams light up, then low turns off.
Why do you not have the same problem going from high to low, the lows must have to warm up.
Or does the heat from the high beam keep the low beam area heated.

Tom... :slight_smile:

The lowbeams have to stay on the way hid's work is there's a small amount of metal salts on the tube a high voltage pulse vaporizes these salts and turns them into a gas then a 80-90 volt ac signal goes into the lights and keeps them running...when you turn them off the gases recondense and you havw to wait for them to warm back up...obviously not the best thing to have no headlights even for a short period of time