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
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
10 ай бұрын
Thanks! I'm glad you enjoyed it.
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
4 ай бұрын
I'm glad it helped!
That was really well edited and so informative!! Thanks for actually explaining what each line does it was so helpful, def subscribing :)
@TheBoredRobotLLC
4 ай бұрын
Glad it was helpful!
Thank you so so so much !! This is exactly what I needed, short and effective, really good tutorial.
@TheBoredRobotLLC
21 күн бұрын
Great to hear!
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
21 күн бұрын
Glad it was helpful and thank you for the suggestion!
Great video. Wish you had made it a year ago when I was banging my head trying to figure this out.
@TheBoredRobotLLC
8 ай бұрын
Thanks!
Does the baud rate need to be that high or can it be 9600?
oooh i'm gonna need this really soon. Thanks for saving a ton of people a ton of effort :)
@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
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.
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
4 ай бұрын
This is a simple sensor read code. The video should show how to send it over to python.
I have to run the python file when the Arduino starts running?
@TheBoredRobotLLC
2 ай бұрын
Do not open the serial monitor in Arduino. Get the code uploaded to your arduino first. Then run the python code.
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
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.
can i do the same thing in matlab ?? for further data processing and visualize as sub plots
@TheBoredRobotLLC
4 ай бұрын
I'm pretty sure MATLAB has a way to pull in serial data. I've never done that specifically before.
can you please tell me which compiler you used for python?
@TheBoredRobotLLC
7 ай бұрын
I just used VS Code.
Hi great video. But my code does not work. It just displays a blank plot and says: Animation was deleted without rendering anything
@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
Ай бұрын
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
is this also possible using an esp32
@TheBoredRobotLLC
3 ай бұрын
Essentially this works with anything that can send serial data.
can you include python code to copy
@TheBoredRobotLLC
3 ай бұрын
github.com/TheBoredRobot/KZread-Code
hi, where can we download code? Thanks!
@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
Hi where can I find the code?
@TheBoredRobotLLC
4 ай бұрын
github.com/TheBoredRobot/KZread-Code