Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO Controlled Servo with HC-SR04 Ultrasonic Distance Sensing

Image of Arduino UNO Controlled Servo with HC-SR04 Ultrasonic Distance Sensing

Circuit Documentation

Summary

This circuit integrates an Arduino UNO microcontroller with an HC-SR04 Ultrasonic Distance Sensor and a Tower Pro SG90 servo motor. The Arduino UNO serves as the central processing unit, controlling the servo motor's position and reading distance measurements from the ultrasonic sensor. The servo motor is powered directly from the Arduino's 5V output, and the ultrasonic sensor is powered from the Arduino's Vin pin. Communication between the Arduino and the ultrasonic sensor is achieved through digital pins D8 and D9 for trigger and echo signals, respectively. The servo motor receives its control signal from digital pin D10.

Component List

Arduino UNO

  • Description: A microcontroller board based on the ATmega328P.
  • Purpose: Acts as the central controller for the circuit, interfacing with the ultrasonic sensor and controlling the servo motor.

HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)

  • Description: A sensor that measures distance by emitting ultrasonic waves and measuring the time taken for the echo to return.
  • Purpose: Provides distance measurements to the Arduino for processing.

Tower Pro SG90 servo

  • Description: A small and lightweight servo motor capable of precise angular positioning.
  • Purpose: Actuates based on commands from the Arduino to position or move objects as required.

Wiring Details

Arduino UNO

  • 5V connected to Tower Pro SG90 servo (+5V)
  • GND connected to Tower Pro SG90 servo (GND) and HC-SR04 Ultrasonic Sensor (GND)
  • Vin connected to HC-SR04 Ultrasonic Sensor (VCC)
  • D8 connected to HC-SR04 Ultrasonic Sensor (TRIG)
  • D9 connected to HC-SR04 Ultrasonic Sensor (ECHO)
  • D10 connected to Tower Pro SG90 servo (Signal)

HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)

  • VCC connected to Arduino UNO (Vin)
  • TRIG connected to Arduino UNO (D8)
  • ECHO connected to Arduino UNO (D9)
  • GND connected to Arduino UNO (GND)

Tower Pro SG90 servo

  • Signal connected to Arduino UNO (D10)
  • +5V connected to Arduino UNO (5V)
  • GND connected to Arduino UNO (GND)

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:

}

Note: The provided code is a template and does not contain any functional code to operate the HC-SR04 Ultrasonic Distance Sensor or the Tower Pro SG90 servo. The user is expected to implement the setup and loop functions to initialize the sensor and servo motor and to handle the logic for distance measurement and servo control.