Circuit Documentation
Summary of the Circuit
This circuit consists of an Arduino UNO microcontroller board interfaced with an HC-SR04 Ultrasonic Sensor. The purpose of this circuit is to utilize the ultrasonic sensor to measure distances by emitting ultrasonic waves and calculating the time it takes for the echoes to return. The Arduino UNO is responsible for controlling the sensor and processing the data.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13
- Purpose: Acts as the central processing unit of the circuit, controlling the HC-SR04 Ultrasonic Sensor and executing the embedded code.
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic distance sensor capable of measuring distances from 2cm to 400cm.
- Pins: VCC, TRIG, ECHO, GND
- Purpose: To emit ultrasonic waves and detect the echo to measure distance.
Wiring Details
Arduino UNO
- 5V: Provides power to the HC-SR04 Ultrasonic Sensor.
- GND: Common ground with the HC-SR04 Ultrasonic Sensor.
- D12: Connected to the TRIG pin of the HC-SR04 Ultrasonic Sensor to trigger the ultrasonic pulse.
- D13: Connected to the ECHO pin of the HC-SR04 Ultrasonic Sensor to receive the echo signal.
HC-SR04 Ultrasonic Sensor
- VCC: Connected to the 5V output from the Arduino UNO to power the sensor.
- TRIG: Connected to pin D12 on the Arduino UNO to receive trigger signals.
- ECHO: Connected to pin D13 on the Arduino UNO to send back the echo signal.
- GND: Connected to the GND pin on the Arduino UNO to complete the circuit.
Documented Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
File: sketch.ino
The provided code is a template for the Arduino UNO microcontroller. The setup() function is intended to contain initialization code that runs once when the microcontroller is powered on or reset. The loop() function is designed to contain the main logic of the program, which will run repeatedly in an infinite loop.
Currently, the code does not contain any specific instructions for controlling the HC-SR04 Ultrasonic Sensor. To make this circuit functional, code for initializing the sensor, triggering ultrasonic pulses, and calculating the distance based on the echo's return time would need to be added to the setup() and loop() functions.
