Raspberry Pi GPIO - Getting Started with gpiozero

  Рет қаралды 435,052

DroneBot Workshop

DroneBot Workshop

Күн бұрын

Learn to use the Raspberry Pi GPIO connector and the gpiozero library to interface with an LED and some switches. We’ll even make a very simple camera and have our Pi take a selfie!
Article with code samples: dronebotworkshop.com/raspberr...
More articles and tutorials: dronebotworkshop.com
Join the conversation on the forum: forum.dronebotworkshop.com
Subscribe to the newsletter and stay in touch: dronebotworkshop.com/subscribe/
The GPIO (General Purpose Input/Output) is a 40-pin connector on every modern Raspberry Pi board that allows you to expand your Pi and connect it to external sensors, drivers and displays. And today we’ll start from scratch and see how easy it is to interface simple devices to the GPIO and control them with Python, using the gpiozero library.
When we need to interface with sensors, displays or motor drivers we generally use an Arduino, but there are several advantages to using a powerful microcomputer like a Raspberry Pi. With its increased processing power, large storage and memory and ability to interface with the Internet and Bluetooth it can add a new level of power to our projects.
The 10-dollar Raspberry Pi Zero W is a viable replacement for an Arduino board, and it's the Raspberry Pi that I’ll be using in today's demonstrations. In fact, everything I demo today could have easily been run on a 5-dollar Raspberry Pi Zero, as we don’t need the networking or Bluetooth capabilities.
We’ll keep it simple today and only interface with an LED and a couple of pushbutton switches. Just so you can get a good feel for how easy it is to code for the GPIO, thanks to the power of the gpiozero library.
To make it interesting the final demos will also use the Raspberry Pi Camera, and we’ll build a functional digital camera with only a few lines of code. Try that with an Arduino!
Here is the table of contents for this rather long video:
00:00 - Introduction
01:45 - Pi vs Arduino
06:35 - Selecting a Raspberry Pi
10:28 - GPIO Prototyping Accessories
15:41 - Raspberry Pi GPIO
19:51 - gpiozero Library
21:23 - Hooking up to the GPIO
22:51 - Setting up the Raspberry Pi
25:00 - Blink Compare (Arduino vs Pi)
33:14 - LED and Button Experiments
40:17 - Hooking up the Camera Experiment
41:20 - Controlling the Camera
While today's demos are extremely simple they will pave the way to doing more complex things with the GPIO, and I’ll be doing that in future videos. Make sure you’re subscribed to the channel so that you don’t miss those!
And keep in mind that the Raspberry Pi GPIO has been unofficially adopted by many SBC (Single Board Computer) manufacturers, so learning to interface to the Pi will also open the doors to working with several other platforms.
BTW, for those who make it through this long video, there is a short “blooper” at the end!
Enjoy the video!

