Real Time Graph - Ultrasonic Sensor With Raspberry Pi

Introduction: Real Time Graph - Ultrasonic Sensor With Raspberry Pi

Plot Graph for Distance measured by Ultrasonic sensor v/s time using Plotly

Gathering data from sensor is cool. But lot of data can be confusing and it will be difficult to interprete how it varies. So how about streaming it , It is visually more understanding . Plot graph using Plotly! Its fun!

Step 1: Make Circuit

Things needed

1.Raspberry Pi 2

2. 2 resistors (330 ohm and 470 ohm )

3. Jumper wires

4. Ultrasonic sensor

5. wifi module

6. USB cable (to power pi)

7. BreadBoard

So to begin with make a circuit as shown in figure. Connect the GPIO pins as in figure. Make sure its right.

Step 2: SSH Into Your Pi

Once your done with circuit. SSH into your pi. I have used putty.

Login using your credentials.

Step 3: Create Plotly Account

Create plotly account. Its free!! once u create go to settings which appears on top right corner of screen.

Note down your username, api key and streaming key If streaming key doesn't appear click on add new token.

Step 4: Write Python Code

Write the python code for measuring distance from ultrasonic sensor. What the code does is , it gets the distance from ultrasonic sensor and plots it v/s time using plotly.

For code go to -- > https://github.com/sachinprabhu007/UltraSonicSensor_Rpi2

Clone or download the code and use it !

Make sure to mention your api key ,username and streaming token in code. You must change it accordingly.

use python file_name.py (i.e python ultrasonic_sensor.py in this case )to run the code .

Happy Streaming !! :)

Drones Contest 2016

Participated in the
Drones Contest 2016

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    2 Discussions

    0
    DIY Hacks and How Tos

    Great Raspberry pi project. I am going to try this with a pi zero. That will be a lot cheaper than using an Arduino.

    0
    dragon_warrior
    dragon_warrior

    Reply 4 years ago

    thanks :) enjoy!