The following projects demonstrate advanced applications of the Arduino Uno, incorporating multiple components and more complex coding structures. These examples aim to inspire and provide a deeper understanding of what can be achieved with the Arduino platform in areas like IoT, automation, and robotics.
Home Automation System with Bluetooth Control
This project demonstrates the use of Bluetooth to control home appliances remotely. Using an HC-05 Bluetooth module, the Arduino can receive commands from a smartphone app to turn devices on or off.
Project Overview
- Objective: To control home appliances wirelessly using Bluetooth commands.
- Components:
- HC-05 Bluetooth module
- Relay module (for high-power appliance control)
- Jumper wires
- Arduino Uno
Step-by-Step Guide
- Connect the HC-05 Bluetooth Module:
- Connect the VCC and GND pins of the HC-05 module to 5V and GND on the Arduino.
- Connect the TX of the HC-05 to the RX pin (pin 0) of the Arduino and the RX of HC-05 to the TX (pin 1) of the Arduino.
- Connect the Relay Module:
- Connect the IN pin of the relay module to a digital pin on the Arduino (e.g., pin 7).
- Connect VCC and GND to 5V and GND on the Arduino.
- Write the Code:
- This code listens for commands via Bluetooth to turn the relay on and off, controlling the connected appliance.
char command;
void setup() {
Serial.begin(9600); // Initialize serial communication with HC-05
pinMode(7, OUTPUT); // Set pin 7 as an output for relay control
}
void loop() {
if (Serial.available() > 0) {
command = Serial.read(); // Read the incoming command
if (command == '1') {
digitalWrite(7, HIGH); // Turn the relay (appliance) on
} else if (command == '0') {
digitalWrite(7, LOW); // Turn the relay (appliance) off
}
}
}
This project shows how the Arduino Uno can be integrated into a basic home automation system. By using Bluetooth for wireless control, it allows users to operate devices through a smartphone, making it a stepping stone for more advanced IoT applications.
Line-Following Robot
A line-following robot is a popular robotics project that uses infrared sensors to detect and follow a line on the ground. This project demonstrates basic robotics principles and highlights the potential of the Arduino Uno in automation.
Project Overview
- Objective: To build a robot that can detect and follow a line using infrared (IR) sensors.
- Components:
- 2 IR sensors
- Motor driver module (L298N)
- 2 DC motors with wheels
- Chassis
- Arduino Uno
Step-by-Step Guide
- Assemble the Robot Chassis:
- Attach the wheels to the DC motors and mount them on the chassis.
- Connect the Motor Driver Module:
- Connect the motor driver’s input pins to digital pins 3, 4, 5, and 6 on the Arduino.
- Connect the motor driver’s power pins to an external battery.
- Connect the IR Sensors:
- Connect one IR sensor to pin A0 and the other to pin A1.
- Position the sensors so they can detect the line on the ground.
- Write the Code:
- The code below reads the sensors and controls the motors to follow the line.
int leftSensor = A0;
int rightSensor = A1;
int leftMotor1 = 3;
int leftMotor2 = 4;
int rightMotor1 = 5;
int rightMotor2 = 6;
void setup() {
pinMode(leftSensor, INPUT);
pinMode(rightSensor, INPUT);
pinMode(leftMotor1, OUTPUT);
pinMode(leftMotor2, OUTPUT);
pinMode(rightMotor1, OUTPUT);
pinMode(rightMotor2, OUTPUT);
}
void loop() {
int leftValue = analogRead(leftSensor);
int rightValue = analogRead(rightSensor);
if (leftValue < 500 && rightValue < 500) { // Both sensors on line
forward();
} else if (leftValue < 500) { // Left sensor on line
turnRight();
} else if (rightValue < 500) { // Right sensor on line
turnLeft();
} else { // Both sensors off line
stop();
}
}
void forward() {
digitalWrite(leftMotor1, HIGH);
digitalWrite(leftMotor2, LOW);
digitalWrite(rightMotor1, HIGH);
digitalWrite(rightMotor2, LOW);
}
void turnRight() {
digitalWrite(leftMotor1, HIGH);
digitalWrite(leftMotor2, LOW);
digitalWrite(rightMotor1, LOW);
digitalWrite(rightMotor2, LOW);
}
void turnLeft() {
digitalWrite(leftMotor1, LOW);
digitalWrite(leftMotor2, LOW);
digitalWrite(rightMotor1, HIGH);
digitalWrite(rightMotor2, LOW);
}
void stop() {
digitalWrite(leftMotor1, LOW);
digitalWrite(leftMotor2, LOW);
digitalWrite(rightMotor1, LOW);
digitalWrite(rightMotor2, LOW);
}
This project introduces students to using sensors for decision-making and controlling motors based on sensor input. A line-following robot is a classic project in robotics, illustrating automation and sensor-based control systems.