Ultrasonic Sensor Alarm

The ultrasonic sensor is a kind of sensor developed by using the characteristics of ultrasonic waves. It is widely used in industry, biomedicine, robot collision prevention, an anti-theft alarm, and other fields. The circuit in this lesson will be a simple alarm device based on an ultrasonic distance sensor.

Below is an example of what it would look like if you build this circuit with an Arduino kit. We will build this step-by-step in TinkerCad Circuits.

Step 1: Build an Independent Loop with the LED

Connect the shorter leg of LED to ground through a 220 Ohm resistor; connect the longer leg of the LED with pin 6 of the Arduino board.

Step 2: Build an Independent Loop with the Buzzer

Connect the Buzzer’s positive terminal with pin 8 of Arduino and negative terminal to GND.

Step 3: Build a Separate Loop with the Ultrasonic Sensor

Use Female-to-male Dupont Wire to connect the VCC to the “+” bus, GND to the “-” bus. Connect the Trigger pin to pin 12 and Echo pin to pin 13 of Arduino.

Step 4: Write & Test the Code

Here is the code, look closely to see how the code works.

After we run the code, if something comes within 30 cm of the Ultrasonic Sensor, the buzzer should ring, and the LED should light up!

Introduction
Lesson One: System Design
Lesson Two: Basic Circuitry Knowledge
Lesson Three: Electronics Tools
Lesson Four: Lighting an LED
Lesson Five: Tilt Switch
Lesson Six: Photoresistor and LED
Lesson Seven: Button with Piezo Speaker
Lesson Eight: Dimming an LED
Lesson Nine: Button Input for LED
Lesson Ten: Ultrasonic Sensor Alarm
Further Resources