Go Down

Topic: Headlight control (Read 5489 times) previous topic - next topic

Ogmudbones

Jun 10, 2015, 07:40 am Last Edit: Jun 16, 2015, 11:06 pm by Nick Gammon Reason: Changed "headligh" to "headlight"
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

UKHeliBob

What have you tried so far ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Ogmudbones

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

UKHeliBob

Do you know how to write an if statement that uses only one condition ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Ogmudbones

My understanding is quite limited

UKHeliBob

Have a look at the Control examples in the IDE
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

sonyhome

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 :P

Robin2

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
Two or three hours spent thinking and reading documentation solves most programming problems.

klubfingers

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

UKHeliBob

Quote
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.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

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.

Ogmudbones

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.

UKHeliBob

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.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Ogmudbones

#13
Jun 10, 2015, 03:45 pm Last Edit: Jun 10, 2015, 03:49 pm by Ogmudbones
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.

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 art of getting good answers lies in asking good questions.

Go Up