while i was searching for idea this week i was inspired by this photo
it was a challenge for me to try the LCD for the first time by my self
my idea is displaying the name of colors on LCD with RGB LED when i change the colors wireless by mobile phone
tinkercad
arduino bluecontrol
jumpers
breadboard
arduino
bluetooth module
LCD 16 *2 (12 C)
RGB LED
220 ohm resistor
circuit design
components needed :
breadboard
arduino
RGB LED
2 220 ohm resistor
LCD 16 *2 (12 C)
bluetooth module
jumpers
i use google search to learn about lcd wiring , and coding
i upload the code from library liquid crystal 12 c
coding
here is the coding with explaination for each step beside
// here i define the three colors of led, each color with certain pin
char incomingdata = '0';
#define LEDr 3
#define LEDg 5
#define LEDb 6
// i upload the code for lcd
#include <LCD-I2C.h>
#include <Wire.h>
LCD_I2C lcd(0x27, 16, 2); // Default address of most PCF8574 modules, change according
void setup() {
// put your setup code here, to run once:
Wire.begin();
lcd.begin(&Wire);
lcd.display();
lcd.backlight();
// i define the les colors as outputs and start the serial print with certain value
Serial.begin(9600);
pinMode(LEDr, OUTPUT);
pinMode(LEDg, OUTPUT);
pinMode(LEDb, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
// if i press 1 on the mobile app , the green color will switch on and the word color green will appear on the lcd
while (Serial.available()==0);
incomingdata = Serial.read();
Serial.println(incomingdata);
if (incomingdata =='1'){
lcd.print(" COLOR"); // You can make spaces using well... spaces
lcd.setCursor(5, 1); // Or setting the cursor in the desired position.
lcd.print("GERRN!");
delay(500);
// turn the red light on
digitalWrite (LEDr , HIGH);
digitalWrite (LEDg ,LOW);
digitalWrite (LEDb , LOW);
// if i press 0 on the mobile app , the led will switch off and the word bye bye will appear on the lcd
}else if (incomingdata =='0'){
digitalWrite (LEDr , LOW);
digitalWrite (LEDg , LOW);
digitalWrite (LEDb , LOW);
lcd.print(" BYE"); // You can make spaces using well... spaces
lcd.setCursor(5, 1); // Or setting the cursor in the desired position.
lcd.print("BYE");
delay(500);
}
// if i press 2 on the mobile app , the red color will switch on and the word color RED will appear on the lcd
else if (incomingdata =='2'){
digitalWrite (LEDr , LOW);
digitalWrite (LEDg , HIGH);
digitalWrite (LEDb , LOW);
lcd.print(" COLOR"); // You can make spaces using well... spaces
lcd.setCursor(5, 1); // Or setting the cursor in the desired position.
lcd.print("RED");
delay(500);
}
// if i press 3 on the mobile app , the blue color will switch on and the word color blue will appear on the lcd
else if (incomingdata =='3'){
digitalWrite (LEDr , LOW);
digitalWrite (LEDg ,LOW );
digitalWrite (LEDb , HIGH);
lcd.print(" COLOR"); // You can make spaces using well... spaces
lcd.setCursor(5, 1); // Or setting the cursor in the desired position.
lcd.print("BLUE!");
delay(500);
}
// if i press 4 on the mobile app , the white color will switch on and the word color white will appear on the lcd
else if (incomingdata =='4'){
digitalWrite (LEDr , HIGH);
digitalWrite (LEDg ,HIGH );
digitalWrite (LEDb , HIGH);
lcd.print(" COLOR"); // You can make spaces using well... spaces
lcd.setCursor(5, 1); // Or setting the cursor in the desired position.
lcd.print("WHITE!");
delay(500);
}
if i press any other button this message (invalid data) will apear on the lcd
else {
Serial.println(" invalid data");
}
}
i couldn't take alot of photoes for each step of wiring but i can explain it in dots
1- connect the arduino to the breadboard
possitive by red wire to the 5v
negative by black wire to the GND
2-connect the RGB LED and resistorS
RED leg with resestor by purple wire to the pin no.3
green leg with resestor by green wire to the pin no.5
blue leg with resestor by blue wire to the pin no.6
negative by black wire to the GND
3- connect bluetooth modul
possitive leg to breadboard possitive row
negative leg to breadboard negative row
RX of bluetooth to TX of arduino
TX of bluetooth to RX of arduino
4- connecting lcd
vcc to the 5v
gnd to the ground
sda to arduino a4
scl to arduino a5
open the app and turn on your mobile bluetooth
i choose the 3rd one which is the name of my bluetooth module
connecting
upload the code and try the circuit ....
Title of Media
i didn't know how to use lcd , it was challenge for me
i use google search to learn about lcd wiring , and coding
i upload the code from library liquid crystal i2 c
after trial & errors i was able to interact with lcd
Title of Media
this week i think i can make 80% of my project coding
Title of Media