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