Set up a Raspberry Pi Pico W or Pico to use CircuitPython

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
python peeps microcontroller mavens and newcomers to the Raspberry Pi Pico boards and or circuit python I'm professor John Gallagher I'm a university Professor teaching physical Computing a class accessible to students new to programming and engineering and in this lesson we'll quickly learn to set up a Raspberry Pi Pico W or Pico to work with a fabulous circuit Python language we'll install circuit python on the board set up the library files we'll need for the rest of the course and we'll install moo which will allow us to write circuit python programs I use circuit python because although it's very easy to set up and use it's also very powerful wildly cross-platform running on hundreds of boards very well maintained and super well supported by the online community I also love the Raspberry Pi Pico W it's currently only six bucks in the U.S it's a very powerful microcontroller with built-in Wi-Fi and at some point in the future it'll support Bluetooth as well let's prep that board coding awaits now to set up circuit python on any board we're going to need two things we're going to need to install a file so that circuit python automatically runs on the board when it started and once we do that we'll update 8 circuit python with additional libraries that will allow us to use sensors LED lights Motors and other components that we'll be using in subsequent lessons in my course we do that by downloading the circuit python libraries that extend the language and choosing the libraries that we'll need and put those on our board now we can get both of these things the circuit python setup files and the library files at circuitpython.org so open a browser and hit there now so to find the circuit python file we need to install click the downloads tab then find the board that we need now since I'm going to be installing on a Raspberry Pi Pico W I'll type Pico W into the search box up here all these boards have Pico W in their name or the name of the firm behind them but I want this one Pico W by Raspberry Pi now these files are different so if you're working with a plain Raspberry Pi Pico not the wireless Pico W make sure to search for that board now my browser says this is a beta version that's what I'm using at the time that I'm recording this lesson it's quite possible that you have a later version number here or even that the current version is no longer in beta and that's great that means that an upgrade has been released so use whichever version shows up first here now to put circuit python on our board we need this dot uf2 file so click download uf2 now my browser is configured to ask me where to save this I'm going to save mine to the desktop yours might save to the downloads folder but do remember the version number see how it's version 8 here that's going to be important when we're downloading our library file so make sure you remember the version number we'll need that to choose the right libraries now while we have our browser open let's also download the library files that we need just head up here and click on the libraries Tab and scroll down to where you see bundles now I said Remember the version of circuit python that we downloaded we just downloaded a file that was version 8 so since that's the version that I downloaded I'm going to make sure that I download the libraries for that version so I'm going to click on bundle for version 8 if you downloaded Version 9 or a higher number make sure you click the bundle that matches that version once again my browser asks me where I want to save this file I'm going to save mine to the desktop if yours didn't ask you where to save this it's probably in your downloads folder if your files aren't on your desktop you can drag them out of your downloads folder and put them on your desktop if you've got a file that ends in dot zip then you might have to double click it to unzip it my browser does this automatically and if that's the case you can throw away the zip file but at this point you should have two items on your desktop one ending in dot uf2 that's the circuit python install file and another that's a folder not a file with a name that starts with Adafruit circuit python bundle and your version number mine's version 8. so now let's install circuit python on our Pico board we do this once to set up the board and we'll also do it if we ever upgrade the version of circuit python so if we upgrade from a beta version to a release version or say from version 8 to Version 9 so to do this we're going to drag over the dot uf2 file onto our board but we only do this when the board shows up on our desktop in bootloader mode and you'll know that's the case when your board shows up named RPI Dash rp2 now to get your board in bootloader mode first plug your USB cable into your computer then on your pico board find the button named boot cell hold that button down while you plug your micro USB cable into your board most micro USB cables only go in one way so make sure you're plugging it in the right way and you should should see a volume mounted on your desktop that says rpi-rp2 that's what you want you can release the boot cell button but if you don't see rpi-rp2 then unplug your board hold down boot cell and try plugging your board back in do not continue if your board says circuit pie that's not bootloader mode at this point your board needs to be in bootloader mode that means it says RPI Dash rp2 now once we see that find the circuit python file that you downloaded that one that ends in dot uf2 it likely starts with Adafruit Dash circuit python Dash the name of your board so mine starts with Adafruit circuit python Raspberry Pi Pico W and click and drag that uf2 file and drop it in your rpi-rp2 volume after this copies over you'll see rpi-rp2 Dismount it'll go away and you'll see it remounted with the name circuit pie and if so congratulations you've just added circuit python to your board from now on whenever you plug in your board as long as you don't press boot cell the board should show up with the name circuit pie this means that the board is ready to be programmed in circuit python now before we continue let's also set up the lib folder for our board so that it has all of the library extensions for circuit python that my students are going to be using with their course now the files we need are in the folder that we just downloaded named Adafruit circuit python bundle so I'm going to go up there and open that up now there are examples in here that you can explore on your own if you ever want to see how to use various Library files that work with different components but what we want now is this lib folder so open that up that's where all the libraries are and there are hundreds of libraries in here so many that we can't drag them all onto our board there's not enough space on the board so we're going to select the ones that we need and copy them to a separate folder that we're going to create named lib and then we're going to drag this smaller lib folder onto our board so I'll create a new blank lib folder on my desktop since I'm using a Mac I'll right click or two finger click on my desktop and select new folder then I'll rename this folder lib all lowercase letters very important that's named exactly like that if you're a Windows user I'm going to assume that you can figure out how to do something similar on your own and now here is a list of the files and folders that we want to copy over into this new lib folder now you can just drag them over from this original folder here into the new folder but that'll move them and I prefer to copy them so that the files remain in the original folders but I get a copy in my new folder and on the Mac you can make a copy by option dragging a file and dropping it in the new location so we'll do that now and I'll read out the names as I drag them over so that you can follow along Adafruit apds 9960 this is a proximity and gesture sensor Adafruit bus device this lets us wire up our stemma QT devices we'll use this for a bunch of our sensors and inputs Adafruit to bouncer.mpy this is for debouncing buttons so that only one press at a time is detected Adafruit hid this is for human interface devices so that we can simulate Mouse movements and keyboard presses Adafruit LED animation this simplifies neopixel LED light animations Adafruit mcp9808.mpy this is a temperature sensor Adafruit Dash Mini mqtt will use this for Wi-Fi internet of things projects you've got to have the Pico W for this the library doesn't work on the regular Pico because that doesn't have Wi-Fi Adafruit underscore Motors is for working with motors Adafruit and motor kit.mpy is also for working with motors Adafruit mpr121 dot mpy is for working with a 12 pad touch sensor Adafruit requests.npy will let us access data over the Internet that we can use in projects in Tech terms this will let us make API calls and then parse the Json that we get back but if you don't know what that means don't worry we're going to learn in a future lesson we'll also learn how we can get time weather and other data over the internet again this only works with the Pico W because we're using Wi-Fi Adafruit tix.mpy is also needed to debounce buttons Adafruit vl53l1x dot mpy is a distance sensor that we use in a future lesson neopixel.mpys for working with neopixel lights and simple I o.mpy is used for working with basic input output devices there are 15 items in our lib folder that's six folders and a nine mpy files and now that we've got all of the libraries that we'll need for our Pico W lessons in this new lib folder let's drag the new lib folder over into our circuit Pi board you may be asked if you want to replace the existing lib folder in there if so go ahead and replace it and once that's done congratulations we've updated the lib folder so that we have the appropriate libraries for our version of circuit Python and we can continue with more lessons now if you ever upgrade circuit python to a new version number then you'll also download a new set of Library folders and copy over the library files and folders that you need but until then you shouldn't need to copy over these files unless for some reason your board gets wiped out now I like to keep a backup of these setup files on my computer so what I'm going to do is I'm going to create a new folder called Pico W setup you can save this wherever you want it's a good idea to have these on hand in case you need to quickly reinstall files or you want to set up a new board for another project now very rarely but it does happen I've seen boards get flaky in erase files that were on them so if you've got things handy you can just copy over your uf2 file when you're in bootloader mode that rpi-rp2 and then your lib folder when your circuit Pi volume appears now another thing to be aware of sometimes boards with the rp2040 chip and that's the chip that the Pico boards use get a little bit flaky in fact this webpage here in the interfer site says if your pico board ever gets into a really weird State and doesn't even show up as a disk drive when installing circuit python try installing this nuke uf2 file which will do a deep clean of your flash memory you will lose all files on the board but at least you'll be able to revive it after nuking reinstall circuit python so I put a URL for this page in the description for this video and you can follow the new constructions to wipe out and reset your board if you ever need that but if you do that you'll have to add circuit Python and bootloader mode again and then re-add your lib folder when you're in circuit Pi mode now my students are at this point in their course where they've already been working with the moo editor they've already got it installed but if you're new to Circuit Python and you haven't installed the moo editor here are the instructions on how to get that free moo circuit python editing software on your computer so let's get Moo we'll open up a browser go to the unusual URL code with DOT moo there's no.com in there click download since I have a Mac I'm going to click download under the Mac option your browser May save your file to the downloads folder my browser asks me where I want to save I'll select the desktop then you can minimize your browser double-click the DMG file agree to the terms of service we see some files being installed you'll see a moo icon on my desktop but I'm going to ignore that icon then use this install window to drag the moo editor icon into the applications folder that'll copy move into the applications folder and then you can close the finder window and also drag these two icons into the trash they were used by the installation process we don't need them anymore if you open the finder window and click the applications folder you can now verify that you've indeed got a program called moo editor in there now I'm also going to drag a move editor from my applications folder into the dock then you can double click to launch moo on the Mac you'll be asked if it's okay to open Move since it was downloaded from the internet and not the App Store click open this is okay moo will load and if you're asked to select the mode make sure that you select the option that has circuit python in it so nice work pythonista your board now has circuit python installed loaded with libraries and ready for greatness and your computer is cooking with moo so next up we'll start coding so that you can start to make something awesome
Info
Channel: John Gallaugher
Views: 6,831
Rating: undefined out of 5
Keywords: CircuitPython, Python, Adafruit, Circuit Playground, Bluefruit, Express, Tutorial, College Course, University Course, School, Print, beginner, tutorial, fun, Physical Computing, undergraduate, maker, newbie, python, electronics, making, engineering, Mu, .uf2, uf2, configure, lib, library, module, modules, libraries, setup, set, up
Id: ND5UhTQlfWw
Channel Id: undefined
Length: 11min 32sec (692 seconds)
Published: Sun Jan 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.