No video

Real-Time Data Visualization and CSV Logging with Arduino and Python

In this video, I demonstrate how to send sensor data from the Arduino, plot the data in python, and then automatically save the data to a CSV file.
Video Timestamps:
0:00 - Introduction
0:11 - Arduino Code
0:59 - Python Code
4:15 - Data Visualization in Arduino
4:25 - Data Visualization in Python
4:34 - Saving data to a CSV
👉Subscribe for more robotics and engineering tips:
/ @theboredrobotllc
Share this video with a friend:
• Real-Time Data Visuali...
Parts needed for this example:
Arduino Uno - amzn.to/3pGK6Am
Jumper Wires - amzn.to/3r6zZpq
Resistors - amzn.to/3PyGRp5
Photoresistors - amzn.to/3RakZ4s
Disclaimer: This video contains affiliate links, meaning that if you make a purchase from one of the product links, I'll receive a small commission.

Пікірлер: 41

  • @Stakodron
    @Stakodron10 ай бұрын

    perfect on point video! In this world theire are 2 typ's of Tutorials those who go 25min+ and thos who just get to the point in 5min

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    10 ай бұрын

    Thanks! I'm glad you enjoyed it.

  • @andrepereira3338
    @andrepereira33385 ай бұрын

    Thank you so much for this. Straight to the point, clean code, and easy to apply to just about any project with sensors. You really saved me a bunch of time on StackOverflow hahaha

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    4 ай бұрын

    I'm glad it helped!

  • @remremgaming2561
    @remremgaming25614 ай бұрын

    That was really well edited and so informative!! Thanks for actually explaining what each line does it was so helpful, def subscribing :)

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    4 ай бұрын

    Glad it was helpful!

  • @LeLouisLafontaine
    @LeLouisLafontaine23 күн бұрын

    Thank you so so so much !! This is exactly what I needed, short and effective, really good tutorial.

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    21 күн бұрын

    Great to hear!

  • @joshuas9078
    @joshuas9078Ай бұрын

    Thank you! Phenomenal video! I love the style I love the explanations, to the point and easy to follow!! You may was to consider adding to the end of the ser.close() in the in_close() function. My system doesn't automatically close serial communication and this may save some headaches for other viewers as well!

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    21 күн бұрын

    Glad it was helpful and thank you for the suggestion!

  • @brynmrsh
    @brynmrsh8 ай бұрын

    Great video. Wish you had made it a year ago when I was banging my head trying to figure this out.

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    8 ай бұрын

    Thanks!

  • @NicholasWong-vv1nn
    @NicholasWong-vv1nn7 сағат бұрын

    Does the baud rate need to be that high or can it be 9600?

  • @ameliabuns4058
    @ameliabuns40585 ай бұрын

    oooh i'm gonna need this really soon. Thanks for saving a ton of people a ton of effort :)

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    5 ай бұрын

    Happy to help!

  • Ай бұрын

    since arduino is running before the python script activates the time stamps do not start at 0. is there a way to make the timestamp start at zero once the python code starts?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    21 күн бұрын

    I'm sure there is a number of ways you can do this, but one of the ways is to use a timer in python and plot the x axis with that value instead.

  • @Alina-ph4vl
    @Alina-ph4vl4 ай бұрын

    void setup() { Serial.begin(115200); //setting up the connection between arduino and computer } void loop() { float time = micros() /1e6; // calculate the current time using micros and convert it to seconds for time stamping int sensorValure1 = analogRead(A0); //read the analog values from the two light sensors int sensorValure2 = analogRead(A1); delay(100); // add a short delay to ensure a reasonable sampling rate Serial.print(time); // send the data to the computer via the seral port. Print the "timestamp,sensorValure1,sensorValure2" Serial.print(", "); Serial.print(sensorValure1); Serial.print(", "); Serial.println(sensorValure2); }

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    4 ай бұрын

    This is a simple sensor read code. The video should show how to send it over to python.

  • @Daniel-dg5po
    @Daniel-dg5po2 ай бұрын

    I have to run the python file when the Arduino starts running?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    2 ай бұрын

    Do not open the serial monitor in Arduino. Get the code uploaded to your arduino first. Then run the python code.

  • @PeedrooHenriiquee
    @PeedrooHenriiquee3 ай бұрын

    hello. im performing a teste where i need that the sensorValue1 and 2 to be a float. because i need to be very precise. and so when i put float sensorValue1 and 2, in the python code, the append on the list does not accept float value to be assigned. Can you help?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 ай бұрын

    It's really hard to say without seeing your code. Recently, I've just been sending my error messages into any of the AI chat bots to help give me insight into issues with my code that I write.

  • @vigneshkailas1561
    @vigneshkailas15614 ай бұрын

    can i do the same thing in matlab ?? for further data processing and visualize as sub plots

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    4 ай бұрын

    I'm pretty sure MATLAB has a way to pull in serial data. I've never done that specifically before.

  • @zainarshadvirk3706
    @zainarshadvirk37067 ай бұрын

    can you please tell me which compiler you used for python?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    7 ай бұрын

    I just used VS Code.

  • @visheshsaxena6199
    @visheshsaxena61993 ай бұрын

    Hi great video. But my code does not work. It just displays a blank plot and says: Animation was deleted without rendering anything

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    2 ай бұрын

    Sorry to hear it doesn't work. If you want you can try copy and pasting the code: github.com/TheBoredRobot/KZread-Code

  • @joshuas9078

    @joshuas9078

    Ай бұрын

    Consider adjust line: ani = FuncAnimation(fig, update_plot, interval=10) from 10 to another number. My system works better with 50 miliseconds instead of 10

  • @xavierblaster
    @xavierblaster4 ай бұрын

    is this also possible using an esp32

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 ай бұрын

    Essentially this works with anything that can send serial data.

  • @NicolasPietrantoni
    @NicolasPietrantoni4 ай бұрын

    can you include python code to copy

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    3 ай бұрын

    github.com/TheBoredRobot/KZread-Code

  • @gregowen4806
    @gregowen48069 ай бұрын

    hi, where can we download code? Thanks!

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    9 ай бұрын

    I'm still working on getting some things posted, but if you want to contact me directly, I can send it to you. theboredrobot.com/pages/contact

  • @ameliabuns4058
    @ameliabuns40584 ай бұрын

    Hi where can I find the code?

  • @TheBoredRobotLLC

    @TheBoredRobotLLC

    4 ай бұрын

    github.com/TheBoredRobot/KZread-Code