Raspberry Pi Pico W LESSON 4: Create a Binary Counter Using the Pico W
Estimated read time: 1:20
Learn to use AI like a Pro
Get the latest AI workflows to boost your productivity and business performance, delivered weekly by expert consultants. Enjoy step-by-step guides, weekly Q&A sessions, and full access to our AI workflow archive.
Summary
In this fun and engaging tutorial by Paul McWhorter, we dive into the exciting world of the Raspberry Pi Pico W with a lesson on creating a binary counter using four LEDs. Sponsored by SunFounder, this video lesson is an entertaining guide through the steps of setting up a 4-bit digital counter. Paul shares insightful tips and a detailed explanation on the wiring and coding needed to set up the LEDs. Viewers are also given a creative homework assignment to expand their circuit with more LEDs and develop intriguing light patterns. This lesson is perfect for those who want to enhance their skills and have fun with coding and electronics.
Highlights
Kickstart your Raspberry Pi Pico W journey by making a binary counter with Paul McWhorter. π
A shoutout to SunFounder for sponsoring and providing the Kepler kit used in the lesson. π
Step-by-step guidance on setting up a 4-bit digital counter using LEDs and precise wiring. π‘
Challenges viewers to add a fifth LED and craft unique light sequences, like Knight Rider. π€
Encourages the community to share their creative solutions and connect through their projects. π
Key Takeaways
The Raspberry Pi Pico W can be used to create a binary counter with LEDs, elevating your electronics project game! π‘
Sponsor shoutout: SunFounderβs Kepler kit simplifies your journey with ready-to-use components. π
The importance of neat wiring - precision in building gets rewarded with a functional circuit. π§βπ§
Enhance your programming prowess by making binary counting a reality with physical components. π’
Don't be shy to show off your homework by creating snazzy light patterns and sharing them online! π
Overview
In Paul McWhorter's fourth lesson of the Raspberry Pi Pico W series, viewers are in for an engaging session as they learn to create a binary counter using the Pico W. Sponsored by SunFounder, this lesson utilizes the Kepler kit that includes everything you need, making the setup process seamless and accessible for every hobbyist.
Paul does an excellent job of walking through the intricacies of setting up a 4-bit digital counter. The demonstration includes connecting four LEDs using current-limiting resistors, establishing a ground rail, and ending with a simple_code that brings the hardware to life. This step-by-step tutorial emphasizes the importance of neat and accurate wiring for crafting a flawless project.
Adding a creative twist, Paul sets a homework challenge for viewers to elevate their projects by adding a fifth LED and designing interesting light patterns. The lesson encourages viewers to post their creations online, fostering a community of electronics enthusiasts eager to showcase their ingenuity and learn from one another.
Chapters
00:00 - 01:30: Introduction and Setup The chapter introduces the video series by Paul McCarter from toptechboy.com, specifically episode four, which focuses on leveraging the potential of the Pico W. The introduction includes a casual suggestion to have a glass of iced black coffee with no additives while engaging with the tutorial.
01:30 - 03:30: Schematic Explanation The chapter provides an introduction to the video series sponsored by Sun Founder and highlights the use of the Kepler kit for Raspberry Pi Pico W in the lessons. The kit is praised for its inclusion of the Pico W and its overall awesomeness. Acknowledgement is given to those who have already ordered the kit.
03:30 - 10:30: Building the Circuit The chapter titled 'Building the Circuit' starts with the instructor providing a link to purchase identical hardware from Amazon to make the learning process easier. The instructor emphasizes that having the same hardware will simplify both their job and the students'. The chapter then moves on to address the main content, which is the instructor's solution to a previously assigned homework task from lesson number three.
10:30 - 20:00: Coding the Binary Counter In this chapter titled 'Coding the Binary Counter', the speaker opens with an engaging and motivational dialogue, encouraging listeners to comment on their success or challenges with the provided homework. He uses humor to lighten the mood, referring to failing at the task as 'folding up like a cheap Walmart lawn chair'. The homework task involved creating a four-bit binary counter, and the speaker expresses confidence that the listeners were given adequate information in the first three lessons to accomplish this task. This chapter likely revolves around discussing solutions, methodologies, or insights related to coding the binary counter.
20:00 - 21:30: Demonstrating the Binary Counter In this chapter, the author demonstrates how to create a digital counter using four LEDs. The chapter begins with the introduction of a schematic necessary for building a four-bit counter. The setup requires four LEDs, each coupled with a 220-ohm current limiting resistor, and a Pico W to operate the counter. The chapter sets the stage for building and understanding basic digital electronics using these components.
21:30 - 23:30: Homework Assignment The chapter discusses a task involving setting up LED lights. The process involves connecting each LED using a 220 Ohm resistor to the ground rail, ensuring that the short leg of each LED is correctly connected. The narrator explains the setup and their reasoning behind the configuration.
23:30 - 26:00: Conclusion In the Conclusion chapter, the focus is on the ground rail and pin configuration, particularly concerning physical pin 18, which is designated as a ground. The explanation includes a step-by-step guide on how to connect and identify this pin among others, elaborating on its role in the circuit by making an entire row of holes become a ground once the connection is made.
Raspberry Pi Pico W LESSON 4: Create a Binary Counter Using the Pico W Transcription
00:00 - 00:30 hello guys this is Paul McCarter with toptechboy.com and we're here today with episode number four in our incredible new tutorial Series where you're releasing the power of your pico W what I'm going to need you to do is for yourself a nice tall glass of ice cold coffee that would be straight up black coffee poured over ice no sugar no sweeteners
00:30 - 01:00 none needed and as you're pouring your coffee as always I want to give a shout out to our friends over at Sun founder Sun founder is actually sponsoring this most excellent series of video lessons and in this class we will use be using the Kepler kit for Raspberry Pi Pico W from Sun founder and this kit is pretty awesome and it actually includes the Pico W now I know a lot of you have already ordered your kit but if you
01:00 - 01:30 haven't yet look down in the description there is a link over to Amazon and you can hop on over there and pick one up and believe me your life and my life are going to be a whole lot easier if we are working on identical Hardware but enough of this Shameless self-promotion let's jump in and talk about what I am going to teach you today and what I'm going to show you is my solution to the homework assignment that I gave you in lesson number three so first of all how many of
01:30 - 02:00 you guys were successful with that homework if you were successful leave a comment down below I Am Legend double chest bump or if you were not able to do it leave a comment down below I folded up like a cheap Walmart lawn chair okay really guys I gave you enough information in the first three lessons to do this homework so I hope a lot of you guys were able to do it and what the homework was was to create a four bit
02:00 - 02:30 digital counter using four LED okay now let me show you how I did it by starting out here and showing you the schematic that I did okay so if we look at this schematic first of all if it's going to be a four bit counter I'm going to need four LEDs and each LED is going to need a 220 ohm current limiting resistor and and then I'm going to need my Pico W so the first thing that I did was I just
02:30 - 03:00 came across and put all four LED in okay and then I went from the short leg of each LED through a 220 Ohm resistor to the ground rail short LED short leg of the LED through 220 to the ground rail short LED through 220 to the ground rail short LED through 220 to the ground rail now who says that this is a ground rail well I made it a
03:00 - 03:30 ground Rail and if we remember over here on the pin out this physical pin 18 which is the third one over that physical pin 18 is a ground so if you look at this I come over I come over one two three I snag that pin and I connect it to this top row now every single one of these holes becomes a ground why because I made it a ground
03:30 - 04:00 and so I've got four LED I've got four current limiting resistors and now I need to be able to turn each one of those LED on or off individually and so I'm going to come down to pin 20 and come to this far LED long leg and then pin 19 to the next LED long leg and then I jump over the ground and then we are going to have that's 2019 18 this would be pins 17 to the third LED and the
04:00 - 04:30 fourth led to pin 16. so that is how we are going to do it now let's come back over here to the physical world and what you can see is is I have four LED I have four of these jumper wires I have this short one that I'm going to use to establish the ground Rail and then I have my four resistors and so this is going to be a little tricky to get it to where I can see it and you can see it at the same time but the first thing I'm
04:30 - 05:00 going to do is to establish my ground reel the first thing I'm going to do is to establish my ground Rail and that was the one two third pin over going to the top row and with just a little care you can push these in without bending the wires okay that looks really really really really neat okay then what I'm going to do is I am going to come over and I'm going to start kind of
05:00 - 05:30 working from the right and going back to the left and I'm going to create a little bit of a shorter wire here like this and then I'm going to come in and I'm going to go this was uh this was 2019 18 17 16. so I'm going to go to that pin 16 and then I'm going to come out and then this will be where I will put my first led all right let's go ahead and put that in and it's what the long leg right the long leg connects to
05:30 - 06:00 the gpio pin like that and now I need to put my current limiting resistor in and there we're going to go from the short leg I must keep these legs perfectly straight I'm going to go from the short leg like this okay up to the ground reel that I just established like that okay now what I'm going to do is I'm
06:00 - 06:30 going to come in and I'm going to put my next LED in and I'm going to kind of try to pack these in pretty closely and so I'm going to skip maybe I'm going to skip maybe just one just one hole okay so you see I just skipped one hole I lied I didn't skip any holes let me scoot it over by one okay and now I've got it like that now I
06:30 - 07:00 want to come back to I want to come back to the next gpio pin so again this was 16 I'm going to go to pin 17 here get that plugged in okay and now this needs to come over again to the long leg of the next LED like that okay that's looking good and now I need to get that current
07:00 - 07:30 limiting resistor in there so I go from the short leg of the LED up to the ground rail so I've got two now I'm going to come in and do the third one and so I will long leg to the right okay long leg to the right now let's come in I think I'm going to start here at the long leg this time
07:30 - 08:00 start here at the long leg of that led kind of come in long leg of the LED press it in and now I'm going to come over to pin 19. like that and now finally I'm going to get I need the current limiting resistor there so we'll go from the short leg
08:00 - 08:30 up to the ground like that and now we're going to finally come in with the third LED long leg to the right it's looking pretty good now right leg which is the long leg we're going to come and we are going to bring it over
08:30 - 09:00 to if we can we're going to bring it over to pin 20. so I'm now at the long leg of the LED and now are we going to be able to get it over there to pin 20 I sure hope so I'm a little bit tight there I'll start here
09:00 - 09:30 okay so that is in pin 20 and now I'm gonna work my way directly through here and now I'm gonna have to kind of stretch this stretch it and I cannot quite get that to fit to reach so what I'm gonna have to do is I'm going to get a longer wire
09:30 - 10:00 rather than sit and fight with that thing I'll get a longer wire and just kind of bend it around so it looks like one of these green wires would make my life pretty easy [Music] okay so we're going to take that white one out and we're going to come in and we are going to connect to pin 20.
10:00 - 10:30 like that and now I have plenty of room to come in and connect to the right leg which is the long leg like that press that down into pin 20. and we're starting to get a rain out there let's take a look I don't know if you can see that getting a pretty big rain coming in all right so we will come back over here
10:30 - 11:00 and we have those hooked up and so now I just have the one last current limiting resistor which is going to go from the left leg which is the short leg up to the ground rail okay now this is a pretty darn neat build what I don't like is this kind of uh not real perfectly neat wiring and so what I would do is if I were doing this
11:00 - 11:30 I would make each wire exactly the right length and I would get a little bit more perfect than that but I don't want to slow the video up okay so I think we are ready to start coding and so let's go over here and let's call up our friend Bonnie let's call up our friend Bonnie and let me see I gotta get the view where you can see that
11:30 - 12:00 okay that's pretty good and now what we're going to need to do is we're going to need to set those four things up so I'm going to say from machine import pin all right you should be familiar with that now I'm going to put uh I'm going to put going from left to right I'm going to call it led one is equal to pin
12:00 - 12:30 and then that is going to be pin what well the left most one would be this physical pin 20 which is gpio pin 14. so this is going to be 14 over here this is going to be 14 over here and then uh that is going to be a pin a comma pin dot out like that is that right that
12:30 - 13:00 sure looks right all right now what I'm going to do is I am going to copy that and I need to do that for four LEDs so two three four so this will be LED pin 2 LED pin 3 and LED pin four and then that is going to be gpio pin 15 14 13 12. and so we can
13:00 - 13:30 just go down the row and what did I do wrong yeah the first one is pin 15 14 13 12. and so I've got to correct that so the first one was 15 14 13 12. okay does that make sense I hope it does now the first thing I want to see is I just want to see if I have my circuit
13:30 - 14:00 right if I have my circuit hooked up right in the easiest way to do that is to come over here and just say uh just say uh LED one dot value and I'm going to make it a one okay and now we're just going to paste that three times okay so LED one
14:00 - 14:30 LED two LED 3 and led4 so what I'm just trying to see is is that if I have it hooked up right I want to see all these four of these come on before I go in and do a lot of coding because if I do a lot of coding and it doesn't work then I don't know did I make a mistake coding or did I make a mistake or did I make a mistake with my uh uh with with my circuit hookup so we're just going to go ahead and run this I'll need you to hold
14:30 - 15:00 your breath boom giddy up okay what does that mean that means my circuit is right so I can go in and I can turn these all off zero zero zero zero okay now that should turn them all off okay good so now what I want to do is I want to create a while loop that I'm going to count in so I'm going to say while true when is true true is always true and then what we are
15:00 - 15:30 going to do is uh you are not seeing that you are not seeing that sorry how long have you not been seeing what I was doing okay there it is okay so you can see now what I'm doing is I'm turning these off and I'm going to put them in a while loop okay while true one is true true is always true and so that turns them off and so in effect what is this going to be this is going to be the number zero okay and so now I'm going to need to
15:30 - 16:00 pause here so that you can see Zero so I'm going to say from time import sleep and then I'm going to come down here and let's wait like half a second so I'm going to say sleep 5.5 now what have I just done I have just shown the user the number zero now what do I want to do I want to show him the number what the number one
16:00 - 16:30 now if you remember from our work yesterday the number one would be what zero zero zero one okay now the next one would be zero zero one zero do you see how I'm saying and in fact
16:30 - 17:00 this would be zero one two and now we're ready to do three [Music] and that would be zero zero one one like that okay four would be zero zero
17:00 - 17:30 one zero one zero zero so that would be four and you guys should still have this on paper from when you did it last time and then it just makes it really easy so now it's going to be zero one zero one we're getting through this and now it is going to be zero one one zero zero one one zero okay and now
17:30 - 18:00 we're gonna fill up a lot of these it's going to be 0 1 [Music] 1 okay and now we're going to carry all the way over right remember that so it is going to go all the way over to one zero zero zero and now you can see this is going to start going pretty fast here and so now this is going to be one
18:00 - 18:30 zero zero one and then we're going to come here and this is going to be one zero one zero and then this is going to be one zero one one do you see that we're kind of running out of numbers here pretty quick
18:30 - 19:00 well it is really raining out there it is really really rainy and the electricity is staying on so that's doing pretty good the river's really starting to flow out there goes okay so let's go back and not get diverted anymore and so we've got uh one zero one one and so now we're going to
19:00 - 19:30 have one one zero zero and now we are going to have one one zero one man we're almost there guys we're almost there now we are going to have one one one zero one one zero and now finally we're gonna go all
19:30 - 20:00 the way and we're going to have the whole thing filled up and it's going to be one one now it's at this point that I'm really hoping that I didn't make a copy and paste mistake I am really hoping that I did not make a copy and paste mistake but we turned them all on we know the circuit is working I will need you to hold your breath take a big sip of coffee
20:00 - 20:30 okay let's see if this works and let's count with it count with me okay so one two three go one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen zero giddy up all right we got that done and man we made very few mistakes along the way we got the circuit working we got the hardware working and we are counting in binary baby pretty darn cool I hope
20:30 - 21:00 you guys were able to do this on your own as well but I have a lot of fun just I like to just sit and watch these binary counters I think they are pretty cool and I can count in binary pretty uh pretty quickly I can count in binary pretty darn quickly now uh let's talk a little bit about the homework for next week what the homework for next week is you already I like that fuel a little bit better
21:00 - 21:30 today uh what your homework is for next week is you've already got this circuit built with four LEDs I want you to go ahead and add a fifth LED and that should be easy right you just bring one more LED and you've got five LEDs and then I want you to create just interesting patterns like I don't know if you remember the old not Rider thing with the police car lights and stuff but I want to see who can create the most intriguing or interesting
21:30 - 22:00 pattern using a series of LEDs and kind of explaining what it is once you do it post your solution to YouTube when you post your solution to YouTube leave a comment down below with a link to your solution and then in your solution link back to this video and then you guys look at each other's homework who can come up with the best you know not Rider sequence of lighting up the LEDs or a Thunderdome series of lighting up the
22:00 - 22:30 LEDs but just do something really cool with the LEDs based on your own idea and we want something that has a lot of pizzazz in something that is pretty schnazzy okay guys I hope you are having as much fun taking these lessons as I am making them if you enjoyed the video be sure to give us a thumbs up when you give us a thumbs up also if you've not already make sure that you subscribe to the channel when you do make sure you ring that Bell so
22:30 - 23:00 that you get notification when Futures classes come out and most importantly share these videos with other people because the world needs more people doing coding and fewer people sitting around watching silly cat videos Paul mccorder with toptechboy.com I will talk to you guys later [Music]