Arduino UNO Bluetooth-Controlled Smart Car with Soil Moisture Monitoring and Water Pump
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control a car with additional features such as a water pump, soil moisture sensor, and a servo motor. The control is achieved using an Arduino UNO microcontroller, which interfaces with various components including an HC-05 Bluetooth module, a motor driver (L298N), a micro servo, a 5V mini water pump, a soil moisture sensor, and a 12V single channel relay. The circuit allows for remote control via Bluetooth and includes functionalities for moving the car, controlling the servo motor, activating the water pump, and reading soil moisture levels.
Component List
Arduino UNO
- Description: Microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
HC-05
- Description: Bluetooth module for wireless communication.
- Pins: STATE, RXD, TXD, GND, VCC, EN
Micro servo 9G
- Description: Small servo motor for precise control.
- Pins: GND, +5V, PWM
5V mini water pump
- Description: Small water pump for liquid transfer.
- Pins: positive pin, negative pin
Soil Moisture Sensor
- Description: Sensor to measure soil moisture levels.
- Pins: VCC, GND, SIG
Motor Driver (L298N)
- Description: Dual H-Bridge motor driver for controlling motors.
- Pins: OUT 1, OUT 2, OUT 3, OUT 4, +12V INPUT, GND, +5V OUTPUT, ENA, IN 1, IN 2, IN 3, IN 4, ENB
12V SINGLE CHANNEL RELAY
- Description: Relay module for switching high power devices.
- Pins: NC, COM, NO, IN, GND, VCC
Soil Moisture Module
- Description: Module to interface with the soil moisture sensor.
- Pins: positive, negative, Analog, Digital, Ground, VCC
2x 18650
- Description: Battery pack for power supply.
- Pins: vcc, gnd
DC Motor
- Description: Motor for driving the car.
- Pins: pin 1, pin 2
Wiring Details
Arduino UNO
- 5V connected to +5V OUTPUT of Motor Driver (L298N)
- GND connected to GND of Motor Driver (L298N), 2x 18650, Soil Moisture Module, 12V SINGLE CHANNEL RELAY, Micro servo 9G, and HC-05
- A0 connected to Digital of Soil Moisture Module
- D10 connected to PWM of Micro servo 9G
- D9 connected to RXD of HC-05
- D8 connected to TXD of HC-05
- D7 connected to EN of HC-05
- D6 connected to IN 3 of Motor Driver (L298N)
- D5 connected to IN 2 of Motor Driver (L298N)
- D4 connected to IN 1 of Motor Driver (L298N)
- D3 connected to IN of 12V SINGLE CHANNEL RELAY
- D2 connected to IN 4 of Motor Driver (L298N)
HC-05
- GND connected to GND of Arduino UNO
- VCC connected to 5V of Arduino UNO
- RXD connected to D9 of Arduino UNO
- TXD connected to D8 of Arduino UNO
- EN connected to D7 of Arduino UNO
Micro servo 9G
- GND connected to GND of Arduino UNO
- +5V connected to 5V of Arduino UNO
- PWM connected to D10 of Arduino UNO
5V mini water pump
- positive pin connected to NO of 12V SINGLE CHANNEL RELAY
- negative pin connected to COM of 12V SINGLE CHANNEL RELAY
Soil Moisture Sensor
- VCC connected to positive of Soil Moisture Module
- GND connected to negative of Soil Moisture Module
Motor Driver (L298N)
- GND connected to GND of Arduino UNO
- +5V OUTPUT connected to 5V of Arduino UNO
- IN 1 connected to D4 of Arduino UNO
- IN 2 connected to D5 of Arduino UNO
- IN 3 connected to D6 of Arduino UNO
- IN 4 connected to D2 of Arduino UNO
- OUT 1 connected to pin 1 of DC Motor
- OUT 2 connected to pin 2 of DC Motor
- OUT 3 connected to pin 1 of DC Motor
- OUT 4 connected to pin 2 of DC Motor
- +12V INPUT connected to NO of 12V SINGLE CHANNEL RELAY
12V SINGLE CHANNEL RELAY
- GND connected to GND of Arduino UNO
- VCC connected to 5V of Arduino UNO
- IN connected to D3 of Arduino UNO
- NO connected to positive pin of 5V mini water pump
- COM connected to negative pin of 5V mini water pump
Soil Moisture Module
- Ground connected to GND of Arduino UNO
- VCC connected to 5V of Arduino UNO
- Digital connected to A0 of Arduino UNO
- positive connected to VCC of Soil Moisture Sensor
- negative connected to GND of Soil Moisture Sensor
2x 18650
- vcc connected to +12V INPUT of Motor Driver (L298N)
- gnd connected to GND of Motor Driver (L298N)
DC Motor
- pin 1 connected to OUT 1 of Motor Driver (L298N)
- pin 2 connected to OUT 2 of Motor Driver (L298N)
- pin 1 connected to OUT 3 of Motor Driver (L298N)
- pin 2 connected to OUT 4 of Motor Driver (L298N)
Code Documentation
#define pinK 7
#define pinRX 8
#define pinTX 9
#include <SoftwareSerial.h>
#include <iarduino_Bluetooth_HC05.h>
#include <Servo.h>
SoftwareSerial softSerial(pinRX, pinTX);
iarduino_Bluetooth_HC05 hc05(pinK);
Servo myServo;
const int waterPumpPin = 3;
const int soilMoisturePin = A0;
// Define motor control pins for the car
const int motor1Pin1 = 4; // IN1 on L298N
const int motor1Pin2 = 5; // IN2 on L298N
const int motor2Pin1 = 6; // IN3 on L298N
const int motor2Pin2 = 2; // IN4 on L298N
void setup() {
Serial.begin(9600);
softSerial.begin(9600);
Serial.println("Bluetooth Module Ready");
// Initialize motor control pins for the car
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(motor2Pin1, OUTPUT);
pinMode(motor2Pin2, OUTPUT);
// Initialize water pump pin and set it to OFF
pinMode(waterPumpPin, OUTPUT);
digitalWrite(waterPumpPin, LOW); // Water pump OFF
// Initialize the servo motor and set it to 0 degrees
myServo.attach(10);
myServo.write(0); // Servo at 0 degrees
Serial.println("Car Control and Additional Features Ready. Send 'F', 'B', 'L', 'R', 'S', 'M', 'W', 'D', 'O', or 'Q'.");
}
void loop() {
if (softSerial.available()) {
String command = softSerial.readString();
Serial.println(command);
// Execute commands for car control, servo motor, water