Circuit Documentation
Summary
The circuit consists of an Arduino UNO microcontroller interfaced with several peripheral devices: an HC-06 Bluetooth module, a two-pin red LED, a water level sensor, and an ultrasonic sensor. The Arduino UNO controls the LED based on serial input and reads data from the water level sensor and the ultrasonic sensor. The HC-06 Bluetooth module allows for wireless communication, potentially with a smartphone or computer.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
LED: Two Pin (red)
- A simple red light-emitting diode
- It has an anode and a cathode for basic on/off control.
HC-06
- A Bluetooth module that allows for serial communication over Bluetooth
- It has pins for RXD, TXD, GND, and VCC.
Water Level Sensor
- A sensor that detects the level of water through its SIG pin
- It is powered by VCC and grounded through GND.
Ultrasonic Sensor
- A sensor that measures distance using ultrasonic waves
- It has pins for VCC, Trigger, Echo, and GND.
Wiring Details
Arduino UNO
- 5V: Powers the HC-06, Ultrasonic Sensor, and Water Level Sensor
- GND: Common ground for LED, HC-06, Ultrasonic Sensor, and Water Level Sensor
- D13: Connected to the anode of the LED
- A0: Reads the signal from the Water Level Sensor
- D9: Sends trigger signal to the Ultrasonic Sensor
- D8: Receives echo signal from the Ultrasonic Sensor
- D1 (TX): Transmits data to the HC-06 RXD pin
- D0 (RX): Receives data from the HC-06 TXD pin
LED: Two Pin (red)
- Cathode: Connected to the GND of Arduino UNO
- Anode: Connected to D13 of Arduino UNO
HC-06
- VCC: Powered by the 5V output from Arduino UNO
- GND: Connected to the common ground on Arduino UNO
- RXD: Receives data from D1 (TX) of Arduino UNO
- TXD: Transmits data to D0 (RX) of Arduino UNO
Water Level Sensor
- SIG: Signal pin connected to A0 on Arduino UNO
- VCC: Powered by the 5V output from Arduino UNO
- GND: Connected to the common ground on Arduino UNO
Ultrasonic Sensor
- +VCC: Powered by the 5V output from Arduino UNO
- Trigger: Connected to D9 on Arduino UNO
- Echo: Connected to D8 on Arduino UNO
- GND: Connected to the common ground on Arduino UNO
Documented Code
char Incoming_value = 'B';
int pin13 = 13;
int LEVEL = 0;
void setup() {
Serial.begin(9600);
pinMode(pin13, OUTPUT);
pinMode(A0, INPUT);
LEVEL = analogRead(A0);
}
void loop() {
LEVEL = analogRead(A0);
if (Serial.available() > 0) {
Incoming_value = Serial.read();
Serial.print(Incoming_value);
Serial.print("\n");
if (Incoming_value == 'A')
digitalWrite(pin13, HIGH);
else if (Incoming_value == 'B')
digitalWrite(pin13, LOW);
}
Serial.println(LEVEL);
delay(500);
}
Code Description
- The code initializes the serial communication at 9600 baud rate and sets up the LED pin (D13) as an output and the water level sensor pin (A0) as an input.
- In the loop, the Arduino reads the water level sensor value and checks for incoming serial data.
- If the incoming data is 'A', the LED is turned on. If it is 'B', the LED is turned off.
- The water level sensor value is printed to the serial monitor every 500 milliseconds.