Circuit Documentation
Summary of the Circuit
This circuit is designed to interface an Arduino UNO with an HC-SR04 Ultrasonic Sensor and control a relay which in turn controls a bulb. The Arduino UNO is used as the central processing unit, reading sensor data from the HC-SR04 and controlling the relay based on the sensor inputs. The relay acts as an electrically operated switch that allows the Arduino to control the bulb, which is powered by a separate 9V battery. The HC-SR04 Ultrasonic Sensor is used to measure distance by emitting ultrasonic waves and measuring the time it takes for the echo to return.
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.
HC-SR04 Ultrasonic Sensor
- A sensor that measures distance by emitting ultrasonic waves and measuring the time it takes for the echo to return.
- It has 4 pins: VCC, TRIG, ECHO, and GND.
BULB
- A simple electric light bulb that illuminates when powered.
- It has 2 pins: + (positive) and - (negative).
5V Relay
- An electromechanical switch that allows the Arduino to control higher power devices like the bulb.
- It has 6 pins: Normally Open, Common terminal, Normally Closed, In, GND, and VCC.
9V Battery
- A standard 9V battery used to provide power to the bulb through the relay.
- It has 2 pins: + (positive) and - (negative).
Wiring Details
Arduino UNO
- 5V: Connected to VCC of HC-SR04 Ultrasonic Sensor and VCC of 5V relay.
- GND: Connected to GND of HC-SR04 Ultrasonic Sensor and GND of 5V relay.
- D10: Connected to ECHO of HC-SR04 Ultrasonic Sensor.
- D9: Connected to TRIG of HC-SR04 Ultrasonic Sensor.
- D8: Connected to In of 5V relay.
HC-SR04 Ultrasonic Sensor
- VCC: Connected to 5V of Arduino UNO.
- TRIG: Connected to D9 of Arduino UNO.
- ECHO: Connected to D10 of Arduino UNO.
- GND: Connected to GND of Arduino UNO.
BULB
- +: Connected to Normally Open of 5V relay.
- -: Connected to - of 9V battery.
5V Relay
- VCC: Connected to 5V of Arduino UNO.
- GND: Connected to GND of Arduino UNO.
- In: Connected to D8 of Arduino UNO.
- Normally Open: Connected to + of BULB.
- Common terminal: Connected to + of 9V battery.
9V Battery
- +: Connected to Common terminal of 5V relay.
- -: Connected to - of BULB.
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
}
void loop() {
}
Note: The code provided for the Arduino UNO is a template and does not contain any functional code to operate the HC-SR04 sensor or the relay. To complete the circuit functionality, the code needs to be written to initialize the sensor, read distance measurements, and control the relay based on the sensor data.