Raspberry Pi Pico

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome to another video from explaining computers this time we're going to take a look at this the raspberry pi pico along with a little tin of a raspberry pi pico accessories that i got to use with the board and the raspberry pi pico what it is is the first micro controller to be launched by the raspberry pi foundation the raspberry pi pico is not a computer it's a microcontroller and therefore in this video the first thing we have to do is to explain the differences between a computer and a microcontroller between the pico and other raspberry pi boards and then of course we'll get the pico up and running so with all that explained let's go and take a closer look right here we have our raspberry pi pico which has an official price of four dollars in which i purchased for three pound sixty here in the uk so let's release it from its little bag there we are tiny little thing the raspy pie pico and here's the accessory tin i also purchased to use with the board another shiny tin get inside here there we are all bit of foam and in here there's various things there's a usb lead there's various headers which we'll be using later in the video but i said i'd start out by explaining the differences between a microcontroller like the raspberry pi pico and a computer so let's take the raspberry pi pico and put it down over here next to a raspberry pi zero which is a five dollar general purpose computer so other than the physical size what are the key differences well a microcontroller like a raspberry pi pico or an arduino is a programmable device for controlling other electronic components microcontrollers are loaded with a program for undertaking a specific task and therefore they don't need to run an operating system or to have lots of ram or lots of storage or to have connectors for traditional computing peripherals like a monitor or a keyboard so if we compare the pi pico to the pi zero we see that the pi zero has got mass storage on a micro sd card it's got a hdmi connector for connecting a monitor it's got a micro usb connector a powering board but also a second micro usb connector for connecting a keyboard or other usb peripherals the pi zero also runs an operating system most obviously raspberry pi os and this allows the pi zero a computer to be used for high-end computing applications in contrast the raspberry pi pico has got a single micro usb connector for powering the board and for transferring programs to it from the computer and it communicates with other electronic devices using its general purpose input output connectors here on either side of the board what all this means is if you want to run end user applications or you want to do complex memory intensive computing tasks like recording or playing video but you need a computer like a raspberry pi zero however if you want to use a dedicated piece of code to control electronic components and to do so in a very power efficient fashion then a microcontroller like the raspberry pi pico is a far better choice the pi pico has also got analog input which we don't find on other raspberry pi models and it also offers much better low latency gpio control the raspberry pi pico is a mere 51 by 21 millimeters in size and at the heart of the board lies the raspberry pi foundation's very own rp 2040 microcontroller chip this contains a dual core arm cortex m0 plus cpu which is clocked at up to 133 megahertz also on the rp2040 is the pico's 264 kilobytes of ram and yes that's 264 kilobytes as this is a microcontroller next to the rp2040 is a chip containing two megabytes of onboard flash storage this may not sound like much but it's perfectly sufficient for storing quite a lot of code next to the storage chip we then have a boot selector button which is used to put the pico into programming mode on the end of the board we find a led as well as a single micro usb 1.1 port for transferring programs to the pico as well as for powering the board power could also be supplied by gpio pin 39 and a ground pin such as pin 38 with the pico accepting a 1.8 to 5.5 volt input i've already started to reference the pico's gpio connectors these 40 pads on either side of the board and to which we'll be adding some headers later in the video if we turn the board over you'll also see that on the back everything is nicely labeled that's great to see and to give you the headlines of the 40 pins we have here 26 are multi-function gpio pins including two uart connectors two spi controllers and two i squared c controllers and we've got 16 pwm channels so what all this means is that the pico is great for things like controlling servos and the spi and i squared c connectors can be used to wire in an lcd display as noted earlier the gpio pins also include three analog inputs which will return a 12 bit number representing the voltage between nought and 3.3 volts it's also worth noting that the pico has got a non-chip clock as well as a temperature sensor although sadly the raspberry pi foundation didn't manage to include on the board any functionality for making a cup of tea the raspberry pi pico does not run a full operating system but can be programmed in several languages including c and micro python micro python is a version of python written in c and optimized to run on microcontrollers like our raspberry pi pico so what we're going to do now is to install micro python on our pico and this can be done using any kind of computer a windows machine a linux machine although here as you can see i'm using a raspberry pi 400 which is running a fully updated version of raspberry pi os and i've got the usb lead it came with my tin of pico accessories plugged into the back of the 400 so all i need to do is to take the pico to hold down its boot select switch so it boots into programming mode and but i need to plug in the lead from the pi like that and hopefully if we cross our fingers there we are the pi has picked up the picot which is mounted as a drive and if we click on ok we will see the pico in the file manager and there's a couple of files here one of which is an index file from the raspberry pi foundation we click on that it takes us out to a web page it gives us lots of support not just for the pico but for other rp 2040 based micro controllers oh look we have to tend to get rid of cookies i wonder how much human time is wasted with us all telling computers we don't mind having cookies which obviously we're going to have if we're using the web anyway enough of such matters down here we can see there's lots of useful stuff including getting started with micro python which we can install of our drag and drop method but i'm not going to do that i'm going to do an even easier method which is to run up get rid of that as well we'll run up sony over in programming here we've got on the pi we've got the sony pre-installed and if you're not working on a pi you can download it from sony.org and when it comes up you will see down in the bottom right it tells us that the python interpreter we're using is currently python 3.7.3 but if we click on that with our pi pico connected we can select micro python raspberry pi pico and you'll see what that causes to happen is this dialogue to come up because we haven't got micro python currently on the raspberry pi pico so i can click here on install and it does the whole thing for us which is very handy indeed so it says starting hopefully it'll sort it out should be nice and quick there we are that looks rather good it's done excellent and if we close on that you can see down here in the shell in thoni we are running python on the raspberry pi pico isn't that amazing so we could now do something what should we do let's execute print and greetings like that and there we are by the magic of computing we printed the word greetings and for even more excitement let's try and turn on the led down here on the raspberry pi pico and let's give ourselves a bit more space to do this there we are like that so we need to do three commands for this first of all we need to set up the relevant gpio pin which is pin 25 permanently connected to the pico's led so we'll do a from machine import pin like that and then we'll define led to be pin 25 as we said and it's going to be a pin output because we want to control the led there we are it is all now set up and then finally if we type led high like that and hopefully there we are we've turned on the led on the pico which is very exciting indeed and if we can stand the pace we can turn it off again with an led low and there we are we're using micro python commands to control the hardware of the raspberry pi pico now while turning the pico's own led on and off may keep us amused ideally we want to control our own components and to facilitate this i'm going to solder on some headers and many people will take mail headers and i'll put them under the board i'll put them like this over here and like this over there like that and the reason they will do things like that is that they can take the picot and they can plug it into a breadboard but as you can see my little breadboard here is too small to have a picot plugged in the top and so what i'm going to do is a little bit different i'm not going to use those male headers i'm going to use two female headers which are going to fit on the top of the board like that and like that that's the configuration i'm going for so now it's time for me to get out my soldier line and to do a little bit of soldering and 40 shiny molten metal connections later the raspberry pi pico is for stoned with two headers and as you can see i've also put it onto a small baseboard just to keep it nice and stable and i've wired it up to five leds on this breadboard with appropriate current limiting resistors so let's connect it to the pi we don't have to press down the button this time we're just connecting it normally to the raspberry pi 400 and we'll go across the pi 400s desktop and we'll launch the sony editor as we did previously which will come up hopefully there we are and you can see we're connected to the pico running micro python but if we weren't we would go down here at the bottom right and we would select the appropriate interpreter so we might have come in for example and found that sony was using the interpreter python 373 but if it was on that we'd just go and select raspberry pi pico and we'd see we're on the pico when we get the pico shell anyway the code i've written here is nice and straightforward just to test things out basically we're importing pin for machine as previously and we're importing the library utime which is a time library which uses the real time clock on the pico as opposed to the library called time rather than you time which uses operating system time and we don't have operating system time here to use and then setting up five gpio pins called led a8e for our five leds as you can see i'm defining a variable called delay and then we've got a infinite looper while true loop inside which i've got some code it says turn on the first led wait for delay turn it off turn on the second etc not the best written piece of code but it'll work for our purposes testing things here so if i execute the code and there we are we now have a running light operated from the pico i do like that you can't go wrong with an led running light can you it's a it's fantastic to see that working so that's all very well but of course what's happening here is we're running with the pico connected to the raspberry pi 400. we really want to run it independently that's the whole purpose of a microcontroller so i'll stop the program and i'm going to save this code not on the pi 400 where it's saved at the moment but on the pica so i'll click save as and we'll select not this computer but raspberry pi pico and we're going to call it main dot pi and if you save a python program on the pico called main dot pi it will auto run so i can click ok on that that's all done i'm not going to close down funny and i'll also disconnect the pi from the picot greetings here i am back again and i've now got a usb power bank which i'm going to use to power the pico so let's just plug this in down here like that and then the power bank has got an on switch here so when i press the on switch the pico should boot up and run our main.point code so let's have a go and there it is it works and this is really what microcontrollers are all about running a piece of code that controls some electronics this is this is very exciting i'm sure some of you are saying chris this is not that exciting i said it is look we've got a running light they're always very exciting think what glennae larson did with running light led characters like the early cylons and kit the car he made a whole career out of running light led characters and more broadly of course this is just a test this demonstrates the sort of things you can do with a microcontroller running a piece of code on a board to link to other electronic components they could be leds it could be servos it could be sensors all type of things like that so this is i think a very exciting development in the world of raspy pydum the new raspberry pi pico the raspberry pi pico is the first micro controller that i've looked at here on explaining computers and it presents all kinds of possibilities in areas like robotics if you'd like me to look in more detail at the pico in future videos or indeed to look at other micro controllers do let me know down in the comments section but now that's it for another video if you've enjoyed what you've seen here please press that like button if you haven't subscribed please subscribe and i hope to talk to you again very [Music] soon you
Info
Channel: ExplainingComputers
Views: 153,706
Rating: undefined out of 5
Keywords: Pi Pico, Raspberry Pi Pico, Pi Pico microcontroller, Raspberry Pi microcontroller, RP2040, RP2040 microcontroller, Christopher Barnatt, Barnatt, explaining microcontrollers, what is a microcontroller, MicroPython, Pico MicroPython, install MicroPython
Id: peLH-HNza44
Channel Id: undefined
Length: 16min 15sec (975 seconds)
Published: Sun Mar 28 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.