Electronics Projects
LCD connections
LCD pin Connection
VSS (1) GND
VDD (2) 5V
VO (3) Middle pin of 10kΞ© potentiometer
RS (4) Arduino 12
RW (5) GND
E (6) Arduino 11
D0βD3 (7β10) Not connected
D4 (11) Arduino 5
D5 (12) Arduino 4
D6 (13) Arduino 3
D7 (14) Arduino 6
LED+ (15) 5V, with suitable resistor if required
LEDβ (16) GND


π» Arduino code for LCD
#include <LiquidCrystal.h>
// LCD: RS, E, D4, D5, D6, D7
LiquidCrystal lcd(12, 11, 5, 4, 3, 6);
const int switchPin = 2;
const int greenLED = 8;
const int redLED = 9;
const int buzzer = 10;
void setup() {
pinMode(switchPin, INPUT);
pinMode(greenLED, OUTPUT);
pinMode(redLED, OUTPUT);
pinMode(buzzer, OUTPUT);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("SECURITY SYSTEM");
lcd.setCursor(0, 1);
lcd.print("Starting...");
delay(2000);
lcd.clear();
}
void loop() {
int switchState = digitalRead(switchPin);
if (switchState == HIGH) {
digitalWrite(greenLED, HIGH);
digitalWrite(redLED, LOW);
lcd.setCursor(0, 0);
lcd.print("SYSTEM: ON ");
lcd.setCursor(0, 1);
lcd.print("ALARM: ACTIVE ");
tone(buzzer, 1000);
delay(300);
noTone(buzzer);
delay(700);
} else {
digitalWrite(greenLED, LOW);
digitalWrite(redLED, HIGH);
noTone(buzzer);
lcd.setCursor(0, 0);
lcd.print("SYSTEM: OFF ");
lcd.setCursor(0, 1);
lcd.print("ALARM: DISABLED ");
}
}
π§° Components
Arduino Uno Γ1
Breadboard Γ1
Slide switch Γ1
Green LED Γ1
Red LED Γ1
220Ξ© resistors Γ2
Piezo buzzer Γ1
Jumper wires
π» Arduino code
int switchPin = 2;
int greenLED = 8;
int redLED = 9;
int buzzer = 10;
void setup() {
pinMode(switchPin, INPUT);
pinMode(greenLED, OUTPUT);
pinMode(redLED, OUTPUT);
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
}
void loop() {
int switchState = digitalRead(switchPin);
if (switchState == HIGH) {
// Security system ON
digitalWrite(greenLED, HIGH);
digitalWrite(redLED, LOW);
// Buzzer beeps
tone(buzzer, 1000);
delay(300);
noTone(buzzer);
delay(700);
} else {
// Security system OFF
digitalWrite(greenLED, LOW);
digitalWrite(redLED, HIGH);
noTone(buzzer);
}
}
π¨ Tinkercad Project: Mini Security Control System
π― Project idea
The slide switch acts as an ON/OFF security switch.
π΄ Switch OFF β Red LED OFF, buzzer OFF
π’ Switch ON β Green LED ON and buzzer sounds
Learners can later modify it so the buzzer only sounds when an alarm condition occurs.
π Exact connections
Slide switch
One outer pin β 5V
Middle pin β Arduino Pin 2
Other outer pin β GND
Green LED
Long leg β 220Ξ© resistor β Pin 8
Short leg β GND
Red LED
Long leg β 220Ξ© resistor β Pin 9
Short leg β GND
Buzzer
Positive (+) β Pin 10
Negative (β) β GND


π¦ Project: Automatic Traffic Light
Building a traffic light system simulator
Connections
Resistor
π΄ Red
pin 13
220Ξ©
π‘ Yellow
pin 12
220Ξ©
π’ Green
pin 11
220Ξ©
π§° Components
Arduino Uno
3 LEDs: Red, Yellow, Green
3 Γ 220Ξ© resistors
Breadboard
Jumper wires


int red = 13;
int yellow = 12;
int green = 11;
void setup() {
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);
}
void loop() {
// Green light
digitalWrite(green, HIGH);
digitalWrite(yellow, LOW);
digitalWrite(red, LOW);
delay(5000);
// Yellow light
digitalWrite(green, LOW);
digitalWrite(yellow, HIGH);
delay(2000);
// Red light
digitalWrite(yellow, LOW);
digitalWrite(red, HIGH);
delay(5000);
}
How it works
π’ Green turns on for 5 seconds.
π‘ Yellow turns on for 2 seconds.
π΄ Red turns on for 5 seconds.
The cycle repeats automatically.
