Skip to content

Simple Arduino radar using an ultrasonic sensor and servo motor.

Notifications You must be signed in to change notification settings

marcus-k/ArduinoRadar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino Radar System

Code for a simple radar setup using an Arduino UNO, HC-SR04 ultrasonic sensor, SG90 servo motor, and DHT11 temperature and humidity sensor.

Table of Contents

Installation

First, the necessary Arduino libraries should be installed:

Both of these libraries can be found in the Arduino IDE's Library Manager under Sketch > Include Library > Manage Libraries....

Next, the necessary Python libraries should be installed:

The Anaconda distribution of Python was used to install these libraries.

conda install -c conda-forge numpy pandas matplotlib pyserial

Usage

Calibration

Before using the radar, calibration should be done to find the speed of sound in the environment you are in. The code is setup to do this in two ways:

  1. Distance-Time Method
    Setup the ultrasonic sensor a set distance away from a flat surface and measure the time it takes for a ultrasonic wave to return. Dividing the distance by the time returns the sound speed.

  2. Atmospheric Method
    Calculate the speed of sound based off of ambient conditions including temperature, relative humidity, pressure, and CO2 concentration.

The data for these methods is recorded at the same time. Set your ultrasonic sensor a known distance away from a flat surface. Change the distance parameter in the calibration.ino file to reflect your setup. Upload the calibration.ino file to your Arduino and run calibration.py on your computer. This will record the temperature, relative humidity, and speed of sound every two seconds while running. Press CTRL+C to stop the program and print the mean values of the session. You can use the speed of sound displayed at this point, or a more accurate speed of sound can be calculated following the instructions in the calibration folder.

Radar

Once the speed of sound is obtained, update the value in the radar.ino file, then upload it to your Arduino. Run the radar.py file on your computer to start requesting data from the Arduino. It will be plotted in real-time in the popup graphical interface.

Troubleshooting

On Linux, one possible issue may be that you do not have permission to read the /dev/tty* ports. I found that following this answer and adding myself to the dialout group allowed me to read the files.

Additional Things to Read

About

Simple Arduino radar using an ultrasonic sensor and servo motor.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published