Kassian's IoT Hour
Presented by: Kassian Rosner Wren
Originally aired on August 21, 2022 @ 1:30 PM - 2:30 PM EDT
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 everyone. I'm Kassian and it's time for Kassian's IoT Hour. So today what we're going to do is we're going to rewind and we're going to start up a Pi from scratch.
We've got this Pi here and it's got a Pimeroni Unicorn HD on it and what we're going to do is we're going to write the driver to node and then we're going to run it.
So yeah that's what we're going to do today. So hope you enjoy it. We're going to, like I said, start with flashing the Pi with what's called Bolena Etcher and then put the SD card in here and get started from there.
So what we'll do is let me share my screen real quick.
Okay and so I've got my screen here and what I'm going to do is I'm going to go over to, oh I don't have Bolena Etcher running right now, so let's get that.
Okay so the first thing we're going to do is we're going to take the Raspberry Pi image.
We're going to select target. We've got this generic storage device which is our micro SD card.
We select it and we'll flash. It's going to ask for my password. There it goes.
Okay so while that's flashing we're going to get ready for the rest of the process.
So I've written down this entire process in the Cassian IoT Hour readme. So what we've got is we are currently installing Raspbian and then we are going to set up Wi-Fi and SSH so that we can SSH directly into the Pi and set it up while we're at work.
And then we will SSH in and get started and we'll do all these steps. We'll install the Cloudflare vDamon so that we can have Arduo access and then we'll get started writing, pulling down the IoT Hour code and then go from there.
So it's flashing and it's going to be verifying.
Luckily validation is a little bit faster than flashing.
Okay so now we can close the Linux Etcher and we're going to remove and put the SD card back in.
And we're going to go into mount. Hopefully there will be a volume.
That's it. I've been spending too much time on Linux. So let's see what's in this folder.
Make sure it looks right. It does. First we're going to test the file called SSH and what that does is allows us to SSH into the Pi remotely.
That's not done by default.
And then another thing we're going to do is we're going to say get the file.
Okay so now, oh weird.
Don't know why I copied that.
Awful lot of stuff there. You know what?
We can fix this with a Let's try this one more time.
Okay.
And we didn't get all the expressions. This time that's helpful. Okay put my network here.
And then I'm going to say yes. There we go.
Okay so now we can take the card out.
And we're going to put it in the Raspberry Pi. And then we're going to plug the Raspberry Pi in.
Raspberry Pi is plugged in now. While it's booting up, we'll get ready to SSH in.
Just thinking about it.
There it goes.
Oh right. We're going to have to Okay so we're in the Raspberry Pi.
The first thing we're going to do is run the password.
Because this is on a unsecured password. Come on Pi, you can do it.
Oh damn it.
There we go. Okay.
There we go. So we now have updated the password to something else. Now what we need to do is we need to sudo .getupdates And what this is doing is it's updating all the packages that are available to it And then we'll run upgrade which will actually get the packages together and upgraded.
This will take a little bit. Okay.
So now we're going to sudo .getupgrade sudo .getupgrade This will take a minute.
Okay.
Okay. Okay. Okay. Okay. Okay.
Okay.
Okay. Okay.
Okay.
Okay. Okay. Okay. Okay.
Okay, should be done soon.
Almost done.
There we go.
So the next thing we're going to do is we're going to go back to our steps.
And we're going to install Node.js.
Thanks, Bill.
Okay, so now we have Node.
Version 14.5, so that's the latest version of stable node.
So what we're going to do next is update npm.
Okay, so next we're going to change npm's working directory.
Okay, so now we're going to change npm's working directory.
Okay. Okay. Okay. Okay.
Okay.
Okay.
Next, we will install the Cloudflare daemon.
Okay, so first we're going to get...
First we're going to actually... Wait a second. And now we're going to check that it works.
And then we're going to use this to log in.
What this will do is it will give us a URL.
We can go into our browser and log in with.
Okay. How did I do it?
How did I get back on my...
There we go.
Okay. Okay, so now we log in and then that.
And so now we'll go back to here. Here.
Okay, cool. Save. Save. Yes, okay.
So I downloaded this automatically. Okay. Okay. Okay.
Okay. Okay. Okay. Okay. Okay. Okay. Okay.
Okay. Okay. Okay. Okay.
Okay.
Okay. Okay. Okay. Okay.
Okay.
And we install Damon.
Okay. Okay.
There we go.
Awesome. All right.
Hmm.
All right, so we're going to do is we're going to reboot. Oh, we'll have to wait a second and it is a second and see if that helps the Damon kind of get its feet underneath it.
Okay. So let's try this again.
Sometimes reset. Hmm.
Still failed. Hmm. Hmm.
Okay, well, that's interesting.
All right, we'll deal with that in a little bit. For now, let's get our.
Okay.
Okay.
So back here.
Okay. Okay.
So, and we create Leave.
That is not what I wanted. So, here. Here. He stored here.
Yes, I will rotate this key as soon as I'm done. So, So, Okay.
Okay.
Okay. Okay. Okay.
Okay.
Okay, so now get clone. Okay. Okay.
Okay.
Okay, so we got the code. Okay, so now what we're going to do is we're going to start writing the drivers for the device.
So, we're going to have to do. Okay, so what we're going to do.
We're going to turn on. And then we're going to finish it.
Okay. Let's make sure it's not the singular.
That was it.
There we go.
Okay. Hi, code.
I'm going to create.
New directory. Okay, so we're going to create a new directory. Called.
Yes.
Yes.
We're going to open up.
Code. We're going to. Okay. Post.
Hi. Hi. Our. Hi. Okay. Okay. Okay. Okay. Okay.
This window. It's ready.
So we're going to open folder. We're going to load. Yeah. Jason.
And. So now we're going to do is. Okay. We're going to put. Yeah.
Yeah. Yeah. Let's take a look at what.
Okay. So what about here is the unicorn had HD library that's in Python.
And so we're going to rewrite this in node. So let's take a look at what we might need and how we can get.
So. Library. Okay.
So this will be.
Okay. Okay.
Okay.
Okay.
Okay. I still have one address. Okay. Okay.
All right.
So. Okay. Okay.
Okay. Okay.
Not much about the actual. Okay. Okay. Okay.
Plus one plus address.
And a list of UN aids.
Okay. So what we need to do. And we need to use a library for SPI.
Okay. On the library pie. What it is.
Okay. Okay.
So here it is. Okay. Okay.
Okay.
So. The first thing we're going to do is. Okay.
So. Right here.
Okay.
Okay. So that doesn't need to be that. Okay. So that's just programmatically setting it up.
So. Here we are. So my speed inherits. Let's figure out how to do this.
Okay. One here.
And we're going to say. Okay. Okay.
Okay. Okay.
Okay.
Okay. And then we have a function. Okay.
Let's see what this does. Okay. Here. Right.
This isn't rust.
Okay. A little while. Okay.
Fantastic. So we've got the SPI device loaded. Okay. Next we're going to send it a buffer of zeros.
Xerox 72. So. We're going to say, let. Test buffer. And start with.
And then we'll try a white pixel.
Okay.
We got to transfer that buffer. Okay.
Okay. So we're going to say. Okay. And buffer.
Okay. Don't need a receipt buffer.
Okay. Wait.
Let's say.
Okay. And say five. Speed.
Nine.
Followed by six years. Okay.
So we're going to say. Okay. Okay.
So when we run this, what should happen. Is the first person should light up.
Yeah. Incorrect arguments or transfer.
Okay. Okay. Let's add a receipt. Okay. Okay.
So we'll just give it a three. No.
Okay. Okay. Okay.
Let's check. Okay. Okay. Okay. Okay.
Okay.
One of them must be sad. There's no question.
Nope.
No question. All right. So. Okay. Let's try lowering this and let's try getting rid of this.
Okay. Okay.
Yeah, here. Change this from five. Okay.
That's wrong. Correct. Okay. Okay. Okay.
Okay. Okay. Okay. Okay. Okay. Okay.
Okay.
Okay. That's not it.
Okay. Okay.
Okay.
Okay. Okay.
Okay.
Okay.
Okay.
Okay.
Okay. Okay. Oh, so bite length is not.
Optional.
And we're going to transfer. We're going to try something here.
Okay. Let's see.
Okay.
Oh, huh.
You know what would really help. If I pass the message. Okay. That's what we're about.
Okay. Okay.
Okay.
Okay.
All right.
Okay. Okay.
Okay.
Okay. Okay. Okay. Okay.
Okay.
Okay. Okay.
Okay.
Okay. Okay. Okay.
Okay. Let's see if this works.
Let's see if this works. Okay. It's not an array.
Yes. Okay. Yes, it's because it's not an array. Which is silly, but.
I'll go with it. It did send it, but nothing is lighting up on the pie.
So we're making progress though.
We can start sending messages. To the device. So we're going to try it out a little bit more.
And we'll then call the end for the day. So let's start creating a forecast code.
Welcome to Spark device.
Welcome 00. Oh, we don't need the one.
OK. So I'm looking at this line here. SLF plus that to list.
So an SLF, if I remember correctly, was 72. So let's go hang on.
Make sure there's no new messages. Yes, thank you, Rachel Williams.
I got the message already. Thank you. Yes. Thank you for the update, Sal.
I really appreciate it. I'm just getting your messages through here.
So I appreciate it. Now to run it again without the one. All right.
Oh. Oh, right, because we did that manually.
But let's change that back to. OK.
Nothing's lighting up still. But that's OK. We're still making progress. All right.
I'm going to try one more thing. Yes, thank you to Daniel Horner and Rachel Williams.
I wish I'd gotten your message a little earlier.
But that's OK. I appreciate the help, really.
All right. So. Oh.
No, I don't think that's for each transfer.
It's the week after the transfer.
So no need for a delay here.
Oh, OK, wait.
Let's see how it sets things in here. OK, let's see if we can find a lot more information.
OK.
OK, so it's using N8 for chip select.
So we might have to set up your chip select. So let's look at the options.
Chip select high, OK. OK, so we're going to have to figure out the chip select later.
Thank you all very much.
And I hope you have a good rest of your day and enjoy the rest of Help Bird TV.
Thank you.