Arduino UNO Controlled Bluetooth Robot with Obstacle Avoidance and LED Indicators
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question appears to be designed for a mobile robotic platform with various functionalities including motion control, distance sensing, light indication, and Bluetooth communication. The core of the circuit is an Arduino UNO microcontroller, which interfaces with a motor driver (L293D) to control two gearmotors, an ultrasonic sensor (HC-SR04) for distance measurement, LEDs for indication, a Bluetooth module (HC-06) for wireless control, and a voltage regulator (LM340T5 7805) to stabilize the power supply. The circuit is powered by a 9V battery and includes a rocker switch for power control.
Component List
- Arduino UNO: A microcontroller board based on the ATmega328P, featuring digital and analog I/O pins.
- LED (Green): A two-pin light-emitting diode that emits green light.
- LED (Red): A two-pin light-emitting diode that emits red light.
- Rocker Switch: A simple on/off switch to control the power supply to the circuit.
- 9V Battery: A standard 9-volt battery to provide power to the circuit.
- Gearmotor DC (Left and Right): DC motors with gear reduction, used for driving the wheels of the robotic platform.
- HC-SR04 Ultrasonic Sensor: An ultrasonic distance sensor that can measure distances by emitting ultrasonic waves.
- L293D: A motor driver IC capable of driving two DC motors or one stepper motor.
- Resistor (220 Ohms): A component used to limit current, typically in LED circuits.
- Bluetooth HC-06: A Bluetooth module for wireless communication with the Arduino.
- LM340T5 7805: A voltage regulator that outputs a stable 5V from a higher voltage input.
Wiring Details
Arduino UNO
- Digital pins D2, D3, D4, D5, D6, D7, D9, D10, D11, D12 are used for controlling LEDs, motors, and the ultrasonic sensor.
- Pins 5V and GND are used to distribute power and ground to other components.
- Pins D0 (RX) and D1 (TX) are connected to the Bluetooth module for serial communication.
LEDs (Green and Red)
- Each LED has an anode connected to a 220 Ohm resistor and a cathode connected to the ground.
Rocker Switch
- One pin is connected to the negative terminal of the 9V battery, and the other pin is connected to the ground rail of the circuit.
Gearmotors (Left and Right)
- Each motor has two pins connected to the output pins of the L293D motor driver.
HC-SR04 Ultrasonic Sensor
- VCC and GND pins are connected to the power supply and ground.
- TRIG and ECHO pins are connected to digital pins D5 and D7 of the Arduino UNO, respectively.
L293D Motor Driver
- Enable and VCC1 pins are connected to the 5V power supply.
- Input pins are connected to various digital pins on the Arduino UNO for motor control.
- Output pins are connected to the gearmotors.
Resistors (220 Ohms)
- Each resistor is connected in series with an LED to limit the current.
Bluetooth HC-06
- VCC and GND pins are connected to the power supply and ground.
- TXD and RXD pins are connected to the RX and TX pins of the Arduino UNO, respectively.
LM340T5 7805 Voltage Regulator
- Vin is connected to the positive terminal of the 9V battery.
- Vout is connected to the 5V power rail of the circuit.
- GND is connected to the ground rail of the circuit.
Documented Code
Arduino UNO Code (sketch.ino)
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define TRIGPIN 5
#define ECHOPIN 7
// Initialization
int m1a = 9; // Motor 1, Arduino pin 10 to L293B pin 15.
int m1b = 10; // Motor 1, Arduino pin 9 to L293B pin 10.
int m2a = 11; // Motor 2, Arduino pin 12 to L293B pin 2.
int m2b = 12; // Motor 2, Arduino pin 11 to L293B pin 7.
char val;
bool ready = false;
int VerdDreta = 3;
int VerdEsquerra = 4;
int VermellDreta = 6;
int VermellEsquerra = 2;
LiquidCrystal_I2C lcd(0X27,16,2);
// Custom characters for LCD eyes
byte ulls1_1[8] = {
// ... (custom character data)
};
// ... (additional custom characters)
// Setup function
void setup() {
// ... (setup code)
}
// Main loop
void loop() {
// ... (main loop code)
}
// Motor and LED control functions
void MotorsEndavant(){
// ... (forward motion code)
}
void MotorsEndarrera(){
// ... (backward motion code)
}
void MotorsEsquerra(){
// ... (turn left code)
}
void MotorsDreta(){
// ... (turn right code)
}
void aturarMotors(){
// ... (stop motors code)
}
void stopienrere() {
// ... (reverse stop code)
}
int mesurar_mm() {
// ... (measure distance code)
}
void ulls1() {
// ... (LCD eyes pattern 1)
}
// ... (additional LCD eyes patterns)
Additional Documentation (documentation.txt)
Material List
Base:
+ Arduino UNO
+ Breadboard
+ 9V Battery
+ Switch
+ Cables
Mobility:
+ 2 DC Motors with wheels
+ L293D Motor Driver
+ LM340T5 Voltage Regulator
Distance Sensor:
+ HC-SR04 Ultrasonic Sensor
Control:
+ HC-05 Bluetooth Controller
Display:
+ LCD-I2C Screen
Lights:
+ 4 Resistors
+ 2 Green LEDs
+ 2 Red LEDs
Chassis:
+ Lower Chassis
+ Central Chassis
+ Front Upper Chassis
+ Rear Upper Chassis
+ Front Wheel
+ Screws
This documentation provides an overview of the circuit, including the components used, their wiring, and the embedded code for the Arduino UNO. The code includes functionality for motor control, LED control, distance measurement, and LCD display management. The additional documentation file lists the materials used in the project.