Пікірлер: 241
@sophianekhalfouni5004
@sophianekhalfouni5004 Жыл бұрын
I just wanted to express my gratitude for the quality of your courses. You are doing an excellent job, sir! Please keep doing well. Thanks again. 😊
@larrygj4764
@larrygj4764 3 жыл бұрын
Thank you for such thoroughness and clarity. Much useful stuff packed in here!
@scottburfoot3930
@scottburfoot3930 3 жыл бұрын
Dronebot, you inspire me to learn this stuff in the best way possible. So detailed, yet so precise with only the most important information displayed. Cant wait to see you introduce openCV to the 5dof robot arm
@shingabiss
@shingabiss Жыл бұрын
in my opinion, your have THE BEST videos! Delivery pace perfect, clarity perfect, friendliness perfect!
@raymondmichael4987
@raymondmichael4987 4 жыл бұрын
I really like how do your presentation, very impressive. I'm going full on Raspberry Pi now; keep them coming. Greetings from Tanzania 🇹🇿
@brebre3582
@brebre3582 4 жыл бұрын
Loved your video instantly sir. One of the best explanations of Pi anywhere on the Internet. You have the pace and patience of a seasoned teacher. Kudos to you and thank you. Subscribe done!
@rondlh20
@rondlh20 4 жыл бұрын
Amazing job again, very interesting and educational
@soky157
@soky157 4 жыл бұрын
You make everything so clear and easy to understand. Thank you.
@JakeThomasCreative
@JakeThomasCreative 3 жыл бұрын
Detailed yet engaging! Thank you once again.
@paulaxford6754
@paulaxford6754 4 жыл бұрын
Great video! Even with Arduino and Python experience I learned a lot from that, specifically that GPIO can be shared among Python programs.
@norbertbans
@norbertbans 3 жыл бұрын
Cool, I like the small scene at the end with the mixed up PI‘s!!! Keep doing more of those well explained clips!
@victorkarthik8135
@victorkarthik8135 2 жыл бұрын
Great job providing all I need to get start with Raspberry Pi. It was nice comparison with Arduino. It gives a good understanding between microcontroller and Single Board Computer. Keep up the good work. Thanks!
@paullee107
@paullee107 3 жыл бұрын
I commented earlier; sir, you have THE BEST Arduino & RPi videos for beginner & intermediate users -- The best channel, that I will support and market. TY!
@chuckmuckamuck8001
@chuckmuckamuck8001 3 жыл бұрын
I've recently taken up this hobby and this my new favorite channel. Thanks!
@abegafouda9136
@abegafouda9136 2 жыл бұрын
Hé hé ! Incredible! God-sent man! You are answering all the questions I have in mind! I have been offered a Raspberry Pi 4 by my only real friend in the world. Bought yesterday, not yet sent. Am in Cameroon, he is in Europe... And the 1st video as I open KZfaq is this one, created by whom? You, one of the best, with clear, concise, comprehensive explanations ever. Thank you.
@bawadanieldangema1146
@bawadanieldangema1146 10 ай бұрын
You make learning embedded systems so easy and fun. Thank you Sir 😊
@ggattsr
@ggattsr 4 жыл бұрын
Best video comparison on the features and functionally of the Pi and Arduino that I have found on KZfaq. Thanks for the info.
@Michael-1205
@Michael-1205 4 жыл бұрын
Awesome, very concise and easy to watch presentation. I thought Python was something to be afraid of but your presentation has just changed my mind. Thank you!
@idris7464
@idris7464 2 жыл бұрын
Micheal python is easy it is not C++😁
@kingofhavila9850
@kingofhavila9850 2 жыл бұрын
@@idris7464 I'm struggling to learn it 😪 😩
@BigDogMoya1
@BigDogMoya1 3 жыл бұрын
Thank you so much! You're an amazing teacher.
@ShuMO99
@ShuMO99 3 жыл бұрын
that was awesome. I really needed this level of information fed at this pace. Looking forward to watching many more. thank you!
@dave-in-nj9393
@dave-in-nj9393 4 жыл бұрын
This is a good video and you cover things in detail. Since it is a RPi video, it is focused on that and you do a good job.
@antonnym214
@antonnym214 4 жыл бұрын
Outstanding video! Very interesting and informative. I really like your relaxed tone. Super easy-going, which is great. I have a Pi 2B and not doing much with it. just wrote a few programs to the display. more or less a screensaver, but have my eye on a new Pi4 (maybe for my birthday) so I can enjoy it with wifi. That model really impresses me, because it's virtually a desktop computer replacement. All good wishes, sir!
@petermolnar6017
@petermolnar6017 2 жыл бұрын
As always, clear and to the point! Thank you for sharing this!
@ar.mamunhossain9592
@ar.mamunhossain9592 4 жыл бұрын
Great!. Thank you sir!. We are expecting more video on this topic.
@robertdouville74
@robertdouville74 4 жыл бұрын
Loved it, thanks, very well done and informative!
@AnthonyFournier
@AnthonyFournier 2 жыл бұрын
I'd love more content like this. You have such a wonderful way of explaining things, I'd watch tutorial's of any kind.
@sampreechar5368
@sampreechar5368 4 жыл бұрын
Wow, Awsome!!! very professional, VDO, Sound. Well put together. Thanks a million.
@grand.pitcher
@grand.pitcher 4 жыл бұрын
Fantastic, you did very useful and great job. Thank you so much!
@NewAgeDIY
@NewAgeDIY 4 жыл бұрын
Great video today! Can’t wait until the next one. You will of course need to update your shopping channel and add a “ I love my Raspberry Pi” T-shirt😘
@Meine_Rede
@Meine_Rede Жыл бұрын
This is perfectly explained. Short and clear! Thanks a bunch.😄
@DavidVine-DOCVIDPRO
@DavidVine-DOCVIDPRO 3 жыл бұрын
Wow! What a great workshop. Super organization too!
@davidlira8853
@davidlira8853 2 жыл бұрын
your back wall is so organized! awesome
@goldenpacificmedia
@goldenpacificmedia 2 жыл бұрын
Thank you for your terrific lesson and teaching.
@abusultanfahad2789
@abusultanfahad2789 2 жыл бұрын
Excellent simple clear explanation thanks.
@robertpendergast2620
@robertpendergast2620 4 жыл бұрын
Clear and detailed. Thanks.
@Perspectologist
@Perspectologist 4 жыл бұрын
There are many different Arduino IDE compatible microcontrollers now. I was late to the Arduino world. I got started with the BASIC Stamp and their Javelin board. I bought one genuine Arduino Uno to help support their effort. It was much slower, less capable and more expensive than other options. I’ve rarely used it. I’ve mostly been using the ESP 8266, ESP32 and ATSAMD boards. The newer Arduino boards may help them to be more competitive. Certainly the Arduino Uno is a great tool for some things, I just mostly skipped over it due to when I got into this hobby. These days I’m also getting away from the Arduino IDE, and using Platform IO. I’m open to trying the new Arduino Pro IDE when it is further along. I need project settings.
@Hitmonkey420
@Hitmonkey420 3 жыл бұрын
What a workshop! Lookin pretty sharp, I'm jealous
@lollllloro
@lollllloro 4 жыл бұрын
Hi! I believe there is a mistake on the slide at 3:48 A byte (B) usually means an octet [eight bits (b)] and computer memory and storage size is usually expressed in bytes instead of bits. As far as I know after searching online, the RAM and SRAM size units in the slide should have been [kB, MB, GB] instead of [kb, Mb, Gb] For example, the ATmega328 has 2 kB (16 kb) SRAM and 32 kB (256 kb) flash memory. The number etched on the top of SRAM and flash chips is usually in bits, though, and so are transfer speeds. I really like your videos, keep up the good work! :)
@EvileDik
@EvileDik 4 жыл бұрын
Another great video, I've been wanting to graduate from attempting to blow up Arduinos to something more expensive for a while!
@mandelbro777
@mandelbro777 4 жыл бұрын
Wonderfully explanatory as usual. Great vid.
@bigsteve6729
@bigsteve6729 2 жыл бұрын
Just got some new pi gear thought I'd pop back to the workshop to freshen up my knowledge after a nodemcu binge 😁
@peterashley6042
@peterashley6042 4 жыл бұрын
Excellent video. Thank you.
@ESwitchInc
@ESwitchInc 4 жыл бұрын
Great stuff, once again! Would love to send you some switches to work with for your next video, let's talk!
@kandarpsoni7529
@kandarpsoni7529 4 жыл бұрын
Awesome video. Simply brilliant. Thanks a Ton. 👍🏻
@itsmmdoha
@itsmmdoha 2 жыл бұрын
I thank you from the bottom of my heart ❤️ for making this video.
@hmdmddh
@hmdmddh 3 жыл бұрын
Thank you very much for your well explained Videos
@mursitkc5328
@mursitkc5328 3 жыл бұрын
thanks a lot . i love your documenteries
@Sam-tg4ii
@Sam-tg4ii Жыл бұрын
very clear. Thank you
@cybersean3000
@cybersean3000 3 жыл бұрын
Excellent tutorial. Thank you.
@johannespralle6831
@johannespralle6831 3 жыл бұрын
You are a great instructor. Thanks. Suggestion: Talking about Pi to Pi communication via SPI Bus and CAN Bus.
@havafazai9023
@havafazai9023 4 жыл бұрын
Please make more tutorials. Best mechatronic teacher ever
@davekendall4698
@davekendall4698 4 жыл бұрын
Great video. I have been wondering what to choose for a stand alone logger for my costly heating system. i have (4 zones + boiler) for on / off times to display on grafts so which is on longer ( not hotter) & then maybe then show temperatures for (send & return of boiler water). I think it would be a very useful project for many people to used. Thank you again
@MarkLawry
@MarkLawry 2 жыл бұрын
It was a good reminder seeing you attached to an antistatic ground.
@sugundanmm1160
@sugundanmm1160 2 жыл бұрын
Detailed explanation.I really enjoyed learning here
@hubercats
@hubercats 3 жыл бұрын
Great video! Thank you.
@karthikeyank3219
@karthikeyank3219 2 жыл бұрын
Excellent!!! Really helpful for beginners
@bonganijele9770
@bonganijele9770 Жыл бұрын
Nice content i like the way he talk's he's loud and clear. Fully explained in details.
@warrenscorner
@warrenscorner 4 жыл бұрын
Of course they didn’t need to social distance themselves when you did this video. Thank you for the videos. Stay well!
@khun_le
@khun_le 4 жыл бұрын
Awesome video. Thanks and keep up the great work.
@levelmastersystems117
@levelmastersystems117 4 жыл бұрын
Thank you very much, for this video.
@chrismoore9223
@chrismoore9223 4 жыл бұрын
You’re the best. Thank you.
@tomjoad1060
@tomjoad1060 Жыл бұрын
Thank you for a well-made video!
@danieldefo7801
@danieldefo7801 2 жыл бұрын
Great video! Thanks you!
@eduardovillar2211
@eduardovillar2211 3 жыл бұрын
Thanks for video, that shows the unlimited capabilities of combine gpio with a computer, I guess it is the next steps learning after MCU is under control. Combined by displays, mqtt, cameras, HMI and so on possibilities are unlimited!! This is my first contact with Python and seems more compact language than Arduino C, interesting to keeping curious mind. Thanks again, hope to see more videos like that.
@psudrat
@psudrat 3 жыл бұрын
Thank you so much! Merci beaucoup!
@jeremiahayres103
@jeremiahayres103 2 жыл бұрын
You are awesome! This helped me a lot! Also I love the lab!
@153SCORN
@153SCORN 4 жыл бұрын
Used the PI & Arduino together. Best of both worlds.
@cybergames33pl52
@cybergames33pl52 2 жыл бұрын
so clear explained after bought i chosen good rasberypi but if i founded you before i could get easy explained my choice between rasbery and arduino i am begin of begin with exp programming so all understanded more easy with you yt channel
@billstrain1
@billstrain1 4 жыл бұрын
Very good video. You are a good instructor.
@ttheo3
@ttheo3 2 жыл бұрын
Hey ! I love your channel and your videos ! I just wanted to correct a few things, arround 4:50, you says Raspberry needs a bunch load of USB devicesto get starting. I actually find it much easier to start than arduino. I just use for my PI : USB power supply, SD card. Having the computer connected to the wifi is really easy, and using SSH to get distant access is easy to. You just need a computeur to SSH into the pi, but you don't need USB devices to access and programm it. Wich for certain case it's easier than accessing the USB port of an arduino builted in the project. Anyway, thanks a lot fort the sharing of this very good video :D
@dav8485
@dav8485 3 жыл бұрын
a great video, congratulations!
@scotthiggins7804
@scotthiggins7804 4 жыл бұрын
Great instructional video! Can you add some links for the bits and bobs that you used in this project?
@ertan1147
@ertan1147 4 жыл бұрын
it was very clear thank you. You could add also Windows 10 IoT and use c# to code :)
@whatwhat9485
@whatwhat9485 3 жыл бұрын
Very nice. Thank you
@EsotericArctos
@EsotericArctos 4 жыл бұрын
Do you ever use the ESP8266 or ESP32 chips? They don't have quite so many GPIOs but they definitely have uses.
@Boradumir
@Boradumir 4 жыл бұрын
Very good information and even perfectly understandable for a not native speaker... One question about switches and raspberry pis... does the library you used automatically ignore keybouncing?
@anurasenarathna1703
@anurasenarathna1703 Жыл бұрын
Great Video as Always.
@rgdphome8974
@rgdphome8974 4 жыл бұрын
👌 Gr8 as usual.
@alexandrpetrov1110
@alexandrpetrov1110 3 жыл бұрын
Thank you!
@logovka9671
@logovka9671 3 жыл бұрын
Super helpful!
@RottnRobbie
@RottnRobbie 4 жыл бұрын
In a couple of the Python sketches, the code was in a While block. Great, and easy to relate to Arduino. But other Python examples have NO LOOP, and end with a call to pause (), with no mention of it or explanation of what it's for (except to say your pausing the program). Maybe it goes beyond your intended scope, but I really think you should've explained how the functions (objects) keep working, and don't just end! Anyone coming from an exclusively Arduino background won't have any idea of what's happening here.
@myusernameisrighther
@myusernameisrighther 4 жыл бұрын
I’d really like to know where I can get one of those multipurpose hubs. 3 usb AND wired network on one device? Awesome.
@user-fq3pz4io2y
@user-fq3pz4io2y 18 күн бұрын
Thank You!
@wallaceshackleton1889
@wallaceshackleton1889 4 жыл бұрын
Great idea, although I've got to say that Unicorn poo is easier to buy than a Pi W.
@PacocaAir
@PacocaAir 4 жыл бұрын
Thanks !! Please make more videos about the subjects raspberry and jetson nano!
@desertbotio
@desertbotio 4 жыл бұрын
Great videos. The Arduino MKR 1000 and 1010 WiFi - have WiFi in their name. Though a bit pricey. There is also a huge community that prefers the ESP32 related Arduino compatibles with their built in WiFi.
@sannyabacha4025
@sannyabacha4025 Жыл бұрын
Brilliant!!!
@torque6389
@torque6389 2 жыл бұрын
Great video!
@martincregg
@martincregg 3 жыл бұрын
Thank you
@testbranding
@testbranding 4 жыл бұрын
Amazing job it's educational too if possible 1000 thumbs up
@tubeDude48
@tubeDude48 4 жыл бұрын
Make sure the Micro SD Card is *Class* *10* for a faster speed.
@mixmashandtinker3266
@mixmashandtinker3266 3 жыл бұрын
Or use a SSD
@tubeDude48
@tubeDude48 3 жыл бұрын
@@mixmashandtinker3266 - Until they make SSD's reliable, their not for me.
@mixmashandtinker3266
@mixmashandtinker3266 3 жыл бұрын
@@tubeDude48 Never had any problems. Been running one for several years 24/7…
@lesbac
@lesbac 3 жыл бұрын
thank you.
@electrotsmishar
@electrotsmishar 3 жыл бұрын
wonderful video
@nrupensix
@nrupensix 3 жыл бұрын
Well done
@usmanmehmood5224
@usmanmehmood5224 4 жыл бұрын
Great video, can you please make a video of RFID sensor interface with rpi3
@kirankumar5868
@kirankumar5868 3 жыл бұрын
Love from India
@balkrishnawagle7205
@balkrishnawagle7205 2 жыл бұрын
Sir You r a Great Thanks you Sir
@randomperson619
@randomperson619 4 жыл бұрын
What is the blue band you are wearing, while explaining the Types of Raspberry boards? Is that ESD strap?
@naeemhaq3504
@naeemhaq3504 4 жыл бұрын
i like your videos quality
@kajmolin297
@kajmolin297 3 жыл бұрын
Interting! I have a Raspberry Pi 4B, but I can´t gett a current out of the usb port. I wounder if I had to connect the GPIO also?
Raspberry Pi 5: EVERYTHING you need to know
20:32
Jeff Geerling
Рет қаралды 1,1 МЛН
GPIO for any PC or Laptop: Adafruit FT232H
19:18
ExplainingComputers
Рет қаралды 198 М.
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 23 МЛН
- А что в креме? - Это кАкАооо! #КондитерДети
00:24
Телеканал ПЯТНИЦА
Рет қаралды 7 МЛН
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 7 МЛН
Introduction to ESP32 - Getting Started
47:57
DroneBot Workshop
Рет қаралды 1,6 МЛН
Raspberry Pi: Using GPIO Inputs
18:41
ExplainingComputers
Рет қаралды 581 М.
I tried the Cheapest Arduino Alternative (that Nobody heard of)
13:31
Solid State Batteries Are REALLY Here: Yoshino Power Station
12:23
Undecided with Matt Ferrell
Рет қаралды 225 М.
Raspberry Pi Pico - Control the (I/O) World
1:03:16
DroneBot Workshop
Рет қаралды 604 М.
Raspberry Pi LESSON 4 : Understanding and Using GPIO Pins
45:45
Paul McWhorter
Рет қаралды 52 М.
I Can Save You Money! - Raspberry Pi Alternatives
15:04
Linus Tech Tips
Рет қаралды 3,3 МЛН
What's the difference? Arduino vs Raspberry Pi
6:21
Tinkernut
Рет қаралды 1,8 МЛН
10 Raspberry Pi Projects (All models, including Pico)
1:52:44
DroneBot Workshop
Рет қаралды 500 М.
Basic usage of the Raspberry Pi GPIO pins
13:44
Engineer Man
Рет қаралды 95 М.
Who has won ?? 😀 #shortvideo #lizzyisaeva
0:24
Lizzy Isaeva
Рет қаралды 62 МЛН
HAPPY BIRTHDAY @mozabrick 🎉 #cat #funny
0:36
SOFIADELMONSTRO
Рет қаралды 14 МЛН
Looks realistic #tiktok
0:22
Анастасия Тарасова
Рет қаралды 100 МЛН
Как спасти человека верёвкой🤔
0:26
FERMACHI
Рет қаралды 11 МЛН
Jatuh dua berturut turut
0:15
CIREBON VLOG JEH
Рет қаралды 39 МЛН