Learn how to get started with Raspberry Pi Pico by soldering headers, writing codes, and building a classic blinking LED project in this tutorial.
[0:01] All right!
[0:02] Getting started with the Raspberry Pi Pico.
[0:05] So, let’s scroll down and see what we’re going to be doing.
[0:10] It looks like we’re making a classic blinking led.
[0:14] Let’s see what’s required.
[0:16] So, a Raspberry Pi Pico with soldered headers.
[0:20] I guess we’d better get some headers onto our Raspberry Pi Pico.
[0:25] So, the easiest way to do this is to actually put the headers into a breadboard
[0:31] and then rest the Raspberry Pi Pico on top of these headers
[0:36] and that gives you a nice stable platform to solder the device on
[0:41] and you’ll get nice square headers that fit nicely into a breadboard
[0:46] so, we’ll get all these headers lined up
[0:51] it can be quite hard to push the headers into the breadboard
[0:55] but wiggle them around and they’ll go in nicely
[0:59] so, with the headers in place we can just put the Pico on top
[1:09] and it’s nice and firmly held
[1:11] and now we just solder up each pin in turn
[1:15] some of the pins do have quite a large ground plane attached - so they may take a bit more
[1:21] time on the soldering iron to solder but most of them should solder up pretty straightforwardly
[1:48] so, that’s our board all nicely soldered up
[1:51] We’ll do a quick visual inspection to make sure everything is properly soldered
[1:56] and it all looks pretty good. So let’s see what’s next in the list of instructions
[2:05] Next in our requirements is a computer which I think we have
[2:10] and some electronics components
[2:12] An LED, a resistor, and a potentiometer
[2:15] breadboard - well we’ve just soldered our Pico into a breadboard
[2:20] and I think I’ve got a power pack around
[2:23] so I’ve got a 5-volt USB power source
[2:26] Let’s see what’s next
[2:28] We’re going to install the MicroPython framework
[2:31] We’re going to learn all about that
[2:33] We’re going to learn to program the Pico
[2:35] How to connect it
[2:36] Okay, next
[2:39] Well here’s our pico I think we’ve seen that just now.
[2:43] So put it in the breadboard
[2:45] I’ve done that so that’s good
[2:48] and plug it in
[2:49] and we’ve done that as well
[2:51] so check, check, check,
[2:54] One slightly annoying thing with the pico is the pins aren’t labelled on the top
[2:59] So it might be worth printing out that diagram.
[3:02] Let’s install this piece of software Thonny
[3:06] Let’s go to their website.
[3:08] I’m running on a MAc so I’ll download the Mac version
[3:14] and now we’ll just install this piece of software
[3:28] OK, that was fairly painless
[3:30] So what’s next?
[3:33] Let’s go back here.
[3:36] So launch Thonny from your application launcher.
[3:39] Let’s do that and now we have Thonny up and running.
[3:47] Let’s see what’s next.
[3:48] So we’re just going to run some python code
[3:51] So let’s try printing hello world
[3:57] That seems to work okay.
[3:59] So what’s next?
[4:01] MicroPython firmware.
[4:03] So push the BOOTSEL button while you’re connecting it.
[4:08] So let’s do that quickly.
[4:09] So disconnect
[4:11] I do think this cable is eventually going to break
[4:16] I’ve seen a few people on the internet
[4:17] putting reset buttons on their Pico so I think that would be a good idea
[4:22] So let’s see so now.
[4:24] I think I’ve already got MicroPython installed but we’ll run through the installation steps again
[4:30] We’ll click on this
[4:34] and it’s popped up a window so we’ll just run the install process
[4:46] Okay, that’s done. So what’s next?
[4:52] So yep use the shell okay let’s see what happens
[4:58] So look at the shell prompt and we should see um Raspberry Pi
[5:04] I can see I’ve got some red text.
[5:06] So let’s just try plugging in again and see if that works.
[5:12] And let’s try stop and restart.
[5:13] It seems if you don’t see the prompt, stop and restart is the button to push.
[5:18] So now we should be able to do some more printing
[5:22] We’ll print hello
[5:25] Yeah, that seems to work as well.
[5:27] So let’s see if we can actually do something here.
[5:30] So it looks like we’re going to be lighting up an LED.
[5:34] So copy and paste the code.
[5:36] It seems like I have to push return twice when copying and pasting from the website.
[5:42] That’s probably just my machine but if nothing happens then you should do that.
[5:46] So the LED works
[5:49] Let’s try turning it off.
[5:51] So, we’re basically just turning off and on the built-in LED.
[5:57] Okay, so what’s the next.
[5:59] The classic blink sketch
[6:03] Okay, so now we’re gonna use the main editor.
[6:05] So let’s copy this code into here.
[6:08] So pin 25 is the built-in LED and we’re just going to turn it on and off
[6:15] So click the run button
[6:18] And we’ll save it on the… let’s see what they say
[6:23] Okay so they want us to save it on the device
[6:25] So let’s save it to the Raspberry Pi Pico and we’ll call it blink.py
[6:36] Okay so the LED is on because we hit run
[6:40] What happens if we run again?
[6:42] Okay so we’re just switching the LED off and on using this LED toggle
[6:49] So what’s next?
[6:50] We’re going to use a timer now
[6:52] So we need to add timer to the import
[6:57] and then we create a timer
[7:00] and now we have this callback function
[7:03] I think we’ll just copy this and paste it in
[7:08] and then we’re running a timer which will call this blink function
[7:13] I guess that’s two and a half times a second
[7:16] So let’s run that
[7:18] okay so now our LED is blinking
[7:22] so that was fairly painless
[7:24] Let’s stop that
[7:26] What’s next?
[7:27] So what are we going to do?
[7:30] Okay, so a resistor and an LED and a couple of jumpers
[7:35] Let me uh dig those out
[7:38] Okay, so let’s see, they say they want us to put
[7:43] an LED from GND and a resistor from pin 25 to the led
[7:56] and then we just need a connector from the Pico’s ground to the ground of the LED
[8:04] So what’s next?
[8:08] So what we’re doing is changing the pin number to pin 15
[8:12] which is the output we’ve connected the LED to
[8:15] and then we’re just toggling it
[8:16] so let’s run that
[8:18] …and nothing’s happening
[8:23] I think I’ve got my LED the wrong way round
[8:30] okay another blinking LED
[8:33] pretty good
[8:36] so what are we doing now?
[8:37] a button - okay, let me go and find a button
[8:43] and we’ll stick this in and I’m running out of space
[8:52] I’m not sure which way around this button actually works
[8:54] I think it’s this way round
[8:56] So we’ll stick that in
[8:58] and they want us to connect that to the positive supply
[9:03] So 3.3 volts
[9:06] So we need another couple of jumpers uh let’s wire up the 3.3 from the Pico
[9:15] Make sure we don’t uh short circuit
[9:17] okay and now we’ll connect the button up to that positive rail
[9:29] okay and then they want us to connect this to
[9:32] the pin that’s just above where we connected the resistor
[9:36] so let’s stick that in there
[9:39] um so what’s next?
[9:41] ah pin 14 okay
[9:43] so we’re now adding a button connected to pin 14
[9:48] and it’s setting it to input and making it a pull-down
[9:51] I’ll just copy all this code
[9:53] so yeah so we still got the LED on pin 15 we have a button on pin 14.
[9:58] It’s an input and we’re using a pull-down resistor
[10:01] I’ll just fix this white space and when the button’s pushed we toggle the LED
[10:07] Let’s see what happens
[10:11] um, absolutely nothing
[10:13] Interesting…
[10:17] there we go, let’s try that again
[10:20] is it working?
[10:24] There we go! So now when we push the button the LED toggles
[10:32] I think that cable’s a bit dodgy
[10:36] okay, what’s next?
[10:39] okay we can hold the button down and it will flash
[10:41] that makes sense
[10:43] so okay controlling the brightness with PWM.
[10:47] So pulse width modulation
[10:49] So what are we doing now?
[10:50] Let’s copy this code
[10:54] So we’re now importing PWM and we’re connecting PWM to pin 15
[11:01] We’re setting the frequency to one kilohertz.
[11:04] Um it’s interesting this number uh 65025 you’d normally expect it to be 65535
[11:18] but let’s run this and see what happens
[11:20] okay so our LED is glowing on and off
[11:32] so let’s check this number it seems strange
[11:34] I’m going to change it to the full range of int 16 and just see what happens
[11:54] oh it still works
[11:55] so what’s next?
[12:02] okay so we’re going to start doing some analogue to digital converter
[12:07] Now this will be interesting
[12:08] So we need a potentiometer now
[12:10] So let’s go and find a potentiometer and wire that up
[12:27] I think I definitely need a slightly bigger breadboard for this
[12:31] So we want to connect the right-hand side of the potentiometer to positive
[12:42] get that wire in
[12:56] and then the left-hand side of the potentiometer to negative
[13:18] okay and then the centre tap is going to pin
[13:31] what pin is this?
[13:37] let’s see where we are we’ll just count
[13:42] okay so that’s 10 pins down so it’s that one
[13:51] so let’s copy this code
[13:56] so what are we doing now?
[13:58] so we’re going to be reading from pin 26 using the ADC
[14:04] so as we turn the potentiometer we should see the value changing from its maximum to its minimum
[14:11] so maximum 65535 down to well that’s as far left as I can go so there’s a slight offset on the ADC
[14:20] so what’s next?
[14:23] so it looks like now we’re going to control the PWM by reading from the ADC so let’s try this out
[14:33] so as I turn my potentiometer up the LED gets brighter
[14:37] as I turn it down the LED gets dimmer
[14:40] so we have a basic dimming circuit
[14:43] okay so what’s next?
[14:46] Power your Raspberry Pi Pico
[14:49] okay so they want us to save this file
[14:53] and they want us to save it to main.py
[14:57] okay device is busy um let’s try hitting the stop button
[15:02] let’s try that again
[15:06] okay save to main
[15:12] okay and now once connected it should run automatically
[15:16] so let’s disconnect from our computer and we’ll connect up to a USB power pack and see if it works
[15:25] I’ve disconnected from the computer now I’m just gonna plug it into a USB power pack
[15:39] okay it seems to be working
[15:42] so our sketch in main.py now runs every time the Pico boots
[15:51] So I think that might be it, what’s next?
[15:53] Yeah that’s it
[15:53] so that was the intro to the Raspberry Pi Pico
[15:59] I must admit I actually quite enjoyed that.
[16:02] That was quite fun!
[16:04] It’s quite nice this embedded python - pretty cool
[16:08] so I might try MicroPython on my ESP32 sometime
[16:14] That was quite enjoyable
[16:15] Hope you enjoyed this as well and I’ll see you in the next video!