Skip to content

πŸš€ This project links an Arduino with an ultrasonic sensor to a Python script for real-time data visualization. It's a simple way to visualize distance measurements and serves as a foundation for more advanced sensor projects. 🌟

Notifications You must be signed in to change notification settings

TotallyStud/Distance-Tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Distance-Tracking

πŸš€ This project πŸ› οΈ involves an Arduino equipped with an ultrasonic sensor and a Python script 🐍 for real-time data visualization πŸ“Š. The Arduino is programmed πŸ’» to read distance measurements πŸ“ from the ultrasonic sensor and send the data over a serial connection πŸ”Œ.

The Arduino sketch sets up the trigger and echo pins for the ultrasonic sensor and initializes the serial communication at 9600 baud rate. In the main loop, it triggers the ultrasonic sensor, measures the echo pulse duration, calculates the distance based on the speed of sound πŸ”Š, and sends the distance over the serial connection every second ⏱️.

The Python script on the other hand, opens a serial connection to the Arduino on a specified port and begins reading the distance data. It continuously reads lines from the serial port, converts them to floats, and adds them to a list of distances. Any readings that exceed 400 cm are ignored to ensure data quality πŸ“‰.

The list of distances is then visualized using matplotlib πŸ“ˆ. The distances are plotted on a graph πŸ“‰, with the most recent distance displayed as text in the top right corner of the plot. The plot is updated in real-time as new data is read from the Arduino. The y-axis of the plot is set to range from 2 cm to 400 cm to match the expected range of the ultrasonic sensor.

This project serves as a basic example of how to interface an Arduino with Python for real-time data visualization, and could be a starting point for more complex projects involving Arduino and ultrasonic sensors. 🌟

About

πŸš€ This project links an Arduino with an ultrasonic sensor to a Python script for real-time data visualization. It's a simple way to visualize distance measurements and serves as a foundation for more advanced sensor projects. 🌟

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published