Arduino UNO and HC-SR04 Ultrasonic Sensor-Based Distance Measurement System with Transistor Control
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino UNO microcontroller interfacing with an HC-SR04 Ultrasonic Sensor, a Resistor, an NPN Transistor, and Alligator Clip Cables. The circuit is designed to measure distance using the ultrasonic sensor and control an external device through the transistor.
Component List
HC-SR04 Ultrasonic Sensor
- Description: Ultrasonic distance sensor
- Pins: VCC, TRIG, ECHO, GND
- Purpose: Measures distance by emitting ultrasonic waves and receiving the echo
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
- Purpose: Controls the circuit and processes data from the ultrasonic sensor
Resistor
- Description: 200 Ohms resistor
- Pins: pin1, pin2
- Purpose: Limits current in the circuit
NPN Transistor
- Description: General-purpose NPN transistor
- Pins: E, C, B
- Purpose: Acts as a switch to control an external device
Diffuser
- Description: Diffuser component
- Pins: None
- Purpose: Not specified
Alligator Clip Cable (Red)
- Description: Alligator clip cable
- Pins: Pin, Alligator
- Purpose: Provides a flexible connection between components
Wiring Details
HC-SR04 Ultrasonic Sensor
- VCC: Connected to Arduino UNO 5V
- TRIG: Connected to Arduino UNO D9
- ECHO: Connected to Arduino UNO D10
- GND: Connected to Arduino UNO GND
Arduino UNO
- 5V: Connected to HC-SR04 Ultrasonic Sensor VCC and NPN Transistor B via Alligator Clip Cable
- D9: Connected to HC-SR04 Ultrasonic Sensor TRIG
- D10: Connected to HC-SR04 Ultrasonic Sensor ECHO
- GND: Connected to HC-SR04 Ultrasonic Sensor GND
- D8: Connected to Resistor pin1
Resistor
- pin1: Connected to Arduino UNO D8
- pin2: Connected to NPN Transistor C
NPN Transistor
- B: Connected to Arduino UNO 5V via Alligator Clip Cable
- C: Connected to Resistor pin2
- E: Connected to Alligator Clip Cable
Alligator Clip Cable (Red)
- Alligator: Connected to Arduino UNO 5V and NPN Transistor B
- Alligator: Connected to NPN Transistor E
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Documentation (documentation.txt)
This documentation provides a comprehensive overview of the circuit, including a summary, detailed component list, wiring details, and the code used in the microcontroller.