Raspberry Pi: Using GPIO Inputs

Sdílet
Vložit
  • čas přidán 25. 07. 2024
  • How to connect physical switches, reed switches and an Adafruit IR reflectance sensor to any Raspberry Pi and communicate with them using Python. I also explain in depth the concept of pull-up and pull-down resistors.
    You can access all of the code and circuit diagrams featured in this video here: www.explainingcomputers.com/pi...
    The Adafruit IR reflectance sensor can be obtained from Adafruit in the USA here: www.adafruit.com/product/2349 -- or from Pimoroni in the UK here: shop.pimoroni.com/products/re...
    You may also like my videos on Raspberry Pi robotics, such as this one in which I explain how to use GPIO inputs: • Raspberry Pi Robotics ...
    I also have a playlist of Raspberry Pi cooling videos here: • Raspberry Pi 3 Cooling
    Some of my other Raspberry Pi videos include this one where I spend a whole week using a Raspberry Pi as my only computer: • Pi Week: Raspberry Pi ...
    More videos on computing-related topics can be found at: / explainingcomputers
    You may also like my ExplainingTheFuture channel at: / explainingthefuture
  • Věda a technologie

Komentáře • 424

  • @thomascott7425
    @thomascott7425 Před 7 lety +86

    Mister Barnett, I must say that I've never heard the concept of pull up / down resistors explained so clearly and concisely. Very well done. You have given me an idea on how to build an alarm system to see if anyone has opened a door or window remotely and to activate a video recorder to stream the output to my smart phone. Now all I have to do is to figure out the streaming bit to my phone. Thanks.

    • @liudas000
      @liudas000 Před 4 lety

      @Bus 22 I'm thinking about same idea, but over sms. I think its possible to write code for arming system by sms or online and to get alerts over sms or watch sensors status online.

    • @evilMaid1984
      @evilMaid1984 Před 4 lety +3

      May want to look into an ESP8266; programmable with arduino, lower power consumption and a fraction of the cost ;). Works great for door / windows sensors etc...

  • @tav9755
    @tav9755 Před 3 lety +18

    YT is pure gold as long there are people like you explaining stuff.

  • @walts555
    @walts555 Před 8 lety +10

    I like your teaching method of suggesting the simplest solution and patching its shortcomings, like what you do for pull-up/down. Very effective. Good work!

  • @Adam-yl3gi
    @Adam-yl3gi Před 7 lety +13

    Thank you. I'm fairly proficient with Arduino's and electronics. I've been looking for some straight-forward examples of using the Raspberry Pi as I would like to harness more powerful boards. Many videos waste lots of time talking about irrelevant things; you've cut straight to some actual examples and it's absolutely brilliant. Subscribed!

  • @marks_02
    @marks_02 Před 2 lety +1

    Wow, wow, wow, just wow. I'm blown away by how clearly, thoroughly, and yet concisely you are able to teach. I probably gave you a thumbs-up when I first watched this video, but as I watch it again for review 5+ years later, I'm just blown away by how great of a job you did on this one. Thank you!!

  • @siliconstate
    @siliconstate Před 8 lety +16

    This is brilliant, thanks for the guide! As you say, all sorts of projects could be derived from these!

  • @MrKbtor2
    @MrKbtor2 Před 5 měsíci +2

    Best explanation I've seen yet. I was seeing those terms like "pull-up/down" in the kits I was working with and struggled with understanding the problems and risks.

  • @Hermiel
    @Hermiel Před 8 lety +4

    That might be the simplest and clearest explanation of pull -up and -down resistors I've come across.

  • @williamheckman4597
    @williamheckman4597 Před 7 lety +26

    This tutorial rocks. Thanks! GPIO wasn't too clear to me, but now I "Get it" ... Thanks again... great videos!

  • @jeremyadair5780
    @jeremyadair5780 Před 5 lety +14

    Heh, Thank you, I never truely knew what floating was in my undergrad, I just knew the pins had to have a pull up or pull down to complete the circuit. I never thought of the protection! You explained it with a circuit and that I can understand. Thank you.

  • @Mr.P539
    @Mr.P539 Před 4 lety +1

    just this year I heard about this raspberry pi, it has been hanging around for years already. I'm glad that there still free video like this to learn. Thank you.

  • @khomotjomodipa6798
    @khomotjomodipa6798 Před 8 lety +12

    You are simply the best at explaining. Thank you.

  • @AgeingBoyPsychic
    @AgeingBoyPsychic Před 5 lety +3

    Your enthusiasm is contagious, I wish I'd had an I.T. teacher like you at school!

  • @jamesbarker6373
    @jamesbarker6373 Před 6 lety +1

    I like how you show a variety of circuit diagrams to help understand

  • @dylandowdy3687
    @dylandowdy3687 Před 4 lety +2

    This is a great video thank you! I think I was just as stoked about the open and close when it scrolled on screen as you were! Computers rule!

  • @truePitch1
    @truePitch1 Před 6 lety +5

    Pure information - invaluable in today's world. Extremely clear, concise, excellent productions. Kudos.Thanks

  • @B.I.T.E.
    @B.I.T.E. Před 5 lety +1

    Oh wow.. This is so awesome! Please continue this type of explaining of builds. Without anyone next to me in normal class to ask questions of. This is by far the next best thing. I wish I could hit a subscribe on you tube to send money for your great efforts. You have not set with in CZcams.

  • @karimkohel3240
    @karimkohel3240 Před 5 lety +2

    thank you for such a simple and comprehensive tutorial, which helps new comers understand basics that aren't found easily

  • @skyzifero8548
    @skyzifero8548 Před 5 lety +1

    amazing job. Only video I've seen that actually explains the how and why bits in simple terms. Very high quality content; exactly what I needed to understand GPIO. Great teacher, and great skills. Subscribed.

  • @resrussia
    @resrussia Před 8 lety +1

    Thanks for another awesome video, I generally like your videos, andI love your videos on GPIO. Keep up the good work.

  • @jonassteinberg3779
    @jonassteinberg3779 Před 3 měsíci

    Have to do a bit of microcontroller engineering at work and this video is a relieving primer -- thank you for this crisp exposition.

  • @EverydayTechable
    @EverydayTechable Před 5 lety +1

    Thank you! I've already done a kit from Adeept but did not know about Idle, I've been using Vim or sudo and haven't been thrilled as I prefer some for of gui for highlighting certain things.

  • @DLiberator78
    @DLiberator78 Před 8 lety +13

    Another great Raspberry Pi video. It's interesting to see the sorts of projects you could make with the GPIO pins.

    • @ExplainingComputers
      @ExplainingComputers  Před 8 lety +13

      There are indeed so many possibilities when you add switches to something with computing power . . .

    • @saadzaghloul9279
      @saadzaghloul9279 Před 7 lety +1

      could you do a video about the GPIOs of Tinker Board from Asus ? it is more interesting in my opinion. thank you.

  • @Bengismo
    @Bengismo Před 6 lety +1

    Great video, well explained with a good coverage of the electronics and why to add resistors as well as what the phython code does, Excellent.

  • @scyther1141
    @scyther1141 Před 8 lety +1

    Nice job. The explanation and graphic are very easy to understand.

  • @eebaker699
    @eebaker699 Před 4 lety +1

    Fantastic video!
    I too have never been really able to understand what and how the pull up and pull down do and work. I appreciate your tip on the safety current limiting resistor going into the GPIO pin.
    I like your coding work as well.
    You have eloquently explained this...
    Thanks again for your excellent video!
    More Raspberry pi project videos like this one please.

  • @Kevin-wo3kp
    @Kevin-wo3kp Před 8 lety +1

    Thank you - this is exactly the kind of Pi video I needed to see. I'll be jolly glad to see anything more on the Pi. You set the standard that others can only follow. I wish you a great week.

  • @Timmeh7
    @Timmeh7 Před 6 lety +3

    Thanks for this excellent tutorial. While I'm a competent programmer, any discrete electronics knowledge I had fell out of my head 10+ years ago - this was perfect to give me everything I need to actually get back into it.

  • @slogmue1401
    @slogmue1401 Před 8 lety

    Another great video! I recently completed a school A-level project using a raspberry pi, and your videos were, and still are a valuable resource to me when making that project! Your videos are so easy to understand, and basically taught me the more useful stuff a pi can do, so, thanks a bunch for the great videos!

  • @OttosTheName
    @OttosTheName Před 6 lety +2

    Glad I decided to bingewatch your videos on SPC's, I was just about to mess with buttons and GPIO on my ESP8266 and I had never heard of pull up and pull down resistors. Great explanation for electrobics noobs!

  • @petermsamson
    @petermsamson Před 7 lety +1

    Love the way you explain everything.. I hope you plan on doing more Tutorial, examples..

  • @baxtercohen
    @baxtercohen Před 7 lety +1

    Thank you very much! Very clear explanation on great ideas to have a computer respond to real world events.

  • @KrishnaDasLessons
    @KrishnaDasLessons Před 8 lety +3

    Thank you very much, I learned a lot from this video.

  • @kusatech8005
    @kusatech8005 Před 6 lety

    Good Video, nice combination of circuit theory, actual wiring and enough software to get it going.

  • @redazaiti2157
    @redazaiti2157 Před 7 lety +1

    amazing. really love how you share your experience :). I'm happy to learn from you.

  • @TheEpjim
    @TheEpjim Před 7 lety +3

    Great video! Very informative! Keep up the good work!

  • @rorycormack7577
    @rorycormack7577 Před 8 lety

    Thank you for the video. I have learnt a lot and will be trying this out. I am still enjoying your videos and hope to carry on enjoying them.

  • @Taran72
    @Taran72 Před 6 lety

    Great video! that's what I call a great class where efficiency and ease of learning meet. In a few minutes you really explained everthing I needed to know without wasting time. Thanks!!!

  • @natsumik5716
    @natsumik5716 Před 5 lety +2

    it's a shame to say that,
    as a student who just started learning python, i did not understand well during my class. But watching your lesson helped me a lot !
    Thank you so much!

  • @RSGaming-lt4zh
    @RSGaming-lt4zh Před 7 lety +1

    I just received my Rasberry Pi 3 Model B the other day there so look forward to watching your tutorials on YT. Thanks!

  • @haiaokuwa
    @haiaokuwa Před 8 lety

    Thanks for this. I've been a an electronics hobbyist for months. This is the first clear explanation of why and how a pull up/down resistor is used. Tons of videos where they say they're using them. So few explanations as to why or how they worked (what they do and why to use them), I was starting to wonder if they were different kinds of resistors. Very clear video. Thanks again.

    • @ExplainingComputers
      @ExplainingComputers  Před 8 lety +1

      Many thanks. The more I dug into this, the more I realized that a lot of confusion exists regarding the resistors (are they needed? why? etc), so I thought I'd do an explicit section on them and really try to lock things down.

  • @garymargot4379
    @garymargot4379 Před 7 lety +6

    Excellent tutorial

  • @MicrobyteAlan
    @MicrobyteAlan Před 4 lety +2

    Breadboarding, hardware and logic, good stuff. Thanks

  • @dowonkim574
    @dowonkim574 Před 6 lety +1

    You are one of the most helpful teachers in youtube! Thanks!

  • @rayjohnson7417
    @rayjohnson7417 Před 7 lety +1

    great video, thank you for taking the time to make it

  • @dimjim2365
    @dimjim2365 Před 7 lety +1

    Awesome. Loved this little tutorial

  • @johnrobertd748
    @johnrobertd748 Před 6 lety

    Thank you! Very simple, but also very helpful.

  • @BuildswithBrian
    @BuildswithBrian Před 4 lety +2

    Thank you very much, this video helped me greatly, I’ve subscribed and I am excited to watch more of your videos

    • @ExplainingComputers
      @ExplainingComputers  Před 4 lety +1

      Great to hear! This remains one of my favourite videos. You may like some of my Raspberry Pi robotics videos, and also Python intro.

  • @argentosebastian
    @argentosebastian Před 7 lety

    I really enjoy watching your videos. Very detailed and easy to understand. I really would like if you can make a video of how to connect a Pi to an Arduino through the serial port and talk to each other. I have been watching a bunch of them but none of them are very clear to understand. Thanks

  • @ShitBrick785
    @ShitBrick785 Před 6 lety

    That explanation about circuits was amazing.

  • @makebuildmarket5735
    @makebuildmarket5735 Před 7 lety +1

    Excellent Explanation! Well done.

  • @jameszah
    @jameszah Před 6 lety +1

    This is the best raspberry site I have ever seen! Please keep it up! very well explained and in the appropriate English language! Thank you

  • @neilvermeulen5283
    @neilvermeulen5283 Před 7 lety +1

    Thank you Christopher. You explain well.

  • @fisheye8566
    @fisheye8566 Před 8 lety +1

    Excellent demonstration!

  • @emremutlu44
    @emremutlu44 Před 7 lety +1

    Nice pack of information! thanks.

  • @vikasnar
    @vikasnar Před 8 lety +1

    Liked the way you explained .... made things easy to understand . Thanks for the vedio

  • @williamhall5893
    @williamhall5893 Před 7 lety +1

    Love these videos. Thanks!

  • @azoresmarine
    @azoresmarine Před 8 lety +1

    Outstanding tutorial
    Thank You

  • @eng.aljobury5087
    @eng.aljobury5087 Před 7 lety +1

    Thank you so much for this beautiful explain

  • @toms4123
    @toms4123 Před 2 lety +1

    Great presentation style, well explained and easy to,follow

  • @leonlao744
    @leonlao744 Před 7 lety

    講解的非常好 也很用心 !!

  • @billg2345
    @billg2345 Před 4 lety +1

    You are great thanks for all the great work you do, I had to recommend this site you developed to family.

  • @attiqueur-rehman2134
    @attiqueur-rehman2134 Před 3 lety +1

    Hats off to you man for precisely describing everything. Works for one of my problem quite easily. (y)

  • @tonybanjo
    @tonybanjo Před 5 lety +2

    Your videos are excellent, subscribed

  • @theneroliveira
    @theneroliveira Před 8 lety

    Great video, looking forward for more! :)

  • @dbyrd7827
    @dbyrd7827 Před 4 lety

    Positively brilliant tutorial and instruction. Your educational skills are masterful. Thank you for sharing your knowledge, and skills. Technical mastery and compassion incarnate. Thank you, Mister Barnett!

  • @svizztech
    @svizztech Před 8 lety +5

    This breadboard must be at least 1000 years old :D Thanks for the video.

  • @segarlinktech
    @segarlinktech Před 8 lety +1

    this video is very help full for engineer or student ,thanks

  • @fuanka1724
    @fuanka1724 Před 5 lety +1

    Interesting, thanks for this nice video!

  • @trondknudsen6689
    @trondknudsen6689 Před 2 lety +1

    Very useful info! I'm going to use it to make a sleep tracker.

  • @brightsun3608
    @brightsun3608 Před 5 lety +1

    This is the best tutorial for IoT I met.

  • @tomasfranco4870
    @tomasfranco4870 Před 3 lety +1

    Love these videos... Excelent explanation.

  • @Kolohekat
    @Kolohekat Před 6 lety +7

    Christopher Barnatt is a Good CZcamsr... Explains in detail...

  • @JYKei
    @JYKei Před 6 lety

    Great tutorial!!! Thank you sooooo much!

  • @sherakhela4044
    @sherakhela4044 Před 7 lety

    Thanks for great explanation.

  • @khalidrao4716
    @khalidrao4716 Před 3 lety

    Its really a useful and very good video enjoyed keep it up

  • @Vampier
    @Vampier Před 8 lety +1

    You know that you don't need sudo anymore to control the GPIO ports right?
    Excellent tutorial, I wish you did this when I started 2+ years ago :)

    • @ExplainingComputers
      @ExplainingComputers  Před 8 lety +1

      Thanks for this. Yes, I learnt yesterday that the latest version of Raspbian removes the need for the sudo on Idle. Not that everybody will be running it yet! :)

  • @simplelifediy1772
    @simplelifediy1772 Před 8 lety +3

    this is great!!! thanks

  • @MaTXiNGuN
    @MaTXiNGuN Před 4 lety

    Thanks a lot for your great explanations and for your work

  • @efrizal100
    @efrizal100 Před 6 lety +1

    This is a good video is easy to understand GPIO works for newbie like me ..

  • @pmr1wrt53
    @pmr1wrt53 Před 8 lety +1

    Very nice and good video instruction.

  • @alexander_adnan
    @alexander_adnan Před 6 lety +3

    you're becoming a hero now....

  • @xxportalxx.
    @xxportalxx. Před 3 lety

    Wow, how is nobody commenting on the sheer size of this man's read switch!?

  • @nilskassens2961
    @nilskassens2961 Před 7 lety +1

    exacty what I'm looking for. Thank's

  • @MadMike93
    @MadMike93 Před 7 lety

    awesome video about GPIO input! Oh my God! So interesting!

  • @juandemin2930
    @juandemin2930 Před 7 lety +1

    Excellent!!!!! thank you!!!!

  • @RobertMertensPhD
    @RobertMertensPhD Před 3 lety

    I don't know if that's clay dough or play dough, but it's ingenious. I have stuff sliding all over my laminated desktop, and sometimes falling off the edge and going overboard. Sometimes I use rubber feet help to keep things from moving around while I work. So now I need to find out what that stuff is, find some that's non-conducting, and "dough down" all the electronics I have sliding all over my desk.
    And getting that Raspberry Pi 4B to work was a virtual nightmare. Neither of the two monitors I bought for this project would work with the MicroHDMI-to-VGA converters I bought. So when I first booted it up, I saw bits and pieces of boot-up stuff, but after boot seq., I got two blank screens. That was with Ubuntu Desktop, after I burned-off 5GB of bandwidth (I only get 30GB per month). I figured the download might be rotten, so I burned-off another 3GB of data using the Raspberry Pi Imager - which I no longer like.
    The problem with the Raspi Pi Imager is that you can't really store the download - it just downloads it and burns the MicroHD card. If anything goes wrong, you lose your download and whatever bandwidth you spent on it. You can copy the card, but you need a clean one for that, and I have Windows data on all of my spares. I also still have the 128GB SD Card from the Raspberry Pi 3B+ I still have, but for all that trouble, I'm not going to blow out that (working) OS.
    In the end, I tried another monitor and it worked. And then I found a second monitor off of another computer that worked. The two I bought for this project still work on other computers (with VGA output), but not on this machine. So that's really odd.
    I don't use Python - I use C or C++, so this is a nice video but I think I going to have to download some pre-made software that gives me access to the GPIO ports. I'm especially interested in the SPI ports, as you know, but there may or may not be software already written for this computer. SPI communications are not only data, but timing signals (clocks) that have to be synchronized with the data. I'm not sure how the computer does this, since it's usually done in the hardware. I can only hope that the BCM2711 has it built-in (for all six ports).

    • @ExplainingComputers
      @ExplainingComputers  Před 3 lety

      The clay that holds things in place is called Blu Tack.

    • @RobertMertensPhD
      @RobertMertensPhD Před 3 lety

      @@ExplainingComputers Thanks, Christopher. It looks like Bostik isn't going to tell us the dielectric strength (or resistivity) of this material. I suppose it might be okay for low-voltage applications, but I don't think I'll trust it over 30V or more. I know there are industrial materials that are great non-conductive adhesives with very high dielectric constants, but I don't want things permanently glued to my desk (work table).
      It's not a really big issue, but I do have stuff that slides around all over my work space - especially wires, cables and switches. And protoboards. Sometimes I stare down at my protoboards and circuit wiring and take a moment to consider how precariously close to disaster everything looks. Seriously, it's dangerous.

  • @MarkBamford
    @MarkBamford Před 2 lety +1

    Fantastic channel. Thanks and kind regards, Mark

  • @freevideos051
    @freevideos051 Před 8 lety +1

    Nice, thanks for video :)

  • @Super8Rescue
    @Super8Rescue Před 2 lety +1

    Thanks for this.

  • @shingabiss
    @shingabiss Před rokem

    Best tutorial I've seen! You explain things in a very methodical and clear way at a good pace. I am not new to electronics, just to the Raspberry Pi. I have started with Raspien and am using Thonny IDE. I see you prefer a different coding window, is it simply a command line? Do you prefer it to the Thonny?
    Thanks for making such outstanding tutorials.

  • @danielcairns9390
    @danielcairns9390 Před 7 lety

    Thanks for this!

  • @tinkmarshino
    @tinkmarshino Před 5 lety +2

    the pure torture of it all Chris is that I have to wait until the first to get my check... dang and I thought I learned patients as a lad... well I guess it is learn and learn again eh? this is all too exciting..

    • @tinkmarshino
      @tinkmarshino Před 5 lety

      @Darth Digital Yeah you are right.. it come from 3 things.. being self taught, being old and relying to much on spell check.. It doesn't make me sad but it does kind of drive me nuts at times.. what is worse now it that I am starting to transpose letters like a dyslexic person although I never suffered from it before.. Ah the joys of getting old.. you don't seem to be doing to bad for ASD.. sorry for troubles.. but it will make you stronger! have a good new year!

  • @FamousCloud
    @FamousCloud Před 7 lety

    Great video

  • @humyemang7164
    @humyemang7164 Před 7 lety +2

    I like your video~!

  • @markanderson2904
    @markanderson2904 Před 3 lety +1

    Chris, I love your videos and am working my way through all of them.
    May I suggest that the schematic drawing of the breadboard connections is confusing. I think you should explain how the "squares" are connected for those who are not familiar with breadboards. I.e., each vertical columns of squares on the extreme left and right are electrically connected together, while each horizontal rows of squares (excluding the extreme left and right squares) are connected together.

  • @godofwinetits3826
    @godofwinetits3826 Před 8 lety

    hope to see some LCD or 7 segment output then keypad in the next tutorial

  • @robertleeluben
    @robertleeluben Před 7 lety

    This is good stuff here.

  • @PhilORourke
    @PhilORourke Před 6 lety +1

    Magnifico.thanks

  • @brettchenier1010
    @brettchenier1010 Před 5 lety

    I enjoy your videos. What is the "blue stuff" you use to hold the switch and breadboard in place?