Site icon High Voltages

Arduino Real-Time Plotting with Python

Arduino Real-Time Plotting with Python

Arduino Real-Time Plotting with Python

INTRODUCTION:

Analytics is one of the best tools, which help you gain information about what is happening, and help you to see the trends in the data. Companies like Facebook, Google, Uber, Amazon, and many others use the help of analytics to perform certain tasks, such as ads. Arduino Real time plotting with python project will help you with analytics.

This Project Arduino Real-Time Plotting with Python will help you do analysis on your sensor data in real-time.

In this project, we are going to take sensor values and send it on python script running on our laptop serially and will plot those serial values in real-time.

Arduino plot graph using Python
Arduino Real-time Plotting with Python

Also, Watch how to plot a real-time graph in Matlab using Arduino.

Arduino Realtime graph plot using Matlab
Arduino Real-time Plotting with Matlab

SCHEMATICS:

Arduino Real-Time Plotting with Python
Arduino with potentiometer

CODE:

import serial
import matplotlib.pyplot as plt

plt.ion()
fig=plt.figure()


i=0
x=list()
y=list()
i=0
ser = serial.Serial('COM13',9600)
ser.close()
ser.open()
while True:

    data = ser.readline()
    print(data.decode())
    x.append(i)
    y.append(data.decode())

    plt.scatter(i, float(data.decode()))
    i += 1
    plt.show()
    plt.pause(0.0001)  # Note this correction

Don’t Forget to Subscribe and Like us:

if you need any help in this project you can contact us.

Please Subscribe us on youtube: www.youtube.com/c/highvoltages

Facebook: www.facebook.com/highvoltagestech

Instagram: www.instagram.com/highvoltagestech

Exit mobile version