Raspberry Pi GPIO - Getting Started with gpiozero
Vložit
- čas přidán 23. 07. 2024
- 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! - Jak na to + styl
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
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. 😊
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!
I really like how do your presentation, very impressive.
I'm going full on Raspberry Pi now; keep them coming.
Greetings from Tanzania 🇹🇿
Amazing job again, very interesting and educational
You make everything so clear and easy to understand. Thank you.
Detailed yet engaging! Thank you once again.
in my opinion, your have THE BEST videos! Delivery pace perfect, clarity perfect, friendliness perfect!
You make learning embedded systems so easy and fun. Thank you Sir 😊
Great video! Even with Arduino and Python experience I learned a lot from that, specifically that GPIO can be shared among Python programs.
Cool, I like the small scene at the end with the mixed up PI‘s!!! Keep doing more of those well explained clips!
that was awesome. I really needed this level of information fed at this pace. Looking forward to watching many more. thank you!
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.
Thank you so much! You're an amazing teacher.
I've recently taken up this hobby and this my new favorite channel. Thanks!
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!
Best video comparison on the features and functionally of the Pi and Arduino that I have found on CZcams. Thanks for the info.
As always, clear and to the point! Thank you for sharing this!
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!
Micheal python is easy it is not C++😁
@@idris7464 I'm struggling to learn it 😪 😩
I'd love more content like this. You have such a wonderful way of explaining things, I'd watch tutorial's of any kind.
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!
Wow, Awsome!!! very professional, VDO, Sound. Well put together. Thanks a million.
Loved it, thanks, very well done and informative!
Great!. Thank you sir!. We are expecting more video on this topic.
Fantastic, you did very useful and great job. Thank you so much!
Wow! What a great workshop. Super organization too!
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!
This is perfectly explained. Short and clear! Thanks a bunch.😄
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😘
Wonderfully explanatory as usual. Great vid.
your back wall is so organized! awesome
Clear and detailed. Thanks.
Excellent simple clear explanation
thanks.
What a workshop! Lookin pretty sharp, I'm jealous
Thank you for your terrific lesson and teaching.
I thank you from the bottom of my heart ❤️ for making this video.
Of course they didn’t need to social distance themselves when you did this video. Thank you for the videos. Stay well!
thanks a lot . i love your documenteries
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
Awesome video. Simply brilliant. Thanks a Ton. 👍🏻
Excellent video. Thank you.
Another great video, I've been wanting to graduate from attempting to blow up Arduinos to something more expensive for a while!
Please make more tutorials. Best mechatronic teacher ever
Detailed explanation.I really enjoyed learning here
Awesome video. Thanks and keep up the great work.
Excellent!!! Really helpful for beginners
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 CZcams is this one, created by whom? You, one of the best, with clear, concise, comprehensive explanations ever. Thank you.
Nice content i like the way he talk's he's loud and clear. Fully explained in details.
very clear. Thank you
Thank you very much for your well explained Videos
Excellent tutorial. Thank you.
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.
Great video! Thank you.
You’re the best. Thank you.
Great video! Thanks you!
Thank you for a well-made video!
Great stuff, once again! Would love to send you some switches to work with for your next video, let's talk!
Just got some new pi gear thought I'd pop back to the workshop to freshen up my knowledge after a nodemcu binge 😁
You are a great instructor. Thanks.
Suggestion: Talking about Pi to Pi communication via SPI Bus and CAN Bus.
Thank you very much, for this video.
You are awesome! This helped me a lot! Also I love the lab!
Great Video as Always.
Very good video. You are a good instructor.
Thank you so much!
Merci beaucoup!
It was a good reminder seeing you attached to an antistatic ground.
I’d really like to know where I can get one of those multipurpose hubs. 3 usb AND wired network on one device? Awesome.
a great video, congratulations!
Great instructional video! Can you add some links for the bits and bobs that you used in this project?
Do you ever use the ESP8266 or ESP32 chips?
They don't have quite so many GPIOs but they definitely have uses.
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.
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! :)
👌 Gr8 as usual.
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?
Great video!
Brilliant!!!
Used the PI & Arduino together. Best of both worlds.
Super helpful!
Thank You!
Amazing job it's educational too if possible 1000 thumbs up
Very nice. Thank you
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
it was very clear thank you. You could add also Windows 10 IoT and use c# to code :)
What is the blue band you are wearing, while explaining the Types of Raspberry boards?
Is that ESD strap?
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?
Thanks !! Please make more videos about the subjects raspberry and jetson nano!
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
Great idea, although I've got to say that Unicorn poo is easier to buy than a Pi W.
Thank you!
The raspberry pi party lol! That made me sub
Can i use ubuntu mate on a pi4 for this project, and im curious to how can the GPIO only deliver 3.3v but there's an always on 5v that i use for fans
Sir You r a Great
Thanks you Sir
Great video, can you please make a video of RFID sensor interface with rpi3
wonderful video
thank you.
9:15 Do you have a link for $5 PI Zero? I only found $15.00. Love all your videos.
Well done
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.
i like your videos
quality
I really enjoyed the video. Allthough I am known to the Raspberry Pi for a while and being a software engineer I had a fast forward look at the video to get an idea how you see it as I remember the other videos focus more on Arduinos. It was great to see the different versions of the Pi!
Thank you