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
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?
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!
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); }
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.
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
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!
Thank you so so so much !! This is exactly what I needed, short and effective, really good tutorial.
Great to hear!
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?
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.
Great video. Wish you had made it a year ago when I was banging my head trying to figure this out.
Thanks!
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!
Glad it was helpful and thank you for the suggestion!
oooh i'm gonna need this really soon.
Thanks for saving a ton of people a ton of effort :)
Happy to help!
I have to run the python file when the Arduino starts running?
Do not open the serial monitor in Arduino. Get the code uploaded to your arduino first. Then run the python code.
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.
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.
Does the baud rate need to be that high or can it be 9600?
No it doesn't. It just depends on how much data you want over a given time period.
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.
can you please tell me which compiler you used for python?
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
Sorry to hear it doesn't work. If you want you can try copy and pasting the code:
github.com/TheBoredRobot/RUclips-Code
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
Essentially this works with anything that can send serial data.
Hi where can I find the code?
github.com/TheBoredRobot/RUclips-Code
can you include python code to copy
github.com/TheBoredRobot/RUclips-Code
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