Arduino Tutorial 56: How to Graph Live Data Using the Serial Plotter
HTML-код
- Опубликовано: 20 авг 2024
- You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:
/ paulmcwhorter
In this lesson we show how to plot live data over the Serial Plotter. While there are no formatting options, it really does help to be able to quickly and easily get a live look at your data.
You can get the kit I am using for this series at the following link:
amzn.to/2I7N4Ek
I strongly suggest picking up an arduino nano, since it can plug directly into the breadboard, making a portable system more practical. You can pick one up here:
amzn.to/2WXTC2M
As projects get more complicated in these lessons, you guys really need to get a set of breadboard jumper wires which allow you to make neater connections on the board in your projects. You can pick a pack of these wires up here:
amzn.to/2XrY5Kq
In addition as projects get more complicated, you are going to need a bigger breadboard. This is a reasonable one here:
amzn.to/2IY4d3M
Follow this lesson on our WEB site:
toptechboy.com...
[Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. This means if you visit the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.]
#Arduino
Sir, take care and stay safe from Corona. by the way I have learned a lot from this series, thank you
Thank you for the tip on the auto-scaling tendency of the serial plotter, Sir Paul.
The plotting of additional data, i.e. the constants, acts as if we have a lower boundary and an upper boundary.
While it is true that the plotter still auto-scales when data is beyond the boundaries, the graph remains neat and tidy.
This tip is great for when visualizing if a data exceeds a certain limit. And we can see that when the data plot crosses the lower or the upper boundary, i.e. when the data plot crosses the lower horizontal line graph or the upper horizontal line graph.
We are saved from being surprised with constantly varying scales / constantly varying lower and upper boundaries.
Thank you for this lesson Sir Paul!
Thank you so much for this lesson, and It was the first tie, when I use the serial plotter 😋.
Pls Sir Stay at home, because you are one of the best teacher 😄😄🤗
This Plotter looks really useful! Finding Sin and Cos as functions in the IDE was a good surprise too. I used the Serial Printer first to check that I was getting the results that I was expecting. Finding that the Cos and Sin functions needed the angle in Radians took me a moment to unravel when I looked at the results, but I now have scrolling Sin and Cos waves. Many thanks
Present. I do have a tendency to kind of wonder off and play around a bit. And I have saved a copy of every code and taken pictures of every wiring set up, so that I can go back and reference them. when I have finished your tutorials i plan on using this for personal projects.
Sir, your style of teaching is my favorite.💖You make concepts easier to understand and interesting. Thanks, a lot.
Glad to hear that
It's simpler than I thought. Although the feature has been around for a while, I haven't tried it because I thought I had to do a proper research. After watching how simple it is, I'll give it a try. Thanks for the video.
Another great lesson. The serial plotter is an Arduino tool that most people either don't use or don't realize is there. The Arduino IDE is a great piece of software and, while I don't know why they don't give you a few more options regarding the plotter, it's still great. I love that I can use my ESP32 boards as well as other boards with it. Thanks again for a great lesson!
Hey Paul,
I struggled with the math on this one.However I wrote it all down in my notebook I use for coding and future reference. It's been a rewarding experience, I've learned a lot on how to write to the Arduino ide and understanding the other libraries more. Thankyou.
Well that worked, nice to see something other than numbers passing you by. Onward to the homework. Have a great week Paul.
Hi Paul. I just finished up your first video series that goes along with your website tutorials. While I didn't have a lot of the hardware, I still went through every lesson and got the code where it will compile. Today I ordered the kit linked in the description and can't wait to try this new series with all the new components. I also ordered the GPS and a few other components from the first series so I can go back and try them. Thanks again for what you do!
Sir please start the series of Raspberry Pi tutorials this will help to improve the skills regrading for engineering.
Plotting Sine and Cosine was easy.
Declare the values as floats and do angle increments in 0.1 . I used the expression: angle+=angle+0.1; in for expression.
The Sine and Cosine are 90 degrees out of phase with each other.
Note: the EEPROM is guaranteed for 100,000 writes
Wayne
Awesome. Dimensional analysis is easier than I thought, now that I know it.
COOL ! Love the plotter functionality. Played around with the 'delay' and it looked like a cardio monitor hehe. On with the HWrk ..
Okay, sir I've done the homework. Used a "For" loop to read out the angle from 0 to 360 degrees and the sine and cos functions of the Arduino to work out the values. However I could not come up with a method to separate the 2 waves like in an oscilloscope and they were overlapping each other. Finally decided to increase the amplitude of the sine wave by doubling its value( value of the cosine wave remains the same ).
Thankfully the plotter has various colors(colours) and the waveforms can be differentiated visually though they overlap .
Now to check out Tutorial 57 and see if all went accordingly here or if I have goofed up.
Most Excellent! Keep up the good work.
Fun to learn about the Serial Plotter, thank you.
sir I became your big fan for your teaching ❤
Another great lesson thank Paul!! I'm going to play with sine and cosines now!! Be back soon 👍
A program for this, called 'telemetry ' , you can view it on RUclips, search 'arduino telemetry '
Wow, didn't even know that exists. Awesome! I'll think of ways to use it in my projects :D. Thank you and stay safe!
you deserve at least 5 million subs
this is insane....my serial plotter showed NOTHING...someone else here had the same problem even though the serial monitor worked fine. The solution? I had to remove the space between the colon and "Distance to target is: " in Serial.print . Huh?? Anyway, now it works
Thanks a lot for this lesson sir....... It's a new lesson I learned today.
I used if statements to ignore values above 10 and less than 0 for the variable distanceToTarget to keep plot between 0 and 10. It gives better plot.
Thank you. Was wondering what Serial Plotter was in the Tools.
Thanks Paul.
Thank you.
Nice Video and project. great idea I'm going back to basics because I'm a bit rusty with arduino and looking for ideas
will be there any ARM tutorials?
Using an if statement to constrain the variable value to be printed could be used to constrain the y-axis plot value and keep the plot from wild rescaling. For example:
if (varY > maxYValue) {
Serial.print(maxYValue);
}
else {
Serial.print(varY);
}
set maxYValue to a level beyond expected plus add some guardband. This should keep your plot from rescaling.
You should do a Tutorial on the RTC Module
Great video
hey great idea to prevent auto scaling, but is there a way to prevent it from hiding away old reading? as in could it compress the whole graph horizontally as new data keeps adding in?
Thanks!
Gute gemacht👾🤖
Hi sir I have worked thru the the lessons from 1 to 56 and now the rest is privet video's, do I need to join toe do the rest. Thanks a lot excellent why of explaining I have learned a lot .
Thank you grandpa 😊😊
Hey Paul, so I tried pulling up my serial plotter but instead of showing me the graph it showed a blank screen and the number values went from left to right instead of bottom to top. Do you know why that would be?
same problem
@@johnhechtlinger9465 @christianbautch4015 I'm pretty late. But it's most likely because in your Serial.println you have text. The Serial Plotter doesn't understand human text, so it doesn't know what to print.
Change it to this Serial.println(pingTravelDistance); ... should work
Ok it seems to balance out with the boundaries but still really jumpy if anything moves
Awesome video! Can you make one about a 7 segment display tutorial? Thankyou!!
You make learning so much easier. I was working on the Sin wave, BUT, the X axis moves way to fast so all I get is a wave line. Is their a way to slow the X axis speed/count/ ? down?
Hi Paul,do you have a series on the speeduino, vehicle ecu,Iwould love to learn to use this product,,,,awesome lessons
Thanks
Clean graph*
You could limit the distanceToTarget between 0 & 10.
Out of interest, i upset mine, it was hung, the plotter was hung, the LCD display was stuck, even after changing data ints, i reset the arduino several times, in the end, i reset the sensor then reset the arduino, this cured the problem, can't say why, but there is quite a bit of logic on the pcb, so who knows?
Thanks to your comment I reset the sensor and plotter began working.
Sometimes you get a negative spike for distance if you swipe your hand quickly across the sensor. Why is this ?
Can you use the distance data in another program live (like Unity)?
Maybe it’s just the sensor that came with my kit but my data in the monitor and plotter flickers everywhere. Especially when I tried measuring distance a couple videos ago it would shift between like 193 then 230. My plotter looks like a rectangular wavelength that repeats lol. Any advice on how to fix it Paul?
How many more videos have you planned for this series
Did I miss something here? In Tutorial 55 you talked about two lessons : one on dimensional analysis and one on using a low pass filter. Are they coming later? I was expecting them before this tutorial on plotting live data.
I didn't see one. I decided to sample my readings 100 times and take an average. I did a for loop 100 times. I added the sensor value (initialize to 0 at the beginning of the void loop) to a variable on each pass. Then, once outside the loop, divide the variable by 100 and use that result to calculate the distance. The output seems much more stable like that. This is a math workaround to an electronics problem. I hope to see the low pass video soon.
Sorry, I looked in the Arduino kit and I could not see any Sine Waves...and I went off on a Tangent, Cos. I don't know why.
Paul, can you show us how to use the Infra Red module please
Patience . . . it is coming in a future lesson.
When I disable serial monitor and restart it, the arduino board reboots. Is there any way to avoid that?
Can i apply it to RFID? serial plotter
Your tutorial is so awesome and so easy to understand and apply it in real life and pls recommend my comments about nrf24L01 module tutorial.
"no sugar. none needed, it is refreshing enough as it is." and you're sweet enough as is.
we have different result i will try again
Sir, can you pls teach adafruit feather
Sir, can you pls make a video about nrf24L01 module tutorial? I look on the internet but i can't find good info that i could understand and write myself a code. So pls make a video about that. I would be really appreciated if you could make one for my friends and i.
Hello sir.
Thank you so much for the content you put on RUclips. You're a model here in Africa. Could you possibly do a project on an arduino based solar charge controller with LEDs that change color on the basis of batteries been charged, charging and low.
Alternative energy is a major priority here and I want to build projects related to alternative energy. Thank you in anticipation of a response.
Maybe you could use the voltage reading tutorial he did and then a series of if statements to light various leds based on the voltage. if reading >= 12 volts write greenLED High, if reading >11.5 && reading < 12 then yellowLED HIGH..... Of course you would probably need some pretty significant resistors to step down the voltage (see tutorial on that one) to get a voltage you could use with the Arduino. DISCLAIMER - I am not a professional coder or electrician, so check these ideas with someone who is. I'm just a middle school teacher.
"The dog ate my homework"
Is Serial Plotter not an option for Visual Studio Code? only in Arduino?
Sir make the video on quad helicopter plz
Seems like Lessons 57 - 68 are not available any idea on when they will be up ??
Patience, grasshopper . . . videos are released one per week on Tuesdays. If you are locked down and not getting enough material, hop over to the Jetson Nano playlist on this channel and check it out.
@@paulmcwhorter During the wait, I incorporated the LCD to lesson 55 but without a potentiometer.
int trigPin = 12;
int echoPin = 11;
int deltime = 10;
#include
int Contrast = 75; // Setting the contrast to 75
float pingTravel;
float pingDistance;
float distance;
float velocity = .0134992; // inches/microseconds
int longwait = 1000;
int rs = 7; // The next 7 int were to set up LCD pins
int en = 8;
int vo = 44;
int d4 = 2;
int d5 = 3;
int d6 = 4;
int d7 = 5;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7); //Setup LCD Object
void setup() {
// put your setup code here, to run once:
analogWrite(44, Contrast); // Writing Contrast to 44 (PWM pin)
lcd.begin(16, 2);
delay(longwait);
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(trigPin, LOW);
delayMicroseconds(deltime);
digitalWrite(trigPin, HIGH);
delayMicroseconds(deltime);
digitalWrite(trigPin, LOW);
pingTravel = pulseIn(echoPin, HIGH); // pingTravel is in Microseconds
lcd.setCursor(0,0);
lcd.print("Ping : ");
lcd.print(pingTravel);
pingDistance = (pingTravel / 2); // cutting travel by 2 to get point of deflection
distance = (velocity * pingDistance);
lcd.setCursor(0,1);
lcd.print(distance);
lcd.print(" Inches ");
delay(longwait);
}
Paul. sorry I have to temporally stopping follow your lessons because of COVID-19.Unfortunately do not have my PC and all Arduino's KIts with me right now. Anyway, As I am thinking for the assignment of sine/cosine and my idea is graph which mirrored of function y = f(x) for sine and y=-y for cosine. From my old school Pi is better presentation for cycle of sine. 2Pi is whole cycle, Pi is half cycle and 1/4Pi, 1/2Pi, 3/4Pi and etc. As example, if max sine (y) as 10 then it is 1/2 of Pi, 1/4 of Pi equal y=5 or close, 3/4 of Pi is close to 5, then for next half cycle Pi+1/2Pi as max and etc. Thanks to refresh knowledge from 70 th.
Please Sir..... Can you do a lesson on keypad...
"Let me show you how to do a graph. First of all, you have to KILL-"
Am I the only one getting negative numbers for the Ping Travel Time & Distance? I don't get how thats even possible lol
can i get you coding sir ?
Thanks Paul.
Great video