Using an Arduino with Python LESSON 4: Visual Display of Measured Voltage in Visual Python

Поділитися
Вставка
  • Опубліковано 26 жов 2024

КОМЕНТАРІ • 139

  • @ctonew6155
    @ctonew6155 2 роки тому +3

    This is another great series, am having so much fun learning to program in 3D. For those going out of their minds because you can’t get the animation to the browser because of the package txaio causing errors. Try to use an older autobahn version 20.7.1 and txaio 20.4.1, old laptops had no issues with these files.
    Run the following four commands in a terminal, best of luck:
    pip uninstall autobahn
    pip uninstall txaio
    pip install autobahn==20.7.1
    pip install txaio==20.4.1

  • @MrChrisiscool15
    @MrChrisiscool15 2 роки тому +3

    Hi Paul, the computer setup is looking good. Thanks for all you’ve done!

  • @alfredcalleja450
    @alfredcalleja450 Рік тому +1

    Hi Paul, I did this week's homework last week. Thanks for another great tutorial.

  • @edSabio572
    @edSabio572 2 роки тому +2

    Thanks Paul! Great class. I was able to work out my vpython import and now see the tube object working with the
    Arduino.

  • @marcoreviews
    @marcoreviews 2 роки тому +5

    Happy new year 🎆🎈🎊! May your 2022 be fantastic! Also thanks for your hard work and helpful videos!

  • @cbrombaugh
    @cbrombaugh 2 роки тому

    I did about a C+ job on this homework. Used an arrow which stretched appropriately along a box with tick marks. When entering your solution, I struggled with a frequent intermittent error which occurred on the "...serial.Serial... line and seems to indicate an error opening the com port. After hours of experimenting, I found that moving the time.sleep line above the serial.Serial line and increasing the delay to a ridiculous 8 seconds eliminated the problem. Thanks for presenting these most excellent lessons, Paul!

  • @leeg.1402
    @leeg.1402 2 роки тому +2

    Thanks Paul. Appreciate your time and efforts.

  • @rosellersumonod5975
    @rosellersumonod5975 2 роки тому +6

    Hi Paul! Glad to see you still active in 2022! Had quit Arduino for a while now. Anyhow, God bless you and take care always sir!

  • @jakobgaber6849
    @jakobgaber6849 2 роки тому +1

    I missed your videos sir! You helped me ace high-school arduino programming!!!

  • @fablapp
    @fablapp 2 роки тому +1

    finally managed to find a series I can follow life, although I have to catch up with the visual python lesson. hope to post my solution before the next lesson!

  • @benthompson6118
    @benthompson6118 Рік тому

    I am legend but did use my notes and sketches from taking your Arduino series. But I did build the 3D graphic and made it work awesomely. Thank you for another great series Paul!

  • @EFoxVN
    @EFoxVN Рік тому

    I am legend! 😀Here is what I did. Unfortunately my machine is too old to run Python 3.8 and up (which is needed for VPython), so what I did instead was to create a GUI with a progress bar (using good ol' Tkinter), and as I turn the potensiometer, the progress bar updates accordingly. I trust that is a fair replacement for VPython for this tutorial. I had to use multi-threading to make it work, though.
    Imagine how cool it would be to measure various engineering parameters and displaying them all on a neat screen. That is my ultimate dream.
    No more expensive CompactDAQs needed. 😉
    Blessings

  • @dantamamasbait645
    @dantamamasbait645 2 роки тому +1

    Many thanks Paul my son is waiting for this badly

    • @paulmcwhorter
      @paulmcwhorter  2 роки тому +2

      His patience will be richly rewarded!

  • @kenstephens221
    @kenstephens221 2 роки тому +19

    I did this as homework for the previous lesson. I used A3 instead of A0. Here's my solution: ua-cam.com/video/gg6r3j7huHo/v-deo.html. Thank you Dr. McWhorter for the fun lessons.

  • @edSabio572
    @edSabio572 2 роки тому +3

    Paul, For the problem of 'from vpython import *' I had to use the following commands:
    "py -3.9 -m pip install requests" and then "pip install vpython" now I can see the tube working with
    the Arduino potVal.

  • @RachidRachid-mn9gm
    @RachidRachid-mn9gm 5 місяців тому

    Thanks a lot, best regards from Algeria👋

  • @DeanWebbDeveloper
    @DeanWebbDeveloper 2 роки тому

    You’re my inspiration. I’m even drinking my coffee black now

    • @paulmcwhorter
      @paulmcwhorter  2 роки тому +3

      Mission Accomplished! The world has another ice coffee drinker, which is really the secret agenda behind all of this.

  • @keyboardlearning7552
    @keyboardlearning7552 2 роки тому +1

    I found that instead of a cylinder, I could use a cone as an object to rotate. It's not as neat as others I've seen here, and it could use a scale, and a title. But I expect we'll get to that soon. Many thanks for another great video.

  • @robertmurphree7210
    @robertmurphree7210 2 роки тому +1

    Greetings from Norman Oklahoma!

  • @Sikuq
    @Sikuq 2 роки тому

    Great lesson.. Thanks. Just what I was looking for.

  • @visionsk
    @visionsk 2 роки тому +1

    I tried "cylinder" on my macbook as shown in this lesson.
    My code is exactly the same as what Mr. McWhorter has toward the end of the lesson.
    However, I keep getting an error message, "AttributeError: 'cylinder' object has no attribute 'idx' ".
    Why am I getting this error when the 'idx' attribute is even not part of the code?
    Should I use a slightly different syntax since the example code is for Windows?
    Please, help!

  • @arbab8114
    @arbab8114 2 роки тому

    Gotta love the math. Appreciated

  • @good114
    @good114 2 роки тому +1

    Thank you Sir 🙏🙏🙏🙏😊😊😊

  • @АнтонАндриенко-э2м

    Hi, Paul! Thank you for your lessons. Can you tell me how to measure the voltage for example batteries 0-3.3 volts using Python? Also, measurements must be made with different indicators of NPLC: 1,5,10

  • @warrenscorner
    @warrenscorner 2 роки тому +2

    Hey Paul, looking forward to lesson 4! I’m sad to say that the safe cracker folded up like a cheap lawn chair and did not open the safe. I stopped it after 13000 combinations. I found an old spiral notebook with a note inside with the combination! The first number is 13 and the safe cracker had already gone past that set in the database. I’ve been trying the combination but it still won’t open. I must be using the wrong sequence. I still plan to do a video. I’m finding that to be very difficult. The software I used to do videos with doesn’t seem to work anymore so I need new software. I’m trying iMovie which came with my MacBook. I refuse to fold up on this. I will get it done eventually! If you have any suggestions on video editing software I’m open to suggestions.

    • @paulmcwhorter
      @paulmcwhorter  2 роки тому +2

      On the safe, an important thing is to make sure whether you are supposed to start spinning to the left, or start spinning to the right. A safe will have two different combinations, depending on which direction you start. Second, making sure you are spinning a suitable number of times in the start direction before commencing with the combination. The other thing you mentioned is that you were jumping 3 at a time . . . maybe go back, and just do one at a time. If you found a combination, it should open it, if you are entering the combination properly. These old safes really will open, you just have to have confidence. Maybe see if you can find more info on your make of safe about the unlock sequence. I have found even having the combination can require some fiddling to get it opened.

    • @MattyEngland
      @MattyEngland 2 роки тому

      Det cord 👍

  • @Mayatube3
    @Mayatube3 2 роки тому

    Thanks Paul!

  • @pralaymajumdar1206
    @pralaymajumdar1206 2 роки тому

    Very impressive.. Thank u sir.

  • @edSabio572
    @edSabio572 2 роки тому +1

    Thanks Paul! I did have a problem "Import "vpython" could not be resolved" You are working on VS 3.9 according to your screen,
    Isn't it supposed to work on only 2.t version? If there is another video, I'm supposed to watch, please let me know...

    • @terryterry1655
      @terryterry1655 2 роки тому

      i have the same problem .yet to be resolved

    • @edSabio572
      @edSabio572 2 роки тому

      @@terryterry1655 Terry, this what I did and it worked for me:
      Note: to install vpython if using a 64bit python version, go to viw menu and press terminal. On terminal screen type(all lower case:
      pip install requests vpython
      then:
      pip install vpython

    • @edSabio572
      @edSabio572 2 роки тому

      or see comment below...

  • @starRunnerX
    @starRunnerX 2 роки тому

    I am legend. I finished this while in my electrician apprentice class. Kind of ironic that I made a volt meter there.

  • @sathiyapoobalan2073
    @sathiyapoobalan2073 2 роки тому

    Thanks again for most excellent video...♥️

  • @Nick-xz1qq
    @Nick-xz1qq 2 роки тому

    Good luck and thank you for this awesome videos❤

  • @jasontito7644
    @jasontito7644 2 роки тому

    Paul Mcwhorter rocks

  • @Wythaneye
    @Wythaneye 2 роки тому

    I am legend. Future homework will be posted, I had to skip out this first lesson.

  • @ianhayden2839
    @ianhayden2839 2 роки тому

    You should do a new set of arduino tutorials exept like a follow up to you most recent ones, so like more complicated builds but still explaining the science and math behind them. Also you could use new components in them like a keypad or segment display

  • @timwilliams9100
    @timwilliams9100 2 роки тому

    Got it all running but the Lable i did not get python to recognize the Lable class (the cylinder class worked fine)
    is there something i need to down load?

    • @friedrice71
      @friedrice71 Рік тому

      if you are spelling label as 'lable' then that could be why...

  • @TheLandrast
    @TheLandrast Рік тому

    Come for the code, stay for the math!

  • @kevinmeeker6548
    @kevinmeeker6548 Рік тому

    So much fun!!

    • @kevinmeeker6548
      @kevinmeeker6548 Рік тому

      I forgot to convert to voltage! I’ll get right on it.

  • @wayneswan3092
    @wayneswan3092 2 роки тому +1

    I had no issue at all passing pot data to python and manipulating it to whatever value I desired in python. But for some reason, I'm having issues passing it to vpython. Like I tried making pot value 0-1 and change opacity. But the sphere stayed with old value.
    (Edit) I was over complicating the "sphere.opacity=potOpac"

  • @graham6411
    @graham6411 2 роки тому

    Would it not have been easier and more instructive to show how to convert the base 2 value of the pot which is the same value as found want only in base 10? In my experience, changing bases should be such a common function that programmers can do it in their heads.

  • @ahmedmabrouk9891
    @ahmedmabrouk9891 Рік тому

    i really wish next time you do it with kivy

  • @James-ci5ql
    @James-ci5ql Рік тому

    I was able to get the voltage from the potentiometer followed by " Volts" printed in the Python Terminal, but it did not loop. It only printed the immediate voltage and " Volts"..and that was it. This is what I did.
    Arduino IDE Code:
    1 int potent0 = A0; //Analog pin for Potentiometer//
    2 int readVal; //declaring variable, readVal
    3 float V2; //declaring non-integer value for varrying potentiometer setting//
    4 int dt = 200;
    5 void setup() {
    6 Serial.begin(115200);
    7 pinMode(potent0,INPUT);
    8 }
    9 void loop() {
    10 readVal=analogRead(potent0);
    11 V2=(5./1023.)*readVal;
    12 Serial.print(V2);
    13 Serial.print(",");
    14 Serial.println("Volts");
    15 delay(dt);
    16 }

    Visual Studio Code:
    1. import time
    2. import serial
    3. arduinoData=serial.Serial('com5',115200)
    4. time.sleep(1)
    5. dataPacket=arduinoData.readline()
    6. dataPacket=str(dataPacket,'utf-8')
    7. splitPacket=dataPacket.split(",")
    8. x=splitPacket[0]
    9. y=splitPacket[1]
    10. print(x,y)

    • @James-ci5ql
      @James-ci5ql Рік тому

      when I originally tried to make the loop I forgot indentation after "while True:" for rest of code. Problem solved very soon in video. Correct Python Code:
      1 import time
      2 import serial
      3 arduinoData=serial.Serial('com5',115200)
      4 time.sleep(1)
      5 while True:
      6 while arduinoData.inWaiting==0:
      7 pass
      8 dataPacket=arduinoData.readline()
      9 dataPacket=str(dataPacket,'utf-8')
      10 splitPacket=dataPacket.split(",")
      11 x=splitPacket[0]
      12 y=splitPacket[1]
      13 print(x,y)

  • @batticha462
    @batticha462 Рік тому

    19:04 In lesson 2 you used InWaiting() and in this lesson you use t in_waiting() ? .

    • @paulmcwhorter
      @paulmcwhorter  Рік тому

      Isnt it the difference between being on the arduino vs. python side?

    • @batticha462
      @batticha462 Рік тому

      ​@@paulmcwhorter Thank you for everything. Sorry I was mistake. The inWaiting function was used in lesson 3 and the in_waiting in this lesson and both lessons are dealing with the same subject, Arduino and Python :)

  • @unveil7762
    @unveil7762 2 роки тому

    this is will be my Van Ui!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 😘

  • @petervandylian2486
    @petervandylian2486 2 роки тому

    lol, no worry I made the same typo as you did for "arduino" 😆 I guess I am not alone

  • @lokey2100
    @lokey2100 2 роки тому

    My set up does everything until the visual part. I only get a blank page. What os Wrong? I guess my python days are over unless I find out what the problem is. Must be in my computer or browser settings

    • @paulmcwhorter
      @paulmcwhorter  2 роки тому

      Probably something with your browser settings. It is hard for me to say because there are so many different systems you might be running on, and your security settings might prevent a script from showing in a browser. I really dont know what to suggest.

  • @MakiHaruko231
    @MakiHaruko231 2 роки тому

    THANK YOU!!!

  • @steveholt8991
    @steveholt8991 3 місяці тому

    I did it but I just used a simple arrow and it doesn't look all that slick. Can someone point me to a lesson on uploading stuff to youTube?

  • @fnuker4002
    @fnuker4002 2 роки тому

    Hello Paul, thanks for amazing lessons, you are LEGEND. but i have a problem with this error
    dataPacket = int(dataPacket)
    ValueError: invalid literal for int() with base 10: ''
    Can any1 help please?
    Cheers and thank you :)

    • @ellerycadel
      @ellerycadel 2 роки тому

      I am having the same problem but only once when I first start the program. The next time I run it and every time after that, it runs fine. No idea the issue.

  • @prot0form775
    @prot0form775 2 роки тому

    This is some violence against walmart lunch chairs.

  • @pylogik
    @pylogik 2 роки тому

    Well, it appears that I may be a cheap lawn chair. Here is my submission. That being said, just because its folded doesn't mean its junk. It could've been set up improperly by the user. Jokes to the side. Thanks Paul. (edit) almost forgot the link to my homework; ua-cam.com/video/Rj3faSty3gM/v-deo.html.

  • @captaineverythingfun52
    @captaineverythingfun52 2 роки тому

    I am legend. Video coming soon. Btw I don't know how to do vpython yet

  • @daviddirac5942
    @daviddirac5942 2 роки тому

    I am legend. I have an analog voltmeter which also has a digital readout to 2 decimal place.

  • @arnaudmasse7839
    @arnaudmasse7839 Рік тому

    i am legend!

  • @only_yashasv
    @only_yashasv Рік тому

    I am a real legend

  • @kevindsouza-vl1ze
    @kevindsouza-vl1ze Рік тому

    please look up to this problem :
    ValueError: invalid literal for int() with base 10: ''
    i am getting this error
    import time
    import serial
    from vpython import *
    import numpy as np
    arduinodata=serial.Serial('com11', 115200)
    meter=cylinder(color=color.red ,length=1 , raduis=1 , pos=vector(0,0,0) , axis=vector(0,0,1) )
    m1=box(length=2 , width=1 , height=1 , pos=vector(0,-0.5,0.6), color=color.black)
    time.sleep(1)
    while True:
    while (arduinodata.inWaiting()==0):
    pass
    wt=arduinodata.readline()
    wt=str(wt,'utf-8')
    wt=wt.strip('
    ')
    wt=int(wt)
    print(wt)

  • @wendygrant2735
    @wendygrant2735 2 роки тому

    I'm legend.👍

  • @shndiganshndi1363
    @shndiganshndi1363 Рік тому

    i think watching this tutorial after finishing arduino tutorial is too hard for me because i cant do python.
    the homework you give, needs too many python code knowledge
    maybe i should watch your AI tutorial?

    • @paulmcwhorter
      @paulmcwhorter  Рік тому

      REally, I am teaching Python as we go. Did you watch the earlier lessons in this series? If this is going to fast, go back and watch my python class on another playlist on this channel

  • @colepdx187
    @colepdx187 2 роки тому

    My solution to the assigned exercise: ua-cam.com/video/d-37vWWzsBM/v-deo.html

    • @paulmcwhorter
      @paulmcwhorter  2 роки тому +1

      Nice Job! Very realistic volt meter. Excellent

  • @parthib.1555
    @parthib.1555 Рік тому +1

    I am Legend

    • @paulmcwhorter
      @paulmcwhorter  Рік тому

      it said it may cause a short circuit and potential damage

  • @theblackariel5957
    @theblackariel5957 2 роки тому

    I am a legennnnnnnnnnddddd. ;D

  • @VeryUsMumblings
    @VeryUsMumblings 2 роки тому +1

    Homework built partially from old code: ua-cam.com/video/VbqoJfQ-8fk/v-deo.html

  • @johnplowright6421
    @johnplowright6421 2 роки тому

    Oh. The homework is what I did for last week, I have improved my code to sweep the pointer when getting new readings from the Arduino, I also added a digital display but think I should have used a different colour as the red is no easy to see in the video, learnt how to screen capture as well rather than my normal wobbly phone video.
    ua-cam.com/video/ibYHKnpgFQs/v-deo.html

  • @trogdorandfriends
    @trogdorandfriends 2 роки тому +1

    My homework for this week is at ua-cam.com/video/iiTMipekw-I/v-deo.html
    Looking forward to the next lesson.

  • @bigbogeyface
    @bigbogeyface 2 роки тому +4

    Here's my homework:
    ua-cam.com/video/BbbJqw-UiGg/v-deo.html 👍

  • @KokoMechE
    @KokoMechE 10 місяців тому

    I am legend

  • @robertmurphree7210
    @robertmurphree7210 2 роки тому

    Robert Murphree the code is clunky, vpython extension arc background dial scale too much work.
    Here is my submission

    • @robertmurphree7210
      @robertmurphree7210 2 роки тому

      my submission ua-cam.com/video/YrEGBdBXmg0/v-deo.html

    • @paulmcwhorter
      @paulmcwhorter  2 роки тому

      Looks good. Yes, think about the problem and see if you can get the needle going the right direction.

  • @philluvschips3787
    @philluvschips3787 7 місяців тому

    Hmmm, my Arduino Serial monitor is showing 1.12, 3.14 etc etc, but parsed data is 1.0, 2.0, 3.0, 4.0 I couldn't seem to get the whole float to come over, so I'm claiming a partial grade.
    ua-cam.com/video/7TRbk511uV4/v-deo.html

  • @fearlesshandle
    @fearlesshandle 7 місяців тому

    i am not able to complete my homework becoz i don't have arduino yet

  • @rorderuiter
    @rorderuiter 8 місяців тому

    This is my solution to the voltmeter: ua-cam.com/video/j93ZtJUtjZw/v-deo.html

  • @limegreentechnologies8803
    @limegreentechnologies8803 2 роки тому +1

    ua-cam.com/video/xHBrytvDOVQ/v-deo.html
    Heres my homework solution, sorry for it being a bit late as i had a lot of schoolwork this week, thanks really much once again

  • @jabber2824
    @jabber2824 3 місяці тому

    I AM LEGEND: ua-cam.com/video/EODI1mMhXj4/v-deo.html. Great lesson. i'm currently running python 3.12.4 and vpython runs without any modifications or tricks.

  • @wolfram9669
    @wolfram9669 2 роки тому

    Thank you Paul!

  • @ellerycadel
    @ellerycadel 2 роки тому

    i am legend!

  • @patfacunla1687
    @patfacunla1687 2 роки тому

    I am legend

  • @peterkarlsson7801
    @peterkarlsson7801 2 роки тому

    I am legend