Chase lighting for back of truck

Hi All

My first taste of this kind of thing so be gentle with me. :o I am an auto electrician and have fitted perimeter lights to the back of truck, I wish for these to work as a chase. 6 led 24v lights each side when indicating(similar to most modern cars)

What would I need to do to make a 24v system work? Would an UNO be able to do this? Code I would need to write?

Sorry if question asked before but couldn't find an answer which I felt comfortable with.

Thanks PETER

Sorry guys don't know eticate.... would this work

void setup()

{

pinMode(8, OUTPUT);

pinMode(9, OUTPUT);

pinMode(10, OUTPUT);

pinMode(11, OUTPUT);

pinMode(12, OUTPUT);

}

void loop() //this means Perform functions again and again

{

delayTime = analogRead(0); //0 means Analog Input A0

digitalWrite(8, HIGH); delay(delayTime);

digitalWrite(8, LOW); delay(delayTime);

digitalWrite(9, HIGH); delay(delayTime);

digitalWrite(9, LOW); delay(delayTime);

digitalWrite(10, HIGH); delay(delayTime);

digitalWrite(10, LOW); delay(delayTime);

digitalWrite(12, HIGH); delay(delayTime);

digitalWrite(11, HIGH); delay(delayTime);

digitalWrite(11, LOW); delay(delayTime); digitalWrite(12, LOW); delay(delayTime);

24V in a car???

Would an UNO be able to do this?

Yes, but you can't directly drive the 12/24V lights with the Arduino. The Arduino works at 5V (although it has a voltage regulator and can be powered from 12V) and the output pins can only put-out 40mA maximum (enough to power a "regular" little LED).

Each "channel" will need a MOSFET or transistor driver circuit. [u]Here[/u] is a MOSFET driver example. It will work as long as the MOSFET is rated to handle the required current. Or, you can use a solid state relay. (Regular electro-mechanical relays usually require a driver for the coil, whereas many solid state relays can be driven directly from the Arduino.)

If you choose to use solid state relays, make sure to get DC relays... AC solid state relays won't work with DC.

Code I would need to write?

... would this work

Yes, but don't forget to define 'delayTime'. ;) If you can understand how the [u]Blink LED Example[/u] works, you can easily modify it to blink multiple LEDs/lights in sequence.

The [u]Button Example[/u] shows you how to read a button (or switch) and then use an [u]if-statement[/u] to "take action" or (not) depending on the switch state.

This probably won't be necessary, but the delay() function pauses your program so you can't do anything (like read a switch) during the delay time. If you need to read a switch to stop the light-sequence in the middle of the sequence, look at the [u]Blink Without Delay example[/u].

P.S. I don't know if it's appropriate for what you're doing but there are "more interesting" sequence patterns such as turning-on two (or more) lights in a row or making a [u]Johnson Counter[/u]. And of course, once you have software control you can reverse it, etc.

Great stuff,

Thanks very much