An open API service indexing awesome lists of open source software.

https://github.com/Chmatulo/Ultrasonic-Ranger-Sonar

Ultrasonic Ranger Sonar
https://github.com/Chmatulo/Ultrasonic-Ranger-Sonar

arduino csharp grove python radar ultrasonic-sensor

Last synced: 12 months ago
JSON representation

Ultrasonic Ranger Sonar

Awesome Lists containing this project

README

          

# Ultrasonic Ranger Sonar

This project is a sonar system that utilizes an ultrasonic sensor and a servo motor to scan the surroundings. The sonar system is controlled using C# and Python for data processing and visualization. The ultrasonic sensor measures the distance of objects, and the servo motor sweeps the sensor to create a 2D map of the environment using the pygame drawing library.


Sonar Build IRL using LEGOS




Sonar Interface with detected object



## Features

• Distance Measurement: Use an ultrasonic sensor to measure the distance to nearby objects.

• Scanning: A servo motor rotates the sensor to scan the surroundings.

• Data Visualization: Display the detected distances in a visual sonar-style graph.

• Multi-Language Support: C# for device control and Python for visualization.

## Requirements

### Hardware

For this project, I've used the Grove Ecosystem, so all the hardware/software corresponds to it. It is possible to avoid using the grove ecosystem, although the c# script won't be adapted to such hardware.

• Computer (for running Python scripts for visualization)

• Arduino UNO with USB-B cable

• Arduino Grove base hat

• Ultrasonic Sensor (e.g. Grove - Ultrasonic Ranger)

• Servo Motor (e.g. Grove - Servo)

• Grove - Universal 4 Pin Cables

### Software

• Code editor (e.g. VS Code)

• Arduino IDE

• Python 3.x

• C#

• pyserial module

• pygame module

• Grove Servo library

• Grove Ultrasonic Ranger Library

## Usage

The arduino communicates its recorded data through the COM3 serial port to the computer.

To start the program, upload the .ino script to the arduino and then close the IDE. Otherwise, the python script cannot read from the COM3 serial port as it is being used by an other program.
Next, run the python script on your computer and a window with a sonar interface should appear (note that there is a 2 seconds cooldown to setup the ultrasonic ranger at exactly 0 degrees).

Finally, enjoy your sonar.

## Program

You can manually change the detection range of the ultrasonic ranger. To do so, go to the visualization.py file and change the detection_range var to whatever you want.

## Contributing
Feel free to open issues or create pull requests to suggest improvements!

## License
This project is licensed under the MIT License. See the LICENSE file for details.