Kassian's IoT Hour
Let's dig into how you can use Serverless to supercharge your IoT projects! We'll walk through setting up a remote sensor and LED with Cloudflare Workers, Workers KV, and a Raspberry Pi.
Good afternoon, everybody. This is the IoT Hour. I am Kassian, and today we are going to swap platforms.
We've kind of done everything we can with the Raspberry Pi, so we're going to be working with the WIO terminal.
So I'm going to stop my screen share so I can show you.
I can show you what I've got here is a WIO terminal, and right now it's running a blink sketch, so you can kind of see the blue light turning on and off.
That's me getting it started in Arduino. So now we're going to run through all the updates and run through getting started with it.
And then over the next few weeks, we're going to hook it up to workers and, you know, kind of supercharge because this has 2G and 5G Wi-Fi capabilities built in.
So we're going to supercharge this with workers, but first we're going to figure out how this works.
So to do that, yes Ace, if you heard that meowing, that was my cat being a cat.
So this is the starter page, and we're going to just bring it started with software.
We've already downloaded the Arduino IDE, and I've already added it to the board manager, so we can skip this part.
I've uploaded a program. Okay.
So I think we've got everything we need in the software overview.
What we're going to do is get started with networking.
Okay, so it looks like we need to update the wireless firmware first.
Okay, so we're going to create the sketch over here.
And tools, make sure, yep, we've got the right one, the right board. All right, so we're going to upload it.
We have terminal Wi-Fi.
All right, let's try this one more time. Oh, yeah, yeah, yeah.
Dropping into bootloader mode here. Okay, let's try uploading that again after dropping into bootloader mode.
Okay, that was successful.
I'm going to move this.
Oh, pardon me. I'm just going to make sure that doesn't happen again.
All right, so I'm going to move this somewhere I can get at it.
Terminal, so I'm going to go. Okay, so we're going to run this.
Was 14.301 was the one?
Yes, okay. Oh, excuse me a moment.
Let's try that again.
Okay, so this will take a little while.
Oh, my gosh.
Oh, it said it was done, but I don't think that's true because it errored out on that.
One more time with feeling. Okay, that's actually erasing.
Okay, now we just got to wait for this.
Okay, so while this is erasing, let's look at some capabilities we will be able to have.
So we'll be able to operate Wi-Fi 2G and 5G. Okay, you can also configure it as a client, it looks like, which is pretty cool.
Yeah, you can configure it as an access point for other devices.
That's pretty cool. Let's see how this is going.
Okay, it's done. Awesome. Okay, the next we need to do is we need to, no, not that.
We need to flash the next version. That was over here.
First, we got to do that, and then here.
Oh, I need to unzip it.
Okay. Let's try that again.
Let's type in just the folder. There we go.
Okay, this is the last thing we need to do.
Okay, so we're going to need these libraries.
So, okay, now we're going to move these libraries to the top.
It's easier to get at.
I'm going to right now, Tools, Libraries.
There we go.
Okay, let me go back to the instructions on how to get those into, you know.
And I'm going to select all of them at once.
I gotta do this one by one by one. There we go.
Let's make sure it's imaged. Okay, so it's all done. Awesome. Now we've included all the libraries and we've imaged the new setup, so we should be able to connect.
So let's do that. Let's connect to a particular Wi-Fi. Well, let's just do the scanning code first to make sure it works.
So we're just going to copy this and go over to Arduino.
I'm going to put this into bootloader mode.
Yes, and then upload.
Okay, so all the libraries downloaded correctly.
Okay, now we should be able to check the serial monitor.
Okay, it's scanning.
Cool, it's gotten a bunch of our... It works.
Awesome, awesome, awesome. All right. So next, what we're going to do is connect to a specific network.
So okay, verified, done.
So let's look at the serial monitor. Connecting.
Come on, buddy, you can do it.
Oh, there it goes.
No, wait, no. It's connecting.
It's still nothing.
Let's change. Should be connected. It should have connected by now.
All right, let's take a look at the...
Everything here, make sure there's something on the screen where you can see it.
Spelled that right, spelled that right.
Still connecting the Wi-Fi, huh?
All right, well, while we let that figure itself out, let's start looking at how we can mess with...
Let's fix that. Let's figure out how we can start playing with the LCD and things like that.
Okay, so this tells the screen with the color red.
Let's try to merge these two so we can allow the Wi-Fi to connect.
We can also try to get those to show LCD.
Okay, so I'm not right-clicking.
Okay, so while it's trying to connect to the Wi-Fi, it should turn the screen red.
So let's upload it and see if it works.
A little, little, little, little, little less picky, picky, picky.
I couldn't put a board on the selected port.
It looks like it doesn't see it on the port.
There we go.
Now we'll drop it. Actually, let's try to upload it without dropping it into Google Earth, maybe that's what caused that problem.
There we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go, there we go.
Well it says it's done. Ah, I'll turn on the camera real quick.
So as you can see, the screen is, you can kind of see, the screen is red.
So it is also still looking for Wi-Fi.
Oh, it actually connected this time. Here, I'll show you the screen share.
Share screen. I don't know why this decided to pop down here.
As you can see, it actually connected the Wi-Fi network, and it has an IP address.
So, cool, we've achieved both the things that we wanted to do with this sketch.
Maybe the LCD library made it go on a hike here, I don't know.
Okay, so now what I want to do is I want to print the IP on the screen, on the LCD.
Okay. Okay, so we're going to need to include these two libraries at the top.
Which we already included one.
We're going to have it not fill the TFT with red, we're going to have the TFT fill with blue because we wanted just a moment.
And under here, after we get the IP address. Copy this. Copy this. Copy this.
All right, let's see if this works.
Oh, yeah, probably helps that I need to download those, don't I?
Okay. Okay. Okay.
It says these are included in the library.
For me, this is in the Adafruit zero DMA that requires.
Well, this is installs. I'm going to have to hear something here. Yeah.
I know. It smells something you like in here. Here, I'll give you some. The cat found a bag of treats and was following up.
Very crunchy treats.
Don't know where he found that.
Okay, that was installed. Good. Let's try compiling this again.
You like those?
Hmm, still no.
Oh, multiple libraries were found for these.
Oh, goodness. Okay. Okay.
Okay. Okay, I'm going to do this.
I'm going to copy all of this into a new sketch. Sometimes it does that.
Okay. Let's see.
Multiple libraries found.
Let's see if I can get my fingers stationed correctly.
Okay. I'm going to search this on the Internet real quick off screen because just in case.
Terminal. The. Let's see. Let's see. Let's see. Okay. Okay. Okay.
That's not it either.
So what I'm going to do is, okay. I'm going to close this tab here. I'm going to go into my folder.
I'm going to clear these out.
Now we're going to try to compile it.
Okay, that's something at least.
Now I'm going to put them back one at a time, I guess.
I guess we're just going to put them back.
Okay. I should have added them in that way instead of the correct way.
That's really profound.
Well, that's confusing.
All right, we're going to close our window entirely. Okay. Let me open it.
Mm-hmm. Working with the audience. I'm going to try to figure this out. No, you can't go on the desk.
Stop the share for a second so everybody can see you.
This is Ace.
This is who's been meowing in the background and watching treats and stuff.
So now you've seen Ace. You're free. He likes being in my lap, but not when I'm holding him like that.
Okay, so now we're going to open.
Ace, you cannot be on the desk.
You can be on your bed. Okay.
Oh, my goodness. Multiple libraries were found.
Okay. Oh, I don't want to put an interface on that.
Okay. It's just early now. Oh, okay.
So I'm in that. Okay. Okay. So whatever it is, that's not the problem. Okay.
So, all right. So we've got to load these back in. Okay.
Free fonts that each know such file or directory. Okay, cool. So now we're gonna figure out where to get free fonts that age.
Let's see if there's a free fonts in the library manager.
Okay, no, I don't see anything in here.
Okay, so where is this font supposed to be coming from?
So we're gonna have to open up.
Should be a wheel terminal.
320 by 240.
Okay. Okay. Okay. Okay. Yep.
Add a file.
Of course it's supposed to be capitalized.
But we're gonna do it this way.
Should work. Should work.
Okay. Let's try this.
Let's try this. That few strings shouldn't hurt, right? Let's see if that works.
Maybe on my lap. Having to argue with a very needy cat right now. Yes, you are very needy.
Yes, you are. You are very needy. Very needy cat. Sweet.
All right, that worked. Okay, so now we upload it. Okay.
Okay, it uploaded. So I'm gonna put on the camera. So you can see it. Go if it does go.
The serial monitor.
Let's see here. Hmm.
What's going on? The screen is blue. And if it connects, it'll, ha, look at that.
Right there. You can see it. Okay. 192.168.1.89. Okay. So we've got this. We've got this working where it shows the IP address.
On the. The screen. So. We've got to connect to the Internet.
And now we can start looking into how to make HTTP requests.
So that we can use this with workers. Okay. Get down. On your bed.
All right. So sharing screen. Are you just done?
All right. Okay. So we got all that set up. Close the terminal. Okay.
Let's go to GitHub.
Let's go to GitHub.
So it looks like we're going to figure this out. So what I'm going to do is HTTP.
Request. Library. Perfect. Perfect.
Fantastic. Okay. Easy way to do this. So we are going to use the last few minutes to connect to a website and get its information.
And then we will do. There is.
By the end of this episode. And we will. Since the next episode of connecting this to workers.
So let's do this.
After that's done. This goes in the loop. Okay. Okay. Okay. Okay.
Okay. Successfully. Let's open up the. Serial terminal. It's taking a second to boot.
Look at that. It's getting information from the, I don't know if this is the right bot, or it seems to have frozen the serial monitor here.
Yep, we have broken the serial monitor, but that's okay.
So let's, let's print out the success message to the, oh, did it break everything?
Might have broken everything.
Yeah, it might have.
Oh, move this back over here so I don't have any other comments, questions, okay, five minutes remaining.
Awesome. So then we're going to restart Arduino. That's not what I wanted.
And instead of spitting everything out into the ether, breaking everything, as it does, what is that?
We are going to pft, do this, and it says 70, 80, we're going to do 90, 90, 90, 90, 90, and we will print the string, connected to website, move this, deal with that later.
Okay, it's done.
Let's watch and see if it does the thing correctly. I'd be holding it in front of my face for it to show up properly.
Open up the serial terminal on my end.
Blue screen. Okay.
Oh, connected to website. Awesome. So it connected to the website and the Wi -Fi network, and it's refreshing that constantly because it looks like it's reconnecting, and that's probably what crashed our email.
So, all right. So that's how far we got today, is we connected it to websites, and, okay, it's not breaking everything this time on the desktop.
So what we'll do next time is we will hook this up to a worker, and I think he will create a voting machine.
So it's got these three buttons on the top, and that way you can vote, and a worker will keep track of the votes.
So we will do that. Share my screen again. And I will see you next week, y'all.
Thank you so much for watching, and I hope you enjoy the rest of today's Cloudflare TV programming.
Thanks again. Bye-bye.