I had a course in robotics a year ago and my first task was making a traffic light signal, so I wanted to make it advanced with RGB led, I searched for similar projects: traffic light signal with RGB LED
To fulfill this week requirement I added LCD to show traffic sign words in addition to the RGB led and controlled them from Android app using Bluetooth module.
software:
I used Arduino to burn the code to arduino uno to start the trial physically
I used tinker cad to test and simulate the circuit before prototyping it physically to protect the electronics from burning or any problem
electronics:
Arduino UNO + USB cable
Bluetooth Module HC-05
LCD I2C
RGB LED common cathode
Small breadboard
Male to male jumper wires
Male to female jumper wires
Using Arduino UNO I connected:
1- Bluetooth Module HC-05 ( INPUT ):
VCC to +
GND to -
TX to RX in arduino
RX to TX in arduino
2- LCD I2C ( OUTPUT ):
VCC to +
GND to -
SDA to A4
SCL to A5
3- RGB LED ( OUTPUT ):
long leg ( common cathode ) to -
left leg "RED" to pin 9
mid leg "GREEN" to pin 10
right leg "BLUE" to pin 11
Using this Graphical user interface I controlled the traffic signal using buttons as first button sends r as sign of red to stop, second button sends y as sign of yellow to wait, and last button sends g as sign of green to GoOoOo.
To use this app u have to finish the wiring physically and open bluetooth on the phone and connect to HC-05 then enter the password : 1234 or 0000
After that connect again in the application to HC-05 to start using the app
I followed the wiring diagram I made on fritzing to do my wiring physically on the actual breadboard and Arduino UNO.
defining input in global scope
including LCD libraries and defining it.
Starting serial monitor.
setting rgb led pins as output.
starting LCD.
if there is something sent via bluetooth print and store it in input
if input is r
turn the RGB to red and print " STOP " on LCD
if input is y
turn the RGB to yellow and print "WAIT" on LCD
if input is g
turn the RGB to green and print "EGRYYYY" on lcd
I should've added lcd.clear();
to clear the LCD
I had a problem with LCD that it sometimes showed only the first letter of each line, after many trials and asking my instructor Sherif we reached to inclusion that we overcome this problem by uploading the code to arduino over and over again till the LCD shows all the letters.
Another problem was uploading the code to the arduino though tx and rx wasn't wired. I removed every wire to the arduino and closed any other arduino ide window opened then tried again and it was uploaded successfully.
I sometimes need to restart my Laptop then try again.
I want to make my final project communicate wirelessly using processing