Raspberry Pi Pico: Inputs & Servo Control

Поделиться
HTML-код
  • Опубликовано: 6 июл 2024
  • Raspberry Pi Pico MicroPython tutorial using a switch, a potentiometer, some LEDs, and an SG90 servo. This video is a direct continuation of my earlier Pi Pico episode: • Raspberry Pi Pico
    All of the code and wiring diagrams included in this video can be accessed from: www.explainingcomputers.com/p...
    You may also be interested in my other project videos, such as the Raspberry Pi Anemometer: • Raspberry Pi Anemomete...
    More videos on SBCs and wider computing and related topics can be found at:
    / explainingcomputers
    You may also like my ExplainingTheFuture channel at: / explainingthefuture
    Chapters:
    00:00 Introduction
    00:42 Back in Action (recap)
    04:15 Switched On (using switches)
    07:20 Great Potential (potentiometer)
    10:19 Servo Control
    13:54 Servo & Pot
    16:33 The Future
    #PiPico #RaspberryPi #Servo #ExplainingComputers
  • НаукаНаука

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

  • @Ratchet_effect
    @Ratchet_effect 3 года назад +68

    Ah Chris the Pico has a lot of potential for young ones & us older humans. I like how you mix the practical/coding into an episode & make it enjoyable for all ages.

    • @dang48
      @dang48 2 года назад +1

      Exactly. These videos have been a big help in my classes and I'm still tinkering with my Pi and the Tiny2040 (little cousin to the Pico).

  • @laurieinjapan
    @laurieinjapan 2 года назад +3

    I spotted a Raspberry Pi pico at my local electronics shop. I'm going to use one to make a puzzle box. Thank you for your excellent explanation.

  • @PS_Tube
    @PS_Tube 3 года назад +30

    Pi Pico in action with our old friend servo from the hamster feeder... Another amazing EC Sunday !

  • @perrymcclusky4695
    @perrymcclusky4695 3 года назад +16

    The Raspberry Pi Pico is more interesting then I first thought. Looking forward to your next video!

    • @ExplainingComputers
      @ExplainingComputers  3 года назад +4

      Hi Perry, there is a lot of potential in this tiny and low-cost little Pi.

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

      There so cheap and affordable which makes them very worthy too

  • @paullandry6573
    @paullandry6573 3 года назад +38

    17 minutes has gone by in a flash an I still want more! Thank you for another fun and educational video (as always)

  • @pixadordelterrat2725
    @pixadordelterrat2725 3 года назад +68

    Zebras and giraffes, virtual puppeteering... This video is both hilarious and educational at the same time. I can't believe it's 17 minutes long, it felt so short!

    • @snoopstp4189
      @snoopstp4189 3 года назад +2

      Chris only has 3/4 of a million subs, his channel is basically the best kept secret on the interwebs.

  • @iHawke
    @iHawke 3 года назад +5

    Coincidentally enough, this is something I have been looking for a while now

  • @MicroProjects
    @MicroProjects 3 года назад +2

    This is the thing that i have been looking for a while

  • @lesliedeana5142
    @lesliedeana5142 3 года назад +17

    I've been waiting for this. I've bought 2 already!

    • @ExplainingComputers
      @ExplainingComputers  3 года назад +8

      I think Pi Picos are kind of an addiction!

    • @EcoHamletsUK
      @EcoHamletsUK 3 года назад +9

      I've got 7 so far! Plus a couple of Pimoroni Tiny 2040. Along with loads of Arduino Unos, Nanos, Megas and Pro Minis, and a few ESP32s, ESP8266s and Seeeduino Xaios. Buying one microcontroller is the start of a very slippery slope!!!!

  • @georgenadar9977
    @georgenadar9977 2 года назад +1

    pls make more of such videos on raspberry pi pico.. All the videos from your channel are awesome

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

    Another great video for those of us who are not truly computer savvy. You make the coding seem so simple and enjoyable. This inspires me to tear down old electronics, raid the parts store of its switch inventory, pull out a soldering iron, and buy a herd of Picos for the different joints of a few intended puppeteering projects. Nice work. Thanks!

  • @TradieTrev
    @TradieTrev 3 года назад +7

    MicroPython is awesome! It brings back the ease of coding similar to the likes of Basic with an interaction of the real world!

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

    Nice Video, picked up a couple picos and now waiting for a few rainy days to play with these

  • @fred.chapman
    @fred.chapman 2 года назад +1

    Very nicely done, Chris! I like how you explain both hardware and software so we get a complete understanding of the whole system. Enabling the internal pull-down resister for the open switch is a particularly nice touch! Managing the LED pin assignments with a list simplifies the `while` loop in your Python code dramatically.

  • @antoniuskelvinkurniawan
    @antoniuskelvinkurniawan 3 года назад +10

    I like how you programmed the raspberry pi pico on a raspberry pi 400. Free from x86 system!

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

    Simple and clear, makes programming accessible to everyone. Brilliant channel.

  • @MicrobyteAlan
    @MicrobyteAlan 3 года назад +6

    More information for my garden railroad. Interesting and well presented, Thanks

    • @Reziac
      @Reziac 3 года назад +2

      Ooooh. I like that idea!!

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

    Chris I'm so happy you did this video. I think you're the only person I know who has done a demo without just flashing the LED. My mind immediately went to, how supplement the code to stop the jittering...😊...I was totally enthralled. Maybe round the value before passing it to the servo. 😉 Love the videos as always.

  • @BryanBenoit
    @BryanBenoit 3 года назад +4

    Nice video explaining what we can do with those Raspberry Pi Picos and some Python code. Thanks Mr Barnatt !

  • @hidden_vault
    @hidden_vault 3 года назад +2

    This series is awesome I'm glad other ppl are loving it too. thankyou much blessings.

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

    Hi Chris, how’s thing in the UK?
    Today’s video is going to be a hit for the new programmers of all ages. Easy to follow instructions , and good project ideas.
    Time for me to head over to my work bench and get started. See you next weekend.

  • @ShadowzGSD
    @ShadowzGSD 3 года назад +5

    No biscuits today but at least i have coffee to watch the video of the week. ☕

  • @loginregional
    @loginregional 3 года назад +8

    I hope Mr Scissors and Stanley are fine and aren't jealous of Pico & Servo (the dynamic duo)

  • @perseus25xd
    @perseus25xd 3 года назад +6

    Thank you sir! I was eagerly waiting for more pico related content!

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

    It was nice to finally meet Mr. Pot.

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

    Excellent work. Pixador’s comment had me fast forwarding to spot the Zebra! Anyway you showed all the basics of input and output - both digital and analog(ue). My Pico starter kit arrived on Friday so tomorrow I’m off to the shed. It was also useful showing how you connect up to the Pi 400 as it helps to get started.

  • @JediBuddhist
    @JediBuddhist 3 года назад +3

    Hahahaaa.. Zebras & Giraffes.. you're mad as a box of frogs 😄👌 That's why your content is complete Gold-Dust. For me and the kids I work with. Got our Picos 2day.
    Thanks a million Christopher 🙏✨

  • @rogerkoh1979
    @rogerkoh1979 3 года назад +2

    Another nice video. Great to show basic control to people. Thank you again for sharing.

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

    Brilliant introduction to micropython and programming with the Pico! Really excited for my Picos to arrive in a few weeks, it’s a far cry from my assembly code days with the 8051.

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

    Thanks again Chris, always looking forward to your videos, very informative and useful information brought to us in the usual colourful manner we like.

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

    4:20 Christopher dismantled radios when he was 12. Colour me surprised. 😜 Another quality video, thanks.

  • @Techmagus76
    @Techmagus76 3 года назад +3

    What i liked the most are the sounds that supports the visual effects of the LEDs after pressing the switch, even if my limited python abilities prevented me from identifying it in the code base.

  • @johndeluca230
    @johndeluca230 2 года назад +1

    Thanks for your videos. I have enjoyed them for a while.
    Vintage pot and vintage breadboard (like many I own) with a dignified aged cream color from the original white.

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

    Great video as always Chris. Thank you.
    I'm currently working with the Pico's little cousin, the Tiny 2040 and am trying out the coding that you explained in this video. I played around with it as well and had some fun with it. Didn't have a servo motor handy but that's okay. Will be getting one at a later time.
    Thanks for these videos. They're a great help and hoping you get a Tiny2040 for future videos.

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

    Very educational! Nice change to the usual SBC-stuff! This stuff encourages me to learn & experiment a bit with the pico and RPi sbc's. Keep up the good work!
    Regards,
    Willem

  • @computerchaot9891
    @computerchaot9891 3 года назад +12

    I would love to see some experiments with
    FreeRTOS and the Pi Pico

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

    The Pico looks like it's so much fun. I look forward to it making another appearance in the future!

  • @PeteVanDemark
    @PeteVanDemark 3 года назад +2

    Very well done. This is my favorite EC video of 2021-so far! My RP Pico order just arrived and I can’t wait to try these myself! Bravo!

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

      Sounds like you have some experimenting to do! :) Good luck with it.

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

      @@ExplainingComputers Definitely! Thanks!

  • @timmurphy5541
    @timmurphy5541 3 года назад +3

    Love this. İt's a perfect introduction to the kinds of things one imagines doing with a Pico. I did a show and tell video last week at work about the Pico but I should just have played this :)

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

    Good job! You just demonstrated common problem with potentiometers... they decay with age and add noise but even new ones do that. Thats why audiophile way is to replace it with ladder resistor switch.. but for your project all you need is a small capacitor in paralell across potentiometer mid and side pin and current limiting resistor in series to the gpio pin.. that would remove high frequency noise.

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

    Thank you for making Sundays fun again!

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

    Smashing. I particularly like the pot controlling the servo, to turn a tuning capacitor in a magnetic loop antenna.

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

    Informative and very well timed, I'm learning and experimenting at the moment with controlling a matrix of LEDs with the ultimate aim of making a unique animated clock. You gave some handy programming tips, especially controlling i/o from an array.

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

    Thanks Chris. Looking forward to PiPico projects.

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

    The magic of film making is so powerful, I am in awe 😍

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

    I love your videos. So clearly explained.

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

    Great video, very concise explanation, great reference. I love the Pico!

  • @srtcsb
    @srtcsb 3 года назад +3

    Explaining Computers... Now complete with lights, sound effects, lions, tigers and giraffes, oh my! :-) Really good fun Chris, and great code and hardware hook up examples too. Thanks for another great video.

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

    This is why we Open RUclips 😃👍

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

    your explnations are so clear and right to the point, even with your accent. Two thumbs up I just subscribed .

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

    Another amazing video Chris. Thank you and keep up the great work!!

  • @Colin_Ames
    @Colin_Ames 3 года назад +3

    Very interesting and educational, as always.

  • @FamilyGrob
    @FamilyGrob Год назад +2

    Thanks! Fantastic explanation and demonstration!

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

    Like your programing details, you would be a good teacher!

  • @valomestari
    @valomestari 2 года назад +1

    This was exactly what I was looking for! Thank you, sir!

  • @HoboVibingToMusic
    @HoboVibingToMusic 3 года назад +2

    I'm getting a Pi3B+ Soon, so I can tinker around with the GPIO ports, gonna watch those GPIO /Pi vids from your channel a lot now!

  • @carlosquijano1461
    @carlosquijano1461 2 года назад +2

    Very good professor. I enjoyed this so much. I like the comments and explanations of the code along with the diagrams. Superb

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

    Another fantastic video Sir thank you very much.

  • @richardneifeld7797
    @richardneifeld7797 Год назад +1

    Another option that ***might*** reduce the jitter is to heat, or cool, or change the relative humidity, near the Pot. The jitter is presumably caused by intermittent connection to various windings in the Pot. Temperature change will affect the relative dimensions, through thermal expansion, and humidity affects accumulation of static charge on insulating surfaces near the contact regions. Great video!

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

    Another gem of a video, sir. Keep em comin

  • @NickCornaglia
    @NickCornaglia 2 года назад +1

    Your sense of humor kills me!!!

  • @GizmoFromPizmo
    @GizmoFromPizmo 3 года назад +2

    Back in the 1990s, when I worked for an industrial controls company, I learned about servos and something called a "dead zone". Programming in a Dead Zone eliminates jitter. So it really has nothing to do with your potentiometer, instead, it is the nature of servos. It's amazing to me to see you using $200 worth of hardware that can replace a Programmable Logic Controller (PLC), that back in the '90s, cost tens of thousands of dollars.

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

      Those PLCs were a bit of a rip off. They were just 8 bit micro controllers with some inputs and outputs and a simplified programming language. Late '80's through the '90's we would do the same thing with a Z80 and some code written in C. The advantage of a PLC was the electrician could program it.

    • @GizmoFromPizmo
      @GizmoFromPizmo Год назад +1

      @@wayland7150 - Ladder Logic was cryptic as heck. PLCs were a rip off but well worth it to the companies who needed such a thing.

  • @Hulker69
    @Hulker69 3 года назад +2

    Great video Chris, as always. I now use CircuitPython on any microcontroller that supports it. I moved away from raw MicroPython except on something like an ESP32 that doesn't support CircuitPython. On the Raspberry Pi RP2040 chip boards there is a great PIOASM assembler that can run out of the box via CircuitPython. The latest version of Thonny does a very good job using MicroPython and CircuitPython boards.

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

    As always absolutely excellent!! Many thanks.

  • @tonyross2947
    @tonyross2947 2 года назад +1

    Awesome, Chris...awesome. Thank you so much for this video.

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

    Very good explanation!

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

    As always another great video, and thanks for the information.
    It sure beats working on the servos on my old US Navy ship.😀

  • @wanyman
    @wanyman 2 года назад +1

    Brilliant video. Thanks!

  • @SirSurreal
    @SirSurreal 9 месяцев назад

    Great video, a lot happing for such few lines of code. I'm new to the Pico so I've binged a lot of videos on the Pico! One problem I had with the SG90 was it going beyond the 180 degree mark which resulted in it shaking and heating up. After adding and displaying the 'value' variable to make it visible in the shell, I could find the value that took the servo beyond the 180 and created an if statement to limit the range of the value. It did work, although there was a region of the pot that didn't work. Will study PWM and Duty cycle for a deeper understanding of the code.

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

    Nice video. Love micro controllers.

  • @olafschermann1592
    @olafschermann1592 Год назад +1

    12:00 well bred: good documented code as we learned it old school.

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

    Great video as always, thanks Chris

  • @horseradishpower9947
    @horseradishpower9947 3 года назад +2

    This was interesting. Thanks for the video.

  • @SomeOne-rh5so
    @SomeOne-rh5so 3 года назад +2

    Very very nice - I feel jealous, that already not young, It's so helpful for all who likes electronic.
    PS Chris - you are ready to make your own HVAC DDC for your home.

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

    Chris great tutorial! Just what I needed to help me get the basics down so I can complete a project that I have been working on. Once again, Thank you!!!!

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

    Thanks Chris. Good old school carbon potentiometers. They give free snap crackle on pop on my old valve (tube) wireless.

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

    Great tutorial. I just ordered a few of these. I'm looking to do things with BLE or LoRa.

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

    I had a pico and servo lying around. Was thinking to use an ESP32 for the motors but this is great. Thanks for the video :D

  • @KarinaBelan
    @KarinaBelan 3 года назад +2

    Very nice video, thank you

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

    Awesome, loved it 👍🏻👍🏻👍🏻👍🏻👍🏻
    A few more please 🙏🏻

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

    Nice! You can clearly see that the potentiometer is of the logarithmic type ;)

  • @mcconkeyb
    @mcconkeyb 3 года назад +3

    Good stuff. Reminds me of learning electronics back in the 1980's. The devices were bigger and a lot less integrated, but with a couple of dozen chips we could do the same thing. :-)

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

    Thanks you sir for your excellent tutorial

  • @glennsgrainger
    @glennsgrainger 3 года назад +2

    Your a great teacher. Very cool

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

    Another great lesson, thanks!

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

    very nice video
    i obtained new imaginations while i watch this video

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

    Another great video! Thank you...

  • @PU7MZD
    @PU7MZD 3 года назад +17

    The dithering can be fixed using a simple closed loop controlling approach. That would be a very good introductory example to Control Theory using the Pico.

    • @marksterling8286
      @marksterling8286 3 года назад +3

      I wondered if you did some rounding on the pot results say nearest 10 would take out the dithering but without loosing any accuracy

    • @adymode
      @adymode 3 года назад +5

      simple_smoothed_value = simple_smoothed_value * 0.9 + lastest_value * 0.1

    • @llpBR
      @llpBR 3 года назад +3

      I would try to divide it by 100 and truncate the result.

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

      @@marksterling8286 losing.......loosing...........we know by now how autocorrect sometimes makes our text somewhat inaccurate, so it is worth checking before posting. You may be very experienced in giving commands to computers , so will appreciate accuracy in coding.

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

      You should always place a small (10nF) capacitor on ADC inputs to micros to give something to charge up and dominate the internal sample and hold circuit capacitance. What you get is the result seen here if you don't.

  • @Anonopsmo
    @Anonopsmo 3 года назад +3

    very interesting stuff, thank you for filming that, christopher. =)

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

    Pi Pico automated control awesome sauce.

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

    This could headline a "demystifying servos" playlist! Also, mad props for the efficient code: I'm about to jump ship from the HMS C++ to the HMS Python. Thanks for another great video!

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

      It would be a very short playlist unless you started getting into more complex servos like ones with higher accuracy, force feedback etc.

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

    Relaxciting as always. I'd be curious to know how best to dampen the jitter in software.

  • @thehoneyseals
    @thehoneyseals Год назад +1

    I love this channel so much

  • @hxhdfjifzirstc894
    @hxhdfjifzirstc894 3 года назад +2

    I added this video to 7 of my playlists (LOL). I guess it applies to many of my interests.

  • @TheTechieScientist
    @TheTechieScientist 3 года назад +3

    Great video !

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

    Thanks Chris, love the videos on the pico.
    It’s fired up my interest in microcontroller projects again 👍.
    You did inputs and now outputs, what’s next?

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

    Great video on the Pi Pico... love the code and applications. Your old wire wound potentiometer is potentially causing the jitter in values... maybe time for a potential upgrade.

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

    Love your work sir

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

    This is the first time I'm seeing one of your video's. Wow! you are really good and the video was immensely helpful. Thanks :)

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

    Beautifully explained sir... i have seen some of your tutorials and they are well explained. I have subscribed your channel. Teach us more..😊👍🏻👍🏻