Enter Your Project for a chance to win a grand prize for the most innovative use of Arduino or a $200 shopping cart! The Birthday Special: Arduino Projects for Arduino Day! | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
Some time back I blogged about things going wrong
I had made some electronic Brake/Indicator units, that took seperate Brake and Indicator signals and mixed them to drive LED tailights.
Here in NZ and some other countries the indicator is a seperate 21w lamp and an amber coloured lens.
Older American cars simply use the same lamp as the brake light and flash it when the indicators are operated.
There are several ways to do it, and GM tended to use extra parts in the column switch (which fail over time or when overloaded)
I'd made several of these in a couple of different configurations, and set number 3 was offered to a local Hotrodder.
He struggled with the wiring and then hit the issue with combining tail/brake and indicator into a twin filament lamp.
His budget didn't extend to an automotive electrician and relays or whatever they would suggest (no-one else offered a solution).
Testing
The testing needed to simulate the product in everyday use.
This includes indicators only, brake only and combinations of brake and indicator.
Obviously they need testing before encasing in epoxy.
Therefore they are tested twice.
I could have powered the appropriate wire and checked the result, but I've found that method to have issues.
What better use for an Arduino, three relays and some LED's.
CODE
The code is below
/* Tail light Tester This turns on several relays and is used to test the LED Tailight boards Sequence is :- Left Ind Right Ind Brakes Brake plus Left Brake plus Right Left plus Brake Right plus Brake */ //Define Outputs const int L_Indicator = 12; const int L_Indicator_LED = 11; const int Brake = 10; const int Brake_LED = 9; const int R_Indicator = 8; const int R_Indicator_LED = 7; int x=0; // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); pinMode(L_Indicator, OUTPUT); pinMode(L_Indicator_LED, OUTPUT); pinMode(Brake, OUTPUT); pinMode(Brake_LED, OUTPUT); pinMode(R_Indicator, OUTPUT); pinMode(R_Indicator_LED, OUTPUT); } // the loop function runs over and over again forever void loop() { delay (1000); // L_Indicator ON for (x = 0; x <=10; x++) { digitalWrite(L_Indicator, HIGH); digitalWrite(L_Indicator_LED, HIGH); delay (500); digitalWrite(L_Indicator, LOW); digitalWrite(L_Indicator_LED, LOW); delay (500); } delay (1000); // R_Indicator ON for (x = 0; x <=10; x++) { digitalWrite(R_Indicator, HIGH); digitalWrite(R_Indicator_LED, HIGH); delay (500); digitalWrite(R_Indicator, LOW); digitalWrite(R_Indicator_LED, LOW); delay (500); } delay (1000); // Brakes ON digitalWrite(Brake, HIGH); digitalWrite(Brake_LED, HIGH); delay (5000); // Brakes OFF digitalWrite(Brake, LOW); digitalWrite(Brake_LED, LOW); delay(1000); // wait for a second // Brake plus Indicator // Brakes ON digitalWrite(Brake, HIGH); digitalWrite(Brake_LED, HIGH); delay (500); // L_Indicator ON for (x = 0; x <=10; x++) { digitalWrite(L_Indicator, HIGH); digitalWrite(L_Indicator_LED, HIGH); delay (500); digitalWrite(L_Indicator, LOW); digitalWrite(L_Indicator_LED, LOW); delay (500); } delay(1000); // wait for a second // Brakes OFF digitalWrite(Brake, LOW); digitalWrite(Brake_LED, LOW); delay(1000); // wait for a second // Brakes ON digitalWrite(Brake, HIGH); digitalWrite(Brake_LED, HIGH); delay (500); // R_Indicator ON for (x = 0; x <=10; x++) { digitalWrite(R_Indicator, HIGH); digitalWrite(R_Indicator_LED, HIGH); delay (500); digitalWrite(R_Indicator, LOW); digitalWrite(R_Indicator_LED, LOW); delay (500); } delay(1000); // wait for a second // Brakes OFF digitalWrite(Brake, LOW); digitalWrite(Brake_LED, LOW); delay(1000); // wait for a second // Indicator plus Brake // L_Indicator ON for (x = 0; x <=10; x++) { digitalWrite(L_Indicator, HIGH); digitalWrite(L_Indicator_LED, HIGH); delay (500); digitalWrite(L_Indicator, LOW); digitalWrite(L_Indicator_LED, LOW); delay (500); if (x ==4) { // Brakes ON digitalWrite(Brake, HIGH); digitalWrite(Brake_LED, HIGH); } } // Brakes OFF digitalWrite(Brake, LOW); digitalWrite(Brake_LED, LOW); delay(1000); // wait for a second // R_Indicator ON for (x = 0; x <=10; x++) { digitalWrite(R_Indicator, HIGH); digitalWrite(R_Indicator_LED, HIGH); delay (500); digitalWrite(R_Indicator, LOW); digitalWrite(R_Indicator_LED, LOW); delay (500); if (x ==4) { // Brakes ON digitalWrite(Brake, HIGH); digitalWrite(Brake_LED, HIGH); } } // Brakes OFF digitalWrite(Brake, LOW); digitalWrite(Brake_LED, LOW); }
As you can see it cycles around the various options, and I tested the modules before and after casting them.
VIDEO
The video shows the tester starting off.
The simulation powers the Indicator on one side, then the other side.
Brake is tested and both LED's should illuminate.
The next sequence is to have the Brake and Indicator for one side at the same time.
As the label says the unit on the left side is faulty and the LED should go out when the Indicator flashes on.
The right side operates correctly, and you can see that the front indicator and rear indicator would be out of sequence (but you can't normally see both ends of a vehicle)
The program continues and changes to having the Indicator on first before applying the brakes, taking the brake off during the flashing to simulate real life.
LED Tail Lamps
There are many LED replacement lamps available, and unfortunately many aren't very well designed.
It appears that Phillips solved that with these.
I've since found them here Philips Red Led Brake Lights S25 P21/5W 1157 BAY15D 12836 2 Dual Brightness
I hope this gives someone the inspiration needed to start programming with Arduino.
As the code shows it is full of delays and there is nothing complicated ... it's not complicated in what it has to do, so why make the software complicated.
As usual there are some comments so I can recall why or what I was trying to do.
Cheers
Mark
Top Comments