Kassian's IoT Hour
Presented by: Kassian Rosner Wren
Originally aired on March 8, 2023 @ 8:00 PM - 9: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
Internet of Things
Tutorials
Transcript (Beta)
Oh hi, good morning everyone or afternoon or evening depending on where you are. I'm Kassian and welcome to Kassian's IoT Hour.
So what we've been working on lately is a network of pies.
I've got three pies over here and then today what we're going to be doing is I have attached a new weather humidity altimeter to one of the pies and we're going to start collecting data off of it and transmitting it as sensor data and receiving it to Redis instead of transmitting dummy data as it were.
So to do that we're going to work with Johnny5 and Raspi.io and so let's start coding.
Okay so we've got our three terminals here.
I just cleaned everything up for today.
So first thing we're going to do is actually I believe we have some code that could be useful to us for this.
So we're going to go into Yeah okay cool.
We'll reference this if we need to.
We're going to do, we're going to go over the code.
So so okay so we're going to add the Johnny5 code to this.
So what we're going to do on Pyfish3 is we're going to go into okay so so so I'll make this up for now.
And let's run it and see what happens.
Okay.
Okay.
Okay. Okay.
Okay.
Okay. Okay.
Okay.
Okay. Okay.
Okay. There we go.
So that temperature is a little off.
Hmm.
Hmm. Pretty sure it's not boiling water in here.
Okay. Okay. Pretty sure the pressure is also not negative in here.
Okay. So something's off with the sensor.
Make sure what I have is the same kind. Oh, I have a BME 280. Okay. Okay.
That might explain some things. Okay. Okay.
Okay.
Okay. Okay. Okay.
There we go.
Cool.
I don't know what's up with the altimeter, but the thermometer and the barometer and the hydrometer are now all working the way they should be.
So now we're going to start to feed this data into Redis and into our PubZone.
So I want this to report once a minute.
Yeah, I'm actually going to take the name out of there.
Okay, so every 60 seconds it'll publish that and what I'm going to do is actually turn this into its own function.
And then I'm going to tell it to publish data.
So now there's two things I want to do here.
One is itfish parent.
Anyways. Okay, so it's set that data and it'll report again in a minute.
Now we should get this get pushed up.
Okay, cool, and then from these two.
It's not actually sending the rest of the data, only sending zone lab, that's odd.
Is it because it hasn't been set yet?
Okay, yeah, that is it.
Okay, cool.
Yeah, okay, that was it.
So what I did was I gave it a one second delay and that allows everything to be set.
So you can see this, everything is set up the way it should be.
So, cool. Now we have our sensor data. I should have closed this. Oh, right, we're on board.
Okay.
Thank you.
Okay. Okay.
Okay, so now what we're going to do is we're going to start setting up time series of these data.
We're going to try to set it by zone and type. So for that we're going to do So here.
Close this window to third pie.
Close this window.
Close this window. Okay. Okay, so IoT push parent index.js.
Okay. So right now we're setting singular values.
What we want to do is create an array of values with timestamps on them.
That's when that data was received. So what we're going to do.
Okay. Okay, so I'll push.
Got it. Let's also pull up Node-REDIS.
Make sure this is supported. Okay. Okay. Okay. Okay. Okay.
Okay. Okay. Okay. Okay.
Okay.
Okay.
Okay.
Okay.
Okay. Okay. Okay. Okay. Okay.
Okay. Okay.
Okay.
Okay.
Okay.
Change the key to be zone-type. Okay. Okay. Okay. And then...
We might change up the API on this a little bit later, but for now this will work.
Okay. Okay.
Okay.
And then we're going to say... I'm going to wait for the altimeter to report again.
Okay. Let's see if that works.
Awesome.
Looks like it's working. I'm actually going to let this run for just a second.
I'll be right back. Okay. Okay. Okay. Okay.
All right.
And we're back. Sorry about that. All right. So we now have that data coming in.
Now what I want to do here is check that that is coming out correct. So what I'm going to do...
Okay.
Okay.
Okay.
Okay.
Okay. Okay.
Okay.
Okay.
Let's see what's going on here.
Oh, I see it's get.
Not hget. No, no, no.
Oh, okay. That's the thing. Okay. Okay.
Okay. Okay. Okay.
Okay.
No, there's not.
Okay. Okay, so we'll try here instead.
Instead. Okay. Okay.
Okay.
Okay.
Okay.
Okay.
Okay.
Okay.
No, no, no.
Okay.
Okay.
Okay. Okay.
Okay.
Okay. Okay.
Okay.
Okay.
Okay. Okay. Okay.
Okay.
Okay.
Fantastic. So now we've got our actual list coming back. Okay. Just for a second.
Okay.
Okay.
So I've got 13 minutes left. Okay.
We could start by creating a way to get information. Okay. Okay.
Okay.
Okay.
Okay.
Okay.
Okay.
Okay.
Just sensor data. Okay. Okay.
Okay. Okay. Okay.
Okay.
Let's see if child access. Okay. Okay. Okay.
Okay.
Okay.
Okay.
No different from the others.
Okay. Okay.
Okay.
Okay.
Okay.
Okay.
We don't get anything back. Okay.
Okay.
Okay.
Okay. Start.
Okay. Okay. Okay.
Okay. Okay.
Okay.
Okay. Okay. Okay. Okay. Okay. Okay.
Okay.
Okay. Okay.
Okay.
Okay. It's logging the action.
But it's not sending back. Okay. Wonder. Wonder.
Okay. Okay. Okay.
Okay.
Okay.
Okay.
Okay.
Okay. Okay.
Okay. Okay.
Okay. Okay. Okay. Okay. Okay. Okay. Okay.
Okay. Okay.
Okay.
Okay.
Okay.
Okay.
Okay. Okay. Okay.
Okay.
Okay.
Okay.
Okay. Okay. Okay.
Okay.
Okay.
Okay.
Okay. Okay. Okay.
Okay.
Okay.
We will try again next week for more.