Arduino UNO-Based RC Boat Monitoring System with Bluetooth Control
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit designed for an RC Boat Monitoring System. The system includes various sensors, a motor driver, and a Bluetooth module, all controlled by an Arduino UNO. The circuit is powered by a 12V battery and includes components for measuring pH, turbidity, and temperature, as well as controlling motors and a rudder servo.
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
12V Battery
- Description: Power source for the circuit.
- Pins: -, +
HC-05 Bluetooth Module
- Description: Bluetooth module for wireless communication.
- Pins: Key, VCC, GND, TXD, RXD, State
pH Meter V1.1
- Description: Sensor for measuring pH levels.
- Pins: DATA, VCC, GND
Turbidity Sensor
- Description: Sensor for measuring water turbidity.
- Pins: gnd, in, vcc
Temperature Sensor (TEMP)
- Description: Sensor for measuring temperature.
- Pins: 5V, D3, GND
L293 Motor Driver
- Description: Motor driver for controlling DC motors.
- Pins: A1, A2, EN_A, VCC, GND, EN_B, B2, B1, MA 2, MA1, -V, +V, MB1, MB2
12V Geared Motor
- Description: DC motor for propulsion.
- Pins: Terminal 1, Terminal 2
MG90S Servo Motor
- Description: Servo motor for rudder control.
- Pins: SIG, VCC, GND
Wiring Details
Arduino UNO
- 3.3V: Connected to VCC of HC-05 Bluetooth Module
- 5V: Connected to VCC of L293 Motor Driver, Turbidity Sensor, Temperature Sensor, MG90S Servo Motor, pH Meter V1.1, and + of 12V Battery
- GND: Connected to GND of 12V Battery, HC-05 Bluetooth Module, pH Meter V1.1, Turbidity Sensor, Temperature Sensor, MG90S Servo Motor, L293 Motor Driver, and -V of L293 Motor Driver
- A0: Connected to DATA of pH Meter V1.1
- A1: Connected to in of Turbidity Sensor
- D10: Connected to SIG of MG90S Servo Motor
- D9: Connected to B2 of L293 Motor Driver
- D8: Connected to B1 of L293 Motor Driver
- D7: Connected to A2 of L293 Motor Driver
- D6: Connected to A1 of L293 Motor Driver
- D5: Connected to EN_B of L293 Motor Driver
- D3: Connected to EN_A of L293 Motor Driver
- D2: Connected to D3 of Temperature Sensor
- D1: Connected to RXD of HC-05 Bluetooth Module
- D0: Connected to TXD of HC-05 Bluetooth Module
12V Battery
- +: Connected to VCC of L293 Motor Driver, Turbidity Sensor, Temperature Sensor, MG90S Servo Motor, pH Meter V1.1, and 5V of Arduino UNO
- -: Connected to GND of Arduino UNO, HC-05 Bluetooth Module, pH Meter V1.1, Turbidity Sensor, Temperature Sensor, MG90S Servo Motor, L293 Motor Driver, and -V of L293 Motor Driver
HC-05 Bluetooth Module
- VCC: Connected to 3.3V of Arduino UNO
- GND: Connected to GND of Arduino UNO
- RXD: Connected to D1 of Arduino UNO
- TXD: Connected to D0 of Arduino UNO
pH Meter V1.1
- DATA: Connected to A0 of Arduino UNO
- VCC: Connected to 5V of Arduino UNO
- GND: Connected to GND of Arduino UNO
Turbidity Sensor
- in: Connected to A1 of Arduino UNO
- vcc: Connected to 5V of Arduino UNO
- gnd: Connected to GND of Arduino UNO
Temperature Sensor (TEMP)
- 5V: Connected to 5V of Arduino UNO
- D3: Connected to D2 of Arduino UNO
- GND: Connected to GND of Arduino UNO
L293 Motor Driver
- VCC: Connected to 5V of Arduino UNO
- GND: Connected to GND of Arduino UNO
- EN_A: Connected to D3 of Arduino UNO
- EN_B: Connected to D5 of Arduino UNO
- A1: Connected to D6 of Arduino UNO
- A2: Connected to D7 of Arduino UNO
- B1: Connected to D8 of Arduino UNO
- B2: Connected to D9 of Arduino UNO
- MA1: Connected to Terminal 1 of 12V Geared Motor
- MA2: Connected to Terminal 2 of 12V Geared Motor
- MB1: Connected to Terminal 1 of 12V Geared Motor
- MB2: Connected to Terminal 2 of 12V Geared Motor
- +V: Connected to + of 12V Battery
- -V: Connected to GND of Arduino UNO
12V Geared Motor
- Terminal 1: Connected to MA1 of L293 Motor Driver
- Terminal 2: Connected to MA2 of L293 Motor Driver
MG90S Servo Motor
- SIG: Connected to D10 of Arduino UNO
- VCC: Connected to 5V of Arduino UNO
- GND: Connected to GND of Arduino UNO
Documented Code
#include <Servo.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// Pin Definitions
#define PH_SENSOR_PIN A0
#define TURBIDITY_SENSOR_PIN A1
#define TEMP_SENSOR_PIN 2
#define MOTOR_LEFT_PWM 3
#define MOTOR_RIGHT_PWM 5
#define MOTOR_LEFT_DIR1 6
#define MOTOR_LEFT_DIR2 7
#define MOTOR_RIGHT_DIR1 8
#define MOTOR_RIGHT_DIR2 9
#define RUDDER_SERVO_PIN 10
// Servo
Servo rudder;
// Temperature Sensor
OneWire oneWire(TEMP_SENSOR_PIN);
DallasTemperature tempSensor(&oneWire);
// Bluetooth Commands
char command;
void setup() {
// Initialize Serial Communication
Serial.begin(9600);
// Initialize Sensors
tempSensor.begin();
// Setup Motors and Servo
pinMode(MOTOR_LEFT_PWM, OUTPUT);
pinMode(MOTOR_RIGHT_PWM, OUTPUT);
pinMode(MOTOR_LEFT_DIR1, OUTPUT);
pinMode(MOTOR_LEFT_DIR2, OUTPUT);
pinMode(MOTOR_RIGHT_DIR1, OUTPUT);
pinMode(MOTOR_RIGHT_DIR2, OUTPUT);
rudder.attach(RUDDER_SERVO_PIN);
rudder.write(90); // Center the rudder
// Confirm Setup
Serial.println("RC Boat Monitoring System Initialized");
}
void loop() {
// Read and Transmit Sensor Data
readAndSendSensorData();
// Bluetooth Command Handling
if (Serial.available()) {
command = Serial.read();
handleCommand(command);
}
}
// Function to Read and Send Sensor Data
void readAndSendSensorData() {
int pHValue = analogRead(PH_SENSOR_PIN);
int turbidityValue = analogRead(TURBIDITY_SENSOR_PIN);
tempSensor.requestTemperatures();
float temperature = tempSensor.getTempCByIndex(0);
// Transmit Data via Bluetooth
Serial.print("pH: ");
Serial.println(pHValue);
Serial.print("Turbidity: ");
Serial.println(turbidityValue);
Serial.print("Temperature: ");
Serial.println(temperature);
}
// Function to Handle Bluetooth Commands
void handleCommand(char cmd) {
switch (cmd) {
case 'F': // Move Forward
moveMotors(150, 150);
break;
case 'B': // Move Backward
moveMotors(-150, -150);
break;
case 'L': // Turn Left
rudder.write(60); // Adjust angle for left turn
moveMotors(100, 150);
break;
case 'R': //