Arduino with Python LESSON 11: Graphing and Plotting Live Data from Arduino with Matplotlib

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024

Комментарии • 193

  • @paulo.galvao
    @paulo.galvao 5 лет назад +21

    In Python 3 i think numpy is not necessary for this. To work this program as to change line 30 to: arduinoString = arduinoData.readline().decode("utf-8") #read the line of text from the serial port

  • @steveholt8991
    @steveholt8991 Месяц назад

    10 years later and I'm still learning ! Thanks Paul, more spanners in the toolkit!

  • @localbroadcast
    @localbroadcast 6 лет назад

    your series of lessons has really helped me out regarding getting a start on my python learning curve. nothing better than someone stepping you through it one thing at a time, explaining it all as you go. I have learnt how to program html, action script, basic, arduino all without any schooling, but at times it is very difficult without the kind of support you get from an actual class. There are many gaps in my knowledge which most professional programmers would find comical.. so again I appreciate you putting these lessons out there for people like me as I find it has filled in quite a few gaps I had while trying to figure out python on my own so far. thanks! please resist the urge to make your videos ' members only content' or something like that... share the knowledge and it'll come back to you ten fold.

  • @RDKCREATIONS
    @RDKCREATIONS 3 года назад +1

    i have done this lesson with a joystick and its awesome. plotted x values and the y values in the graph

  • @eddiekvh
    @eddiekvh 8 лет назад +3

    You're a true teacher. I've learned a ton here. Thanks!

    • @paulmcwhorter
      @paulmcwhorter  8 лет назад

      +Eddie Liberato Thanks for the kind words.

  • @fjskfjdkdksofk
    @fjskfjdkdksofk 8 лет назад +3

    i have seen every single lecture of you from arduino #1. all of them just the best of the best!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    • @paulmcwhorter
      @paulmcwhorter  8 лет назад

      +Wanseok Yang Thank you for your encouragement. I am glad you find the series useful.

  • @olddogg60
    @olddogg60 8 лет назад

    I'm an old dog learning new tricks and I am enjoying your videos. What a fun way to learn new things. You are an excellent instructor. If I had had teachers like you those many years ago, I might have actually been interested in school. :-) At the time I was more interested in the projects I was doing at home on my own.

  • @MemoMedranoo
    @MemoMedranoo 2 года назад

    Paul, I wanna say thanks, this script saved my project, I'm doing a multivariable sensorial module. It tracks voltage and current from a 3 phase motor. Collecting data from 3 arduinos at the sime time, I adapted this code and it works perfectly. Keep doing videos like this, you are a great teacher!!

  • @nicknackthenoo
    @nicknackthenoo 9 лет назад

    I have learnt more today than I have in 2 Years by watching these videos. You Sir are a good teacher and I like the way you make mistakes in spelling and admit that you have done it. I am now a net-pupil of yours. Thanks.

  • @karthikvigneshwar8742
    @karthikvigneshwar8742 4 года назад

    I just want to wholeheartedly thank you for this channel and all your lessons. They have been very helpful and the way you teach also motivates me to try and emulate the same when I try and teach others. Thanks again!

  • @paulmcwhorter
    @paulmcwhorter  10 лет назад +2

  • @davidbristoll195
    @davidbristoll195 8 лет назад

    Great work Paul. I've missed all of your lessons, but you made this simple enough for me to understand. Thank you!

  • @shanee7511
    @shanee7511 9 лет назад

    You are an excellent teacher, Paul. I found your tutorials while looking for information on Matplotlib for Python and Raspberry Pi. I am working on a project at work to automate a particular calibration chore. I've since viewed several of your tutorials and will be watching the rest soon. Thank you so much for making this information so clear and easy to understand.

    • @paulmcwhorter
      @paulmcwhorter  9 лет назад

      Shane E Thanks! Glad the videos are helpful.

  • @shailf17
    @shailf17 9 лет назад

    hi, i am new to both python and arduino. and i am glad that i came to this tutorial first. Brilliantly explained. Thanks a lot.

  • @freeelectron8261
    @freeelectron8261 5 лет назад

    The scaling and data range updating was really useful and also your enthusiasm is infectious! :)

  • @yuanfang2352
    @yuanfang2352 7 лет назад

    thank you so much for solving my problem in sending multiple values from arduino to python. I'm really new to serial communication and searched a lot of methods but only yours works!

  • @zeylien
    @zeylien 10 лет назад +2

    Thank you very much for these good arduino python tutorials :-)
    My plotting was slow when using the drawnow() function, there was a few seconds delay between the plot and me activating the sensor. But when i instead inside the loop used the plt.plot() function with a plt.cla() //clears the plot after, it was able to plot at nearly live speed.

    • @erik776
      @erik776 4 года назад

      Thank you so much for your comment! I was having the same issue, but your solution solved it! :)

    • @rubertgabriel5418
      @rubertgabriel5418 Год назад

      I dont understand what you mean, please cant you hellp me, I am with the same problem.

  • @perfil_anonimo_83_br
    @perfil_anonimo_83_br 4 года назад

    This is the world best teacher.

  • @Parshwadeep
    @Parshwadeep 9 лет назад

    This is awesome Paul !Thanks for sharing. Step by Step process you have is so much better than the other videos where people usually assume most of stuff is known to the viewer . Keep it coming :).... I am new to both Python and Arduino and I am loving it so far...hope to keep the enthu ON with your regular updates !!

  • @Zugadizayn
    @Zugadizayn 9 лет назад

    Thank you so much. you are my master ! Best teacher ever !! Your teaching skills and your style is OMG ! absolutely amazing. !!!
    Mechanical Engineer from Turkey..

    • @paulmcwhorter
      @paulmcwhorter  9 лет назад

      Cihan Büyük Thank you for the kinds works. Glad to hear this material is useful to you.

  • @hanlovciss2944
    @hanlovciss2944 9 лет назад

    i can not express more how i like your videos, thanks.

  • @sacredinclinations
    @sacredinclinations 3 года назад

    -thanks so much for this video I have been contemplating getting into microelectronics for a while and your lesson just sealed the deal. I subscribed and I guess its now time to buy stuff!

  • @rsyoung01
    @rsyoung01 9 лет назад

    Lucid, clear explanation, thanks for posting! I especially benefit for line by line discussion of not just wha,t by why you're doing what you're doing...

  • @BrimanAerospace
    @BrimanAerospace 6 лет назад

    Finally someone useful

  • @penind
    @penind 8 лет назад

    The best explanation i never seen before!! you Sr are the best!!! Thanks

  • @parasbhanot
    @parasbhanot 9 лет назад

    This is easy with matplotlib and python but it is a nightmare with jfreechart and j2d charts in java . i am glad that i found this tutorial series .thanks

  • @jovano20
    @jovano20 4 года назад

    Thank you sir, as a biotechnology student this was very usefull!

  • @SoumilShah
    @SoumilShah 5 лет назад

    I need help I have string on x axis and it’s time my value on x axis get cluttered after a while how do I reset or limit my x axis using Matplotlib python

  • @perfil_anonimo_83_br
    @perfil_anonimo_83_br 4 года назад

    Do you are the best teacher. I am happy now, the my work is save now.

  • @TheBoss-rk2qr
    @TheBoss-rk2qr 6 лет назад

    Thank you Paul! Love is send to you from CSULB Biomedical Engineering students!

  • @francescop1410
    @francescop1410 7 лет назад +2

    Hi Paul,
    Your work is amazing and I'm using it for my application!
    But I need one more thing, is there a way to slide trough the graph? I mean can I manage to stop it and see old values in the graph?
    I know this video is old, but you would be very important for my thesis!
    Thank you anyway.

  • @syedsibteali5761
    @syedsibteali5761 3 года назад

    Thank You professor for you teaching this in a quite comprehensive manner. I have a question as i am stucked on the port access denied error in python code. Kinldy let me know how this can be made working

  • @kurtauerbach5883
    @kurtauerbach5883 3 года назад

    wow you made this seem simple simple = fun !! (like the comments in code) just found ur lessons. I havent looked yet still catching up with this one. but like to suggest saving the data using ..than later pulling it using python and redisplay it. kind of like user can choose which file to display. saving by datetime stamp maybe simplest or user option another lesson..Thank you great lesson!!

  • @rocket6786
    @rocket6786 7 лет назад

    @Paul McWhorter You sir, are a brilliant man. much respect!

  • @mikecraft4506
    @mikecraft4506 6 лет назад

    Paul great lessons - what I would really like to do is for the pressure readings to light leds showing the rise and fall of pressure in steps. Any thoughts or help would be much appreciated, maybe this would be a great future lesson sometime.

  • @montenegromf
    @montenegromf 4 года назад

    Thank you Sir! I big hello for Sweden and your enthusiasm looking the results are great! Thank you very much, I've learned a lot of following your tutorials

  • @rupinchaudhry592
    @rupinchaudhry592 2 года назад

    Very captivating. Many thanks

  • @Debraj1978
    @Debraj1978 8 лет назад

    Excellent tutorial and very detailed explanation. Thank you sir for your contribution.

  • @jakaknafelc6638
    @jakaknafelc6638 9 лет назад

    Thanks for your tutorials. For my arduino project i'm trying to make my data visible on my pc->web server. searching the web i "stumble" on your tutorial for Using Python with Arduino.
    What i have seen in your tutorials, I think i can achieve to make my project work. You gave me the joy for learning more python.
    Your tutorials are one of the most pleasant and educational to watch. Again thank you for your contributions you are true teacher. Best regards.
    sorry for bad english

    • @paulmcwhorter
      @paulmcwhorter  9 лет назад +1

      Jaka Knafelc Thank you for the kind and encouraging words. I am glad the material was helpful to you. I developed the videos for my high school engineering class, but am pleased to find that others are benefiting as well.

  • @sagarpotnis1215
    @sagarpotnis1215 4 года назад

    Thank you Sir, this helped me a lot ...you are too kind... and a very good teacher

  • @kingleo188
    @kingleo188 4 года назад

    Very well explained. Excellent effort. You have explained this very well. Thank you so much

  • @freeelectron8261
    @freeelectron8261 5 лет назад

    Thanks Paul! Just the info I was after - live plots.

  • @worlwinllc
    @worlwinllc 4 года назад +2

    Thanks for the tutorial - I've been trying to put something like this in a tkinter app - but i get blocked every second while updating - Do you have an example or can you point me to a matplotlib in tkinter with non-blocking update? Thanks again for this tutorial it's helping out.

  • @slonbeskonechen8310
    @slonbeskonechen8310 3 года назад

    Awesome! So clear and understandable! Thank you!!!

  • @kike1465
    @kike1465 5 лет назад +1

    Thank you so much for this tuto, I have been seeking for a tutorial like this! BTW i'm doing the same thing with Python 3 and jupyter notebook

    • @syedsibteali5761
      @syedsibteali5761 3 года назад

      How did you import drawnow in jupyter notebook
      as i am unable to do it.

  • @hafidzerdityo552
    @hafidzerdityo552 3 года назад

    Thank you so much, you helped my final year project :))) Love ya!

  • @CarlosCruz-mn6yo
    @CarlosCruz-mn6yo 5 лет назад

    Hi Paul. Excellent lessons. Thanks very much. A question - is it possible to do do a copy paste of your code into another Arduino?

  • @diymicha4905
    @diymicha4905 8 лет назад

    Hi there, very good tutorial for me as python n00b, thanks. But why don't you use
    if (len(TempF)>50):
    TempF.pop(0)
    ...
    In this way you don't need a counter variable. I think this might be useful for readings that last forever to prevent an overflow of the counter.

  • @ElivsIsAlive15
    @ElivsIsAlive15 6 лет назад

    You Sir, did an awesome job there!
    Thanks a lot!

  • @ashleycronk454
    @ashleycronk454 8 лет назад

    Great tutorial!! Super easy and now I have a pretty great python program that can do a whole lot with arduino and multiple sensor units

  • @jfmoya
    @jfmoya 9 лет назад

    Paul, thank you so much for sharing! Very useful tutorial for my project.

  • @alexandervaldez1646
    @alexandervaldez1646 10 лет назад

    Amazing work Mr. Paul thank you very much!

  • @kirkchu7304
    @kirkchu7304 9 лет назад

    +Paul WcWhorter Not sure it matters because its in a string, but you mispelled "pressure" in your second label for y axis. Enjoying the vids, keep it going!

    • @paulmcwhorter
      @paulmcwhorter  9 лет назад +1

      ***** Yep, there is a reason I became an engineer . . . I can not spell. I tell the kids that if you are good enough in math they will pay someone to follow you around and clean up your spelling.

  • @BesrSence
    @BesrSence 6 лет назад

    just i want to express my deep depreciation to you!

  • @debajyotisg
    @debajyotisg 7 лет назад +2

    When I try to get arduinostring.split(",") I get this error
    a bytes-like object is required, not 'str'
    Help

  • @Chilanglik
    @Chilanglik 8 лет назад

    Hello! I'm very very happy learning with your classes about arduino and python! You're an excellent teacher!
    Although I have a doubt... I'm trying to implement the algorithm with an electrical system, but I notice the sampling time while drawing is one second, not more or less. And I want to change it because of the speed of my system, how can I make this sampling time smaller?
    PD: The arduino's sampling time is the right one, even when I printed on the Phyton shell. It's only when drawing that I have the problem.

  • @syselec1215
    @syselec1215 6 лет назад

    thank you very very much sir, you are the best teacher

  • @thaninilai8098
    @thaninilai8098 5 лет назад

    Thanks a lot Paul! Great tutorial and you are awesome!

  • @venkadesh27
    @venkadesh27 8 лет назад

    I tried and it worked.. Thanks a ton !
    One question: This might sound weird to others..but is it possible to view this live plot in my android phone?

  • @prashanthb6521
    @prashanthb6521 6 лет назад

    Excellent. Thanks a lot for this tutorial.

  • @lidazheng8159
    @lidazheng8159 4 года назад

    Thank you very much for this video Mr McWhorter! It is absolutely helpful. I have one question related to tkinter GUIs. How can I embed this 'drawnow graphic' into a tkinter interface?

  • @jonhclever123
    @jonhclever123 4 года назад

    I am currently doing intern about micro controller, and this video opened a new world for me

  • @kuochiyoug
    @kuochiyoug 8 лет назад

    Perfect! Thank your tutorial!

  • @audreimalaza5461
    @audreimalaza5461 7 лет назад

    You're my Hero!

  • @GeorgeLenoHolmesJr
    @GeorgeLenoHolmesJr 5 лет назад

    Python 2.7 readline() returns a str. Python 3 readline() returns bytes. Both versions of python readline() returns the end of line and new line delimiter in addition to the desired data. Why is this not discussed?

  • @MultiBubbo
    @MultiBubbo 8 лет назад

    Thanks for the amazing lecture Paul. Could you please shed some light on how to create two separate figures in the makeFig function.
    Can we create the figure object outside the function, mark the axes, title just once and not do that every time makeFig is called ? I tried that but it is not working.
    Looking forward to your reply.
    Thanks Again !!

  • @aleksandrjaworski7789
    @aleksandrjaworski7789 10 лет назад

    Wow, nice tutorials. I'v bought adruino to use such tutorial. Do you know, how to output updating data with django or another web-framework? Can you make a tutor for such situation? I suppose, it needs websocket server and plotting of charts with any js framework.

  • @brendan3966
    @brendan3966 4 года назад

    Is there a way to eliminate the delay(250) from the arduino code? Maybe update a .csv file with the arduino and then plot the .csv as fast as you can so you preserve the missing values? Obviously the plot would be a little behind.

  • @AJAYSINGH-ic2iy
    @AJAYSINGH-ic2iy 6 лет назад

    hello sir, i liked your video.I am also working in xbee s2 module.For providing better controlling of systems can we provide two way communications between co-ordinator and router?

  • @jomephift9420
    @jomephift9420 8 лет назад

    Thank You Paul McWhorter for the great Tutorials!! High quality didactic :) I love to see every mouse-click explained for I`m a newbie still.
    Could you please tell me or do a little vid on plotting data (arduino sensors) real time with gnuplot or sth similar- `cause regretably matplotlib only works with me on PC, but not on RaspPi (Backend issue). But my project calls for sth space-saving so I decided for the RaspPi and set it up so far(I study Technical Engineering).
    I would VERY appreciate that! God bless

  • @ryangarrison7088
    @ryangarrison7088 7 лет назад

    Hi Paul, the code I'm hoping to use this for requires user input using the arduino command serial.ParseInt();
    It uses this user input, which is a user defined percentage value, and then executes the code and sends the data to the serial until specific conditions are met to satisfy if() statements (when the percentage is reached). Then it stops and waits for another user input.
    Is there a way to still do this (graph in real time) but also allow user input in between?

  • @ajayr14
    @ajayr14 8 лет назад

    Hi Paul..
    Thank you so much for your amazing video. I've followed your video and created a live plot with 4 PTC temperature sensors. 2 sensors in one figure and other two in another figure. I am saving the live plot simultaneously. Since I used 4 temperature sensors, I made 4 different arrays like you did. The program is working fine but it looks like it hangs or makes lot of load on the figure after I run it for very long time.. I am not clearing the plotting data like you did because I need to show the exact plot as it is. I need to ask you if array is a good option if I have lots of sensors and have to plot for a very long time?

  • @gustaavomo
    @gustaavomo 6 лет назад

    is there any way to stop the infinite loop when the user wants? If yes, how to save the generated graph up to that moment?

  • @lucasdebritoayres8248
    @lucasdebritoayres8248 8 лет назад

    Thanks Paul !

  • @aradhyamathur7355
    @aradhyamathur7355 9 лет назад

    sir i have been getting some problem lately while interacting with python, the data received in python is going out of sync while there is no problem while using arduino IDE ; another problem is that without exception handling for SerialException i get this error message "device showing readiness to read but returned no data (device disconnected )?"

  • @ElectronicJunkies
    @ElectronicJunkies 10 лет назад

    Sir you are awesome :) Thank you for all the tutorials and the efforts :)

    • @paulmcwhorter
      @paulmcwhorter  10 лет назад +1

      Faraz Bhatti Thanks for the kind words!

    • @ElectronicJunkies
      @ElectronicJunkies 10 лет назад

      You deserve it .. its like impossible to miss out on something when watching your tutorials , i needed to get a project done and your tutorial saved me from alot of googling :D Thanku again !

  • @kirillpushkin
    @kirillpushkin 8 лет назад

    Thank you very much. You are awesome!

  • @9205aidme
    @9205aidme 8 лет назад +2

    Hi Paul, You have the best teaching Technic i have seen, great series. Unfortunately I have got to lesson 11 and have a problem with drawnow it seems. with the following error, even when I have copied and pasted your code. it is if there is a problem with the drawnow library, can you help, I am so close to getting a plot? Thanks :- File "C:\Python27\Lib\site-packages\drawnow\drawnow.py", line 61, in drawnow
    else: plt.draw_all()
    AttributeError: 'module' object has no attribute 'draw_all'

    • @9205aidme
      @9205aidme 8 лет назад

      Hi Paul, I have now seen John_ABB commment, and found the soloution. I read the comments that show where to comment out the 'else: plt.draw_all line on windows. Keep up the great work, you have changed my life!!! Thanks Greg

    • @paulmcwhorter
      @paulmcwhorter  8 лет назад

      Read through the comments, and there are some solutions suggested. As the libraries are updated, if you have a more recent version than what I was using, there could be issues, but there are great solutions suggested in the comment section of this video

    • @ashleycronk454
      @ashleycronk454 8 лет назад

      If you use pycharm, its a super nice and easy environment that has all the packages on que, and you can pick and chose those packages and libraries. I never run into an issue with not having a package or library

  • @farizmuhammad658
    @farizmuhammad658 8 лет назад

    great tutorial video sir. thanks
    do you know how to stream data real time from arduino to web and make a graph from that data ?

  • @carlosespinosa6446
    @carlosespinosa6446 7 лет назад

    Hello, so if I have only temperature how can I make that array into float without the .split? I just want to plot live data for temperature. Thank you

  • @msingh846
    @msingh846 5 лет назад

    SIr , I want to plot in scatter format. So I did plt.scatter().. but this code is not working but it works with plt.plot(). Can you help me out please

  • @headbanger373
    @headbanger373 7 лет назад

    Hey Paul,i am working PIR sensor .how can i show the live plotting with this sensor

  • @shek2994
    @shek2994 7 лет назад

    Suppose If user want to show the values associated with each DOT(sample) plotted instead of looking at Y-axis to know the temperature, how do I do this? or how do I show value for every sample plotted on window?

  • @morgansparkes7074
    @morgansparkes7074 8 лет назад

    Hey +Paul McWhorter , I love your videos! They are very helpful for those such as myself who are new to python. I do however have one question about Matplotlib. Is there any way that I can have two or more graphs pop up to display two or more values that come in over serial? I am using the BME280 sensor and I am trying to visualise both temp and pressure as well as humidity. Thanks so much for these videos!

    • @asmafajraoui343
      @asmafajraoui343 7 лет назад

      hi morgan hope u r having a good day i have the same question and if you can share with me how did u plot different graphes something like subploting i mean thank you

  • @SRGStuff
    @SRGStuff 6 лет назад

    What sample rate were you able to achieve?

  • @AmanNidhi
    @AmanNidhi 9 лет назад

    thank you sir for this awesome tutorial. this video helped me a lot.
    hope to see more tutorial videos from you on data acquisition
    thanks

  • @oneoffmotors4886
    @oneoffmotors4886 8 лет назад

    Please help! getting an error message. ValueError: could not convert string to float: The Temp is: 82.76 degrees F.
    All Code is correct. The Serial Port is working fine, I have been researching for hours. This one really has me stuck!

  • @amitrocks4234
    @amitrocks4234 5 лет назад

    Hello sir , thank you very much for helping me.

  • @Kennerdoll
    @Kennerdoll 3 года назад

    can you increase the width or the figure in live ploting? lets say:
    fig = figsize()
    fig.set_width(10)

  • @aayushsingh9622
    @aayushsingh9622 6 лет назад

    Is there any way to transmit data without connecting usb and displaying it using python?

  • @muhammadtalemand6565
    @muhammadtalemand6565 4 года назад

    Hello sir... Hope You are fine..
    Sir I have a question related to your video..
    Sir I am working on Tkinter where I have made a GUI that displays 3 graphs on canvas in real time.. Sir I faced the problem in uploading continuous data on it.. Kindly help..

  • @hyperconnected9809
    @hyperconnected9809 6 лет назад

    hey paul, I want to display xbee data on my gui(tkinter) can u explain in detail about how I can do it.Thank you

  • @renelomasrodriguez7254
    @renelomasrodriguez7254 8 лет назад

    Hello i have done every tutorial since here but when i compile a messenge apears sayng:
    AttributeError: 'module' object has no attribute 'draw_all'
    i dont know whi y have check again much times, but it continu appearing, could you help me?

  • @liebe6580
    @liebe6580 4 года назад

    I used the program that you write in phyton and do some multitasking but my problem is the data will stop once my Relay module was turned on. I hope you can help me with my problem.🙂🙂🙂

  • @McGavel1
    @McGavel1 7 лет назад

    "imported cereal" :)
    Thanks for the info cool stuff.

  • @chengL10
    @chengL10 3 года назад

    How can i save the values of the arrays in a .txt file or excel?

  • @nileshpatil3108
    @nileshpatil3108 7 лет назад

    hello sir, i have followed you from beginning , but when i tried to check output of temperature and pressure using BMP180 , but on my Arduino IDE Serial Monitor is empty its not showing any output,,,,can you please help me???

  • @aryanjain9877
    @aryanjain9877 7 лет назад

    I want to plot voltage versus cureent and i want to plot as horizontal axis is voltage and vertical axis is current in serial plotter using an arduino. can u tell me plez is it possible, if yes then plez tell how can i plot? if now then can u suggest altrnative way to plot vi charactristics using an arduino???

  • @dilip.rajkumar
    @dilip.rajkumar 6 лет назад

    Can we plot LIVE from IOT data getting updated on a Google spreadsheet ?

  • @yz8302
    @yz8302 5 лет назад

    How to get time stamp on x axis while plotting temp data. Thanks