Directional Arrow With LED From Arduino
by adamiled in Circuits > Arduino
1625 Views, 3 Favorites, 0 Comments
Directional Arrow With LED From Arduino
A lot of bicycle drivers do not show which direction they will turn. A way to make the environment safer for both car and bicycle driver is to give an indication system to the bicycle drivers. The project is a wooden crate with an arduino inside. The arduino program controls 2 servo motors, 6 LED lights, and 2 button switch. Even though there is one external switch who controls the power supply for the arduino. The LED and servo are attached to the 3D arrows that will give an indication. By installing the wooden crate on the back of the bicycle. You can control the arrow of indication, the 3 LED lights and one servo motor with an interrupter which will be installed on the handlebar of the bike. The right arrow, the right servo and the right LED are controlled by the button switch on the right side of the handlebar. It is the same thing for the left side. When you press one of the switch, the servo makes the 3D arrow of indication, of the same side, turn to a 90 degree angle and makes the LED lights blink.
Video of Project
Tools, Materials and Files
A list of the tools needed for the realization of your project and the material used.
2 3D printed arrow
6 LED of regular size (5mm diameter)
2 Servo Motor
1 Arduino
1 Wooden Crate from http://www.renodepot.com/eng
2 lock
2 resistor 10 000 ohm
6 resistor 220 ohm
5 meter long wires
1 switch with a flick
2 button switch
1 battery 9V
1 battery snap for a battery 9V
1 screwdriver
8 screws for the locks
1 gun of hot glue
This section is if you need to make adjustment on the wooden crate:
24 nails
1 hammer
THE LINK FOR THE ARROW : http://www.thingiverse.com/thing:1554520
The program for the arduino:
#include
Servo right; Servo left; const int rightArrowLead[] = {10,9,8}; const int leftArrowLead[] = {13,12,11}; const int rightPin = 5; const int leftPin = 4; const int rightButton = 6; const int leftButton = 7; void setup() { for(int x =0; x< 3; x++){ pinMode(rightArrowLead[x], OUTPUT); pinMode(leftArrowLead[x],OUTPUT); } right.attach(rightPin); left.attach(leftPin); // put your setup code here, to run once: right.write(0); left.write(0); } void loop() { // put your main code here, to run repeatedly: if(digitalRead(rightButton) == HIGH){ startArrow(true); }else if(digitalRead(leftButton) == HIGH){ startArrow(false); } } void startArrow(boolean direction){ int lead[3]; Servo servo; if(!direction){ servo = right; for(int x =0; x< 3; x++){ lead[x] = rightArrowLead[x]; } }if(direction){ servo = left; for(int x =0; x< 3; x++){ lead[x] = leftArrowLead[x]; } } servo.write(90); delay(300); twinkle(lead); servo.write(0); } void twinkle(int lead[]){ long lastMillis = millis(); long startTime = millis(); int count = 0; const int limit = 3; int current; while(millis()- startTime < 7000){ if(millis()-lastMillis > 600){ digitalWrite(lead[current],LOW); count ++; current = count % limit; digitalWrite(lead[current], HIGH); lastMillis = millis(); } } digitalWrite(lead[current], LOW); }
Here si a list of reference that gave us inspiration for the project:
A list of software used:
Arduino :https://www.arduino.cc/en/Main/Software
3D software: http://www.123dapp.com/design
How It's Done
STEP 1: the base
You can buy a wooden crate from Réno Depot http://www.renodepot.com/eng or make one.
Install the lockets on the wooden crate so that it can be opened and closed like a door.
Lastly for step 1, make a hole for the power switch on the side of the crate so that you can turn on your directional system without opening the crate.
STEP 2:
Print the 3D arrows.
Print 2 3D arrows, one for the right side and one for the left side
here the link for the arrows. http://www.thingiverse.com/thing:1554520
STEP 3:
Build the arduino:
1- For the external power supply you put the positive side int he V-in and the negative side in the Gnd but between the negative wire you install a switch with a flick.
2- In the digital signal of the arduino you take three output for the left arrow LED and you take another three output for the right arrow LED. One output for the right pin(for the servo) and one output for the left pin(for the servo). For the button switch ( left and right) there is one output for each and it is respective to their direction. For the six signals of the arduino, they all go to the 6 positive side of the LEDs and the each 6 negative side of the LEDs goes through one of the 6 resistor of 220 ohm. Then it all goes to the Gnd. Afterwards, the 5v goes trough the positive side of one the button switch, then on the other side of the switch the electric current goes directly to the signal and also a parallel goes through a resistor of 10 000ohm and it ends in the Gnd.To see the images for this section look at the two figure at the top of this apge.
Then:
Add the programme for the arduino :
#include
Servo right; Servo left; const int rightArrowLead[] = {10,9,8}; const int leftArrowLead[] = {13,12,11}; const int rightPin = 5; const int leftPin = 4; const int rightButton = 6; const int leftButton = 7;
void setup() { for(int x =0; x< 3; x++){ pinMode(rightArrowLead[x], OUTPUT); pinMode(leftArrowLead[x],OUTPUT); } right.attach(rightPin); left.attach(leftPin); // put your setup code here, to run once: right.write(0); left.write(0); }
void loop() { // put your main code here, to run repeatedly: if(digitalRead(rightButton) == HIGH){ startArrow(true); }else if(digitalRead(leftButton) == HIGH){ startArrow(false); } }
void startArrow(boolean direction){ int lead[3]; Servo servo; if(!direction){ servo = right; for(int x =0; x< 3; x++){ lead[x] = rightArrowLead[x]; } }if(direction){ servo = left; for(int x =0; x< 3; x++){ lead[x] = leftArrowLead[x]; } } servo.write(90); delay(300); twinkle(lead); servo.write(0); }
void twinkle(int lead[]){ long lastMillis = millis(); long startTime = millis(); int count = 0; const int limit = 3; int current; while(millis()- startTime < 7000){ if(millis()-lastMillis > 600){ digitalWrite(lead[current],LOW); count ++; current = count % limit; digitalWrite(lead[current], HIGH); lastMillis = millis(); } } digitalWrite(lead[current], LOW); }
video of explanation.
STEP 4:
put the arduino in the crate and stick each servo motor with one of the two arrows, and stick the other arrow to the other servo. Use hot glue for sticking them together.
put the crate on the back of the bicycle and take the switch for directions and put them on their respective side of the handbar.
Finally, put the external switch for the power supply in the hole you made for it so it can be accessible from the outside.
Conclusion
Last Step: Conclusion
The first problem we occured was to find a program for the LED lights and the servo. It was extremely hard to find a project that ressemble ours. That is why it was us that created this program. Also another problem we found was that the wooden crate we bought from Réno Depot did not have a big enough hole for the power switch of the arduino. We had to make the hole bigger. We could improve our system by making it impermeable. Also our crate could be lighter, because it is quite heavy.