So, I'm trying to prototype some sequential tail lights for my car. There are three bulbs on each side and 1 in the middle, which I will control with relays and my arduino UNO. As of now I am only trying to get it working on a breadboard with LEDS. I am a complete newb to any type of coding (unless basic html counts lol) and I am just clueless on where to even begin. This video shows exactly what I want to achieve on my breadboard, and from there it should be pretty straightforward to connect it to the relays.
I tried getting his code from him but he seems inactive.
Start with the [u]Blink Example[/u]. If you understand how that works you should be able to add more LEDs and blink them in sequence.
Then try [u]Blink Without Delay[/u]. During the delay() time, execution pauses so you can't read a switch or "do anything", so most real world programs don't use delay() or they use very-short delays.
I am a complete newb to any type of coding (unless basic html counts lol) and I am just clueless on where to even begin.
The two most important concepts in programming are conditional execution ([u]If-statements[/u], etc.) and loops (doing something over-and-over, usually until some condition is reached).
Besides your main loop, there are 3 kinds of loops in C/C++. For-loops are probably the most common, and there are while() loops and do-while() loops.
...There are lots of ways to make a program but I'm thinking a [u]while() loop[/u] might be appropriate for your application. The logic is: while the left turn signal is activated, run the left-side lamp sequence.
which I will control with relays
Relays are OK, but you'll need a relay driver circuit (the Arduino can't directly drive a relay coil). MOSFET drivers are another option, but if you're more comfortable with relays it's OK to stick with something you're familiar with, especially for your 1st project.
On the input-side - As you may know the Arduino can be damaged by more than 5V. Since you'll be getting 12V (unregulated) signals from the car, you'll need a [u]voltage divider[/u] (2 resistors) and a [u]protection diode[/u].
There is nothing new about sequential turn signals, although I don't understand what you want with the bulb in the middle, and there have been recent threads on this forum, and there must be plenty of other places. There are neat and cheap little relay boards for Arduino, but you might be better off with solid state switching devices rather than relays.
About the middle bulb, if you live in a country that still flashes the stop bulbs to make a turn signal, I'm pretty sure the car's wiring takes the middle bulb out of play for that function. I guess the simplest approach it to have Arduinos in each light assembly.
No, those are the relays I was alluding to, but I'm not sure why you need eight, two threes would suffice, and I believe you can get them in any quantity you want.
Nick_Pyner:
No, those are the relays I was alluding to, but I'm not sure why you need eight, two threes would suffice, and I believe you can get them in any quantity you want.
It looks like you can get that 8 channel for 10 but the three channels are 7 each. This is a very budget minded project since there is an existing harness that you can buy that does exactly what I'm trying to accomplish but it's more expensive. It's all going to be tucked behind the liner in my trunk so I'm not too worried about how neat and tidy it is.
If you are budget minded, you may wish to include the cost factor of tickets you may get for a broken taillight if your project hiccups. Or if your light failure gets you rear ended. Just sayin.
INTP:
If you are budget minded, you may wish to include the cost factor of tickets you may get for a broken taillight if your project hiccups. Or if your light failure gets
I suppose that is a risk but I did buy an extra light harness today in case my project does mess up and I happen to catch it before the police do. It's sort of a habit of mine to make sure I check my tail lights before even backing out of the garage so if it breaks, I'll most likely catch it before I even leave my driveway. (Unless of course it happens on the road). So as far as I'm concerned, while I am probably at a greater risk, I'm much more likely to be caught speeding or something else more severe than burnt out tail lights.
(Edit) I plan on leaving the third break light above the trunk completely untouched and it just now occured to me that in my state you need only 1 functioning break light to be considered road legal, so I'm safe at least from tickets
Did you ever get the sequential working properly in your car? I'm looking at wiring up an Arduino Uno with some relays / transistors in a sealed plastic box to do the trick with two inputs (left turn and right turn).
I would expect it to fail. You might want to look at automotive specifications, the 12V can range from 6.5 to 24. There are all types of spikes, transients etc that are normal part of a car's life. In any case be sure to properly fuse your electronics so they do not destroy your car. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil