Kassian's IoT Hour
Presented by: Kassian Rosner Wren
Originally aired on February 15, 2021 @ 7:00 PM - 8:00 PM EST
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.
English
Transcript (Beta)
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 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 this 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.
Okay, 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.
Hmm, error occurred.
All right, let's try this one more time. Oh, yeah, yeah, yeah, drop it into bootloader mode here.
Okay, let's try uploading that again after dropping into bootloader mode.
Okay, that was successful.
Okay, okay, I'm going to move this.
Oh, pardon me. So, 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.
It's 14.301 was the one.
Yes, okay. Oh, excuse me.
Okay, 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.
Okay, one more time with feeling.
Okay, that's actually erasing.
okay, now we just gotta 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. So, 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 gotta do that.
And then here. So, oh, oh, I need to unzip it.
Try that again.
There we go. So, this is the last thing we need to do.
Okay, so we're gonna need these libraries.
So, okay, this.
Okay, now I'm gonna move these libraries.
That's top. It's easier to get at.
Okay. You know, tools, libraries.
Here we go.
Okay, I'm going to go back to the instructions on how to get those into, you know.
And I'm only going to select all of them at once, so I've got to do this one by one by one.
So, I'm going to do this one by one by one by one by one by one by one by one by one by one by one by one by one by one by one by one by one by one by one by one by one by one by one by 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. And let's connect to a particular Wi-Fi.
Well, let's just do the scanning code first to make sure it works, so I'm just going to copy this.
I'm going to 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, um, it works.
Awesome. Awesome. Awesome. All right. So, um, next what we're going to do is connect to a specific network.
Okay.
Verified. Done. So, let's look at the serial monitor. Connecting.
Come on, buddy.
You can do it. Okay.
Oh, there it goes.
No, wait, no. It's connecting.
Hmm. It's still nothing.
Let's change. It should be connected. It should have connected by now.
Hmm.
All right. Let's take a look at the, um, everything here and make sure there's something on the screen where you can see it.
Hmm.
It's visible. All right.
Well, while we let that figure itself out, let's start looking at how we can mess with Let's figure out how we can start playing with the, uh, LCD and things like that.
So, let's do that.
Okay. All right.
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, um, try to get those to show LCD.
Okay. So, I'm not right-clicking. Okay. So... Okay.
So... 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.
Okay.
Okay. Okay.
So, let's go in here.
All right. All right. All right. Let's put this in bootletter mode.
Bootletter mode. Bootletter mode. Bootletter mode. Do you mean bootletter mode?
It's a little, a little, a little, a little less picky, picky, picky in bootletter mode.
I couldn't put a board on the selected port.
Oh!
Let's try redoing that.
It looks like it doesn't see it on the port. There we go.
Now we'll drop it. Let's try it without dropping it into bootloader. Maybe that's what caused that problem.
That's strange.
All right, we're going to drop it into bootloader mode. All right, we're going to bootloader mode.
There we go.
There we go.
Well, it says it's done.
Ah!
I'll turn on the camera real quick. As you can see, the screen is red.
It's also still looking for Wi-Fi. Oh, it actually connected this time.
Here, I'll show you the screen share. 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.
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.
The LCD. Okay. Okay.
We're just going to use regular fonts.
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.
Okay.
Copy.
And under here, after you get the IP address, Okay.
Let's see if this works. Oh, yeah, probably helps that I need to download those, don't I?
Okay. Okay. Okay.
Since these are included in the library, Let's see.
Oh, goodness.
While this installs, I'm going to have to get her something here. I know.
You smell something you like in here. Here, I'll give you some. I found a bag of treats.
Very crunchy treats.
Don't know where he found that.
Okay, that was installed. Good. Let's try compiling this again.
You like this?
Hmm.
Still no. Oh, multiple libraries were found for these.
Yes. Okay. Okay.
Okay. Um, I'm going to do this.
I'm going to copy all of this into a new sketch. Okay. If that fixes it.
Okay.
Okay. I'll show you the audience. No. Okay. Let's see. Multiple libraries found.
Cool. Cool.
Let's see if my figure is stationed correctly.
Okay.
Okay.
I'm going to search this on the Internet real quick.
Off screen because. Just in case.
Terminal. Terminal.
Okay.
Okay.
No.
No. No. Okay. Okay.
Okay.
That's not it either.
Okay.
Okay. So what I'm going to do is 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.
Okay. Okay.
Okay.
Well, that's confusing.
All right. We're going to close our. Entirely. Let me open it.
Mm-hmm.
Mm-hmm. Where can we meet the audience? No, you can't go on the desk.
Stop the share for a second. So you can see. This is who's been meowing in the background and watching treats and stuff.
Nice.
You're free. Thanks being in my lap, but not when I'm holding him like that.
Okay. So now we're going to open.
Hey, you cannot be on the desk.
You can be on your bed. Oh, my goodness.
All right. Multiple libraries were found.
Okay. Okay.
Oh, I don't.
Okay. Okay.
Oh, okay. So I'm in that. Okay. Okay. So whatever it is, that's not the problem.
Okay.
So, all right. All right. So we got to load these back in. Okay. Okay.
Okay.
Okay. Free fonts that H no such file or directory. Okay. Cool. So now we're going to figure out where to get.
Free fonts that H. Let's see if there's a free fonts.
No library manager. No library manager.
Pesky. Okay. Okay.
Oh.
We're going to open up.
Examples.
Should be a wheel terminal.
Okay. Okay.
Okay. Nope.
Copy. File.
Add a file.
Oh. Okay.
Okay.
Okay. Okay. Okay. Okay. Okay.
Okay. Okay. I got to reopen.
Open. Of course it's supposed to be capitalized.
But we're going to do it this way.
Okay.
Should work. Okay. Okay.
Right next to my chair. Oh.
Okay. Okay. Okay. Let's try this.
Okay. That few strings shouldn't hurt, right? Let's see if that works.
Maybe on my lap. Having argued 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's uploaded. So I'm going to put on the camera. So you can see it. Go. If it does go.
For now.
Okay. Let's open up the serial monitor. Hmm.
What's going on? Oh, no. The screen is blue. And if it connects, it'll. Okay. Oh, hi.
Look at that. Right there. You can see it. 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. So. Get down.
On your bed. All right. So. Are you just done?
All right. Okay. So we got all that set up. Close the terminal. Okay.
Okay.
Let's go to GitHub. Hmm. Hmm. Hmm. Hmm. Hmm. Hmm. Hmm. Hmm.
Hmm.
Hmm.
Okay.
So it looks like we're going to figure this out. So what I'm going to do is HTTP.
Request. Library. Perfect. Hmm. Perfect. Okay.
Fantastic. Okay. So. Easy way to do this. So we're 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. So next episode of connecting this to workers.
So let's do this.
Okay.
After that's done. This goes in the loop. Okay. Okay. Okay. Okay.
Okay.
Okay. Okay. Okay. Successfully. Let's open up the serial terminal. Signing the second boot.
It's booting. Wifi. Oh, oh.
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 gonna 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 gonna do 90, 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 see I'd be holding it in front of my face for it to show up properly, open up the serial terminal on my end, okay, 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 as we connected it to websites, and okay, it's not breaking everything this time on 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, do that, 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.