Challenger RP2040 Wi-Fi: A better Raspberry Pi Pico W than the Raspberry Pi Pico W?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there my name is gary sims and this is gary explains i really hope you had a chance to watch my arduino versus pico video if you did you will know that the microcontroller chip at the heart of the raspberry pi pico is actually for sale as a separate component and that means that other manufacturers can design micro controller boards using the same chip the rp2040 which of course is a dual core cortex m0 plus processor with 264k of ram and they can make their own boards on it and actually add more interesting features and that's what we're going to look at today the challenger 2040 board comes not only with the rp 2040 so it's the dual core i said m0 plus cpus but it's also got wi-fi and bluetooth using an esp32 board plus a whole bunch of other features and it works with micro python circuit python and with the arduino and with the raspberry pi pico c and c plus plus sdk in fact you can program this thing almost any way that you want so if you want to find out more please let me explain [Music] now one of the key features of the challenger 2040 ball is it does offer wi-fi and bluetooth something you don't get on the standard raspberry pi peaker you do get it on the raspberry pi pcow this is a different way of doing it but it's also got a whole bunch of other things that make it quite an interesting and unique board let's have a look at some of the features so here is the challenger rp 2040 board and at its center is the rp raspberry pi 2040 the microcontroller from the raspberry pi foundation with those two cordless m0 plus cpus and 264k of ram however it's not only about that if it was just about that then this would just be a copy of the raspberry pi pico but there's more and let's start here at the connector the usb c connector so actually i've kind of almost migrated over fully to usbc which is about everything i've got here in my house and i actually have to dig out an older cable if i want to use the raspberry pi pico seeing usbc here is a good step forward and then another interesting thing you have here is this battery connector and the corresponding lipo charger circuit so the idea of course is that you can run this from a battery and the battery can be charged up when it's plugged in and then you can kind of go off and uh just use it uh when it's not uh plugged into the mains but it's running on the battery just like you would charge you know tablets phones or whatever so a great feature already built into the board which gives you as a creator as a maker the opportunity to make portable devices that you know you charge up and you can take them away and use them and do whatever it is you're gonna do with them and there's eight megabytes of flash this is compared to the two megabytes of flash you'd get in a raspberry pi picker eight megabytes of flash uh and so that gives you optimal room for user interfaces for media for any other storage you need to put on there are already built in there on the board and of course there is the wi-fi and bluetooth and that is via an c3 chip maybe that is worth talking about this whole dynamic between having two chips on the ball because that itself has a cpu and memory and ram and maybe if you're interested in that dynamic tell me and i'll make a separate video about it but that provides all the wi-fi and bluetooth and the rp2040 talks to the esp32 uh port chip and they kind of say let's set up the wi-fi let's join this here's some data coming and they kind of just chat to each other so all that wi-fi stuff is all handled by a different chip leaving the rp2040 free to do whatever it is that you want it to do all you need to do is interrogate that other chip and say hey give me give me the data that's coming over the airwaves and there's also a neopixel which is great because it's great having one led which this one has as well it's over there by that usbc uh behind it there between the battery and the usbc it's great having one of those but often it's like i wish i could have two of two or three more to actually tell me what's going here we've got an rgb one so you can change the color and one of the demos i'm going to show you is i change the color of the pixel as it goes through different states like powering up and connecting to the wi-fi and then getting synchronization for the time which is one of the projects i'm going to show you and it changes the led as it goes along that's a really good way of communicating the status of the board and then finally there's two buttons on here on the normal pc you'd only get a boot button we also get a reset button built in so it's all these little things just a usbc you get a reset button you can you've got this pixel chart you've got this pixel neopixel you've got the eight megabytes of flash of course you've got bluetooth weights all these extra things that add up to make this a really versatile board okay so now we can see it's got quite a rich feature set let's have a look at some of the demos using a wi-fi using the neopixel and so on across all the different ecosystems micro python circuit python arduino and so on okay so first of all let's look at how you change the neopixel with circuit python i've also got an example on my github repository and how you do this with micro python and that's using the standard micro python that you would use for the raspberry pi pico because of course it's completely compatible so we need to do is go over here to circuit python i've used version seven there is a version eight available but still in early days you download the uf2 file and then what you do is you reboot your uh challenger board by pressing down the boot button and then either plugging it in or pressing the reset button that will make it appear as a drive on your pc and then you just drag the uf2 file to it and that's it it downloads and installs the uf2 file onto the circuit python circuit python sorry onto the board and then when you reset it you've actually got python running there so let's look at some python code okay so on circuit python you want to create a file called code.pyp for pipe py for python and this code here i've actually it's the stuff that the adafruit people have done i've modified it a bit of course kept all of the uh copyrights and everything and so basically there's a couple of functions here at the top which are just to do with colors because we're going to cycle through some colors because that makes it look nice and wheel and rainbow cycle just fiddle with that you can just look at it it's basically red green blue stuff you don't need to worry about it too much but interesting to look at if you want to and the way you use it is you say pixels is equal to neopixel.neopixel and that's all built into circuit python so you don't need to do anything extra you need to do some imports here up at the top for example there's import of neopixel and you need to give it the number now the pin outs on the challenger board are different to that on the raspberry pi pico so you need to check the pin out diagram and you need to notice that the neopixel is on gp11 so that's what i put in there number of pixels is one because of course neopixels can be a whole led strip they're just one of these here and basically the same time we're also going to flash the led that's on the board itself and that's attached to d13 okay very simple all we do is we say fill the pixels uh with uh two five five five two five f zero to start with turn the um turn the light on the led on the board go through all the different colors okay which was does this one here and it fills them with different colors according to the red green blue that gets returned here from the wheel function just cycles through the colors basically then we turn the led off and then we do the same thing again and then we loop so basically this the led the green led on the ball will flash on and off once every two seconds or two three seconds or something because this one goes through all the different colors so this kind of acts as a delay if it was a normal flashy blink program but actually what it's doing is cycling through all the colors on the neopixel and then that's it it's a very very simple piece of circuit python code and it just shows you how you can access the neopixel and it works just absolutely great now the next bit of code i want to show you is how you can run a kind of time synchronization over the internet how you can power a small oled display with the ssd 1306 driver i've got i cover that in a few other videos here and how you can use the esp remember it's an esp32 chip that's doing the wi-fi stuff so esp at control is a library that allows you to talk to the wi-fi and get all the wi-fi stuff up and running and what we actually do is we're going to connect to this website called worldtimeapi.org now world worldtimeapi.org is a really great website basically you can just request with http a time zone and it will just give you back all this information uh including the current time including when daylight savings starts and stops what time zone you're in and all that kind of stuff so really really good there's a there's a whole bunch of examples of what you have to do to call to get different things as a specification which defines all the different bits that you can that you can access all the different urls you call and what they do really really uh well done and we're going to use it we're going to actually just request a url and it will bring us back in json some of this time information and then we can so we basically sync up the real-time clock on the board and uh one thing noted this isn't a commercial service so they have some stuff in the faqs about this is great for hobbyists great for if you want to try it but don't use it for a commercial service but what we want to do it works absolutely great so first we've got this function called sync time with world time api org okay and that basically if you can look in it here it basically goes off and gets some json at this http which is basically based on your ip address does the geo location stuff works out where you are in the world based on your iphone and gives you the current time and time zone for where you are you can't specify time zones in here according to that api or just go and look up in the documentation there once you get the json back you definitely need to parse it and in here we can get the minutes and the seconds and the day and the year and the month all that stuff out there you can even get things like the day of the week anything that's in the json and then basically one of the parameters that's passing is the real-time clock and we'll look at that in a second and you basically just say well create me a time structure that's got all the bits in it hours minutes second daylight saving and then just set the time so now the real time clock on the board is actually set to the correct date and time remember we're also using this oled display so this is an i squared c so basically set up an i squared c you call the function to initialize the the ssd 1306 driver as i said i've covered that in other things and basically to do it you fill the display it's a pixel-based display you fill it with display you write some text in there's a font file you need that you'll find in my github repository and then you show the text you've written so it's basically bit based the text is created according to a font and so as we go through the very first things we put in it dot dot dot on the screen okay now here is the creation of the real-time clock rtc which is something that we import here so it's part of the ball setup the real-time clock okay and then we need to try to connect the internet and use this file called dot p y so secrets dot py looks like this it's basically a structure that contains the name of your ssid and your password you would put in here your ssid and your wi-fi password it takes them out there that means you don't have to include it in this code here which means you can publish it and do changes and all that and not worry about the secrets uh just need to change that for your thing uh if this is a challenger board which it is there's some code here for how you set up uh the stuff for the wi-fi talking to the esp chip okay if it's not you do this way bait i left this code this is a template code that you get left this code in here it would work on other esp boards as well but we are of course using the challenger one and then at this point now i say let's change the display to connect and at this point it's now gonna actually try to connect there you go wi-fi manager actually try to connect to the wi-fi network and once that's done okay it will then put sync dot dot on the screen and then it will call our sync function which we've just called up here which then calls world tame ipi gets the json back and then parses it and once you do that you then just go into a loop here that just shows the time on the screen look you've got the oled fill oled text oled show now the only little thing in here they've also got this counter for sync counter which every 85 000 times it will force another sync now one of the parameters of sync is whether it should be blocking or not which basically means if it fails it won't just sit there going oh i'm still waiting to get an answer back i'm still waiting to get an answer back it will carry on to the the rtc the real time clock will just stay as it was and it will try again next time to synchronize it and this basically means you can actually have this board up and running you've got the real time clock and then once a day it will also check to make sure that the time is in in sync and this will just go round around displaying the time on the board and so that's a really really interesting way showing how to use an i squared c display and how to access uh over the internet to get something over the internet in json and parse it so that's a great boilerplate code there for just lots and lots of different types of projects that you might want to do now if you remember also the challenger board works with the arduino ide and there is a project called arduino pico and this basically allows arduino to run on the raspberry pi pico and on lots of boards based on look at all these boards that are listed here and of course we're using this one the invicta labs challenger rp 2040 wi-fi and bluetooth lots of other balls here now here's the full instructions on how you set this up inside of their arduino exactly what you need to type in and where i'm not going to go through all that there because it's pretty easily display explained but once you've got that set up you now have board support for the challenger board inside of arduino okay so here i'm in arduino with all that board support stuff set up there's some requirements you're going to need here you need to make sure you get all those libraries and install them what are they basically the board support as i was just showing you the neopixel library the wi-fi esp80 which is the library that allows you to talk to that other chip and set up all the wi-fi the time library and the esp80 air mqtt live if you don't know what mqtt's i've got a couple of videos there about that here on this channel and we're only using this because it's also got an ntp function in that library we're going to use the mtp function makes it pretty easy also notice because the challenger board has an 80 firmware that's for the esp32 board greater than 2.1 you need to make sure that you comment out this line here in this file here just follow these instructions it will work if you don't do that the wi-fi won't work properly so it's basically there are different versions and you have to basically tell it which one it's using also if you want to turn off the debug statements there's too much stuff coming out of your console follow that instructions there all this will be in my github repository so you can just follow it through and make sure you've got all the right libraries so basically what we've got here is we've defined basically your ssid and your password your we want to set up the neo pixel and we want to know it's on pin d14 uh notice that's different to what i was showing you in circuit python because depending on whether you're using circuit python micropython arduino you've got to use different naming but the pin out diagram they give you covers all of the different variations uh and basically you want to define your time zone because we're just doing straight ntp stuff now we're not going to do anything to a clever service like we're just going to get back utc time this is a very crude method here of just saying what time zone you're in might not work for time zones that have half an hour increments or even 45 uh 45 minute increments could be expanded it wouldn't be too hard but this is just a simple idea to show you how it works set neo basically is a function to set the pixel color to a red green blue value very simple now in the setup loop we want to first of all set up the pixel to be a kind of white so we know that things have started everything is white to start with you then basically need to connect to the wi-fi chip make sure it's all working if there are an error there it goes it goes red okay and then if it can't communicate with the module again it just goes a different color there whatever i've said it to be uh with a red green so any without any blue in it there and then once we know that everything's working we set it to green uh sorry to blue sorry so that we know we're now in the stage which tried to connect to the network once it's connected we set up this mqtt library basically because we want to get the ntp time once we get the ntp time we then set up a web server uh where's that defined let me have a look here it is mist at the very top there web server on port 80 again this is all part the standard arduino library stuff you get and once you go into the loop this basically loops around waiting for requests as you can see it sends back http and html here so it's a web server when you get a connection it will just play back the timing we can see that here in this print line of the time so just text variation of the of the time just gets displayed on the screen so you're basically now this will show you how to use a challenger 2 a connect to the wi-fi b use the neo pixel to control different things c connect to ntp to get the right current time from it and then finally how to run a web server to service that time of course you could be doing all kinds of things with that web server but you know the time is right and you can access the neo pixel so quite a little demo here but it does quite a lot of things to show you all the basic things you might want to do with your challenger board this time using the arduino ide okay so there it is now i think you'll agree that's a really versatile board now the point is this is it's more expensive than the raspberry pi pico w but not by much considering you get that eight megabytes of flashing usb c you got the neopix of course you've got the wi-fi the bluetooth and you've got the charging circuit for batteries this thing actually only costs 15 euros which is actually a pretty good price when you consider the feature set i'll leave a link of course to where you can get it in the description below okay that's it my name is gary sims this is gary explains i really hope you enjoyed this video if you did please do give it a thumbs up if you like these kind of videos i invite you i implore you stick around by subscribing to the channel don't forget you can follow me on twitter at gary explained and i also have a monthly newsletter go to garrixspace.com type in your address no spam no spam but you will get the email okay that's it i'll see the next one [Music] you
Info
Channel: Gary Explains
Views: 45,808
Rating: undefined out of 5
Keywords: Gary Explains, Tech, Explanation, Tutorial, Raspberry Pi Pico, Challenger RP2040, Challenger RP2040 WiFi, Challenger RP2040 WiFi/BLE, ESP32, Microcontroller, ESP32-C3, ESP32-C3 Wi-Fi, ESP32 AT Command Set, ESP-AT Firmware, ESP-AT Command Firmware, RP2040, RP2040 from Raspberry Pi, ESP32C3 from Espressif, Espressif, 8MB, 8MByte, NEOpixel, RGB LED, LiPo, LiPo charger, Invector Labs
Id: eNjvjc0sMNE
Channel Id: undefined
Length: 18min 48sec (1128 seconds)
Published: Thu Jul 28 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.