Real-Time Data Visualization and CSV Logging with Arduino and Python
ฝัง
- เผยแพร่เมื่อ 22 พ.ค. 2024
- 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.
Check out this Reference Desk Mat for Arduino:
amzn.to/3vO6QBl
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...
Website:
www.theboredrobot.com/
Parts needed for this example:
Arduino Uno - amzn.to/3pGK6Am
Jumper Wires - amzn.to/3r6zZpq
Resistors - amzn.to/3PyGRp5
Photoresistors - amzn.to/3RakZ4s
Connect:
Instagram - /theboredrobot
Twitter - @theboredrobot
Facebook - / theboredrobot
Pinterest - /TheBoredRobot
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. - วิทยาศาสตร์และเทคโนโลยี
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
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
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 :)
Glad it was helpful!
Great video. Wish you had made it a year ago when I was banging my head trying to figure this out.
Thanks!
oooh i'm gonna need this really soon.
Thanks for saving a ton of people a ton of effort :)
Happy to help!
can you please tell me which compiler you used for python?
I just used VS 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?
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
I'm pretty sure MATLAB has a way to pull in serial data. I've never done that specifically before.
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);
}
This is a simple sensor read code. The video should show how to send it over to python.
hi, where can we download code?
Thanks!
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
is this also possible using an esp32
Essentially this works with anything that can send serial data.
Hi great video. But my code does not work. It just displays a blank plot and says: Animation was deleted without rendering anything
Sorry to hear it doesn't work. If you want you can try copy and pasting the code:
github.com/TheBoredRobot/TH-cam-Code
Hi where can I find the code?
github.com/TheBoredRobot/TH-cam-Code
can you include python code to copy
github.com/TheBoredRobot/TH-cam-Code