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

Arduino UNO Controlled Ultrasonic Sensor with Servo Motor

Image of Arduino UNO Controlled Ultrasonic Sensor with Servo Motor

Circuit Documentation

Summary of the Circuit

This circuit integrates an Arduino UNO microcontroller with an HC-SR04 Ultrasonic Sensor and a Servomotor SG90. The Arduino UNO is used as the central processing unit to control the operations of the ultrasonic sensor and the servomotor. The ultrasonic sensor is responsible for distance measurement, while the servomotor is used to actuate based on the sensor's readings. The circuit is powered by the Arduino UNO's 5V output, which is shared with both the ultrasonic sensor and the servomotor.

Component List

Arduino UNO

  • Description: A microcontroller board based on the ATmega328P.
  • Purpose: Acts as the central processing unit for the circuit, controlling the sensor and servomotor.
  • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13.

HC-SR04 Ultrasonic Sensor

  • Description: An ultrasonic distance sensor capable of measuring distances from 2cm to 400cm.
  • Purpose: Measures the distance to an object and sends this information to the Arduino.
  • Pins: VCC, TRIG, ECHO, GND.

Servomotor SG90

  • Description: A small and lightweight servo motor capable of precise control.
  • Purpose: Actuates based on commands from the Arduino, typically to adjust the position of an object.
  • Pins: SIG, VCC, GND.

Wiring Details

Arduino UNO

  • 5V supplies power to the HC-SR04 Ultrasonic Sensor and Servomotor SG90.
  • GND is connected to the ground pins of both the HC-SR04 Ultrasonic Sensor and Servomotor SG90.
  • D12 is connected to the SIG pin of the Servomotor SG90.
  • D11 is connected to the ECHO pin of the HC-SR04 Ultrasonic Sensor.
  • D10 is connected to the TRIG pin of the HC-SR04 Ultrasonic Sensor.

HC-SR04 Ultrasonic Sensor

  • VCC is connected to the 5V output from the Arduino UNO.
  • TRIG is connected to pin D10 on the Arduino UNO.
  • ECHO is connected to pin D11 on the Arduino UNO.
  • GND is connected to a GND pin on the Arduino UNO.

Servomotor SG90

  • SIG is connected to pin D12 on the Arduino UNO.
  • VCC is connected to the 5V output from the Arduino UNO.
  • GND is connected to a GND pin on the Arduino UNO.

Documented Code

The code for the Arduino UNO is intended to control the HC-SR04 Ultrasonic Sensor and the Servomotor SG90. However, the provided code inputs are empty. In a typical application, the code would initialize the sensor and servomotor, read distance measurements from the sensor, and then command the servomotor to move to a position based on those measurements.

// Code for Arduino UNO
// The code is not provided in the input. Below is a placeholder for where the code would be documented.

void setup() {
  // Initialize sensor and servomotor pins.
}

void loop() {
  // Read from the sensor.
  // Command the servomotor based on sensor readings.
}

Please note that actual code is required to perform the intended operations. The above is a template showing where the code would be placed and how it might be structured.