The Changelog: Software Development, Open Source - Run your home on a Raspberry Pi (Interview)
Episode Date: May 13, 2022This week we're joined by Mike Riley and we're talking about his book Portable Python Projects (Running your home on a Raspberry Pi). We breakdown the details of the latest Raspberry Pi hardware, vari...ous automation ideas from the book, why Mike prefers Python for scripting on a Raspberry Pi, and of course why the Raspberry Pi makes sense for home labs concerned about data security. Use the code `PYPROJECTS` to get a 35% discount on the book. That code is valid for approximately 60 days after the episode's publish date.
Transcript
Discussion (0)
what's going on welcome back this is the change law thank you for tuning in if you're new to the
pod head to changelog.fm for all the ways to subscribe and if this is your 10th 20th 30th
50th 100th show thank you for coming back thank you for listening we appreciate you if you haven't
yet check out changelog plus plus that is our membership it's for diehard
listeners they want to directly support us they want to drop the ads and they want to get a little
closer to the metal with bonus content and more on today's show we're joined by mike riley we're
talking about his book portable python projects running your home on a raspberry pi mike schools
us on all things raspberry pi we break down the details of the latest hardware various automation
ideas from his book,
why he prefers Python for scripting on a Raspberry
Pi, and of course, why the Raspberry
Pi makes sense for home labs concerned
about data security. And of course,
big thanks to our friends and partners at
Fastly. Bandwidth for Changelog is
provided by Fastly. Check them out at
Fastly.com.
This episode is brought to you by Square.
Millions of businesses depend on Square partners to build custom solutions using Square products and APIs.
When you become a Square solutions partner, you get to leverage the entire Square platform to build robust e-commerce websites,
smart payment integrations, and custom solutions for Square sellers.
You don't just get access to SDKs and APIs.
You get access to the exact SDKs and the exact APIs that Square uses to build the Square platform and all their applications.
This is a partnership that helps you grow.
Square has partner managers that help you develop your strategy, close deals, and gain customers.
There are literally millions of Square sellers who need custom solutions
so they can innovate for their customers
and build their businesses.
You get incentives and profit sharing.
You can earn a 25% SaaS revenue share,
seller referrals, product bounties, and more.
You get alpha access to APIs and new products.
You get product, marketing, tech, and sales support.
And you're also able to get Square certified.
You can get training on all things Square so you can deliver for Square sellers.
The next step is to head to changelog.com slash square and click become a solutions partner.
Again, changelog.com slash square. so we have mike riley here the author of Portable Python Projects.
Run your home on a Raspberry Pi.
Should be a fun conversation.
Welcome, Mike.
Thank you.
Glad to be here.
Glad to have you.
Happy to nerd out a little bit on some home automation topics.
Adam, you're big on this stuff already, aren't you?
I would say I aspire to be big on it.
Right.
Not quite there yet.
I think after peeking at Mike's book, I feel like I should learn Python much more than I currently know it.
I think so far I'm more of a Docker dabbler than a Python scripting automate my home dabbler.
So I aspire to.
Okay.
That's a good place to be.
Yeah.
We have an expert here who's going to teach us all the ways.
I also have aspirations, but I have not actually dipped my toe in the water whatsoever. I'm a guy who has a couple of ideas
that I would like to do. And so happy to have you here, Mike, because I think one of my ideas is
darn near directly in your book, or at least close enough that I could port it. But let's start with
you, Mike. Tell us about yourself. Tell us how you came to write this book. Well, this is my fourth book for Pragmatic Bookshelf. My first book was
actually another home automation book called Programming Your Home. That was written almost
10 years ago, and that was at a time when pies were just sort of on the cusp. They hadn't really
been put out there as a dedicated system that could be running these
kind of things. At that time, it was Arduinos and Servos. And, you know, you didn't even have
things like the home and assistance like Alexa or Siri. So a lot has changed in 10 years. But at the
same time, some of the things haven't changed. And one of the big reasons I wrote the book was because as I saw this proliferation of different home automation kits that were coming out that were closed environments,
that they were single, you know, buy this from unknown manufacturer with unknown support and plug it into your home and just trust it to do whatever it's going to do.
Right.
Whatever, regardless of what data it's going to leak or where it's going to send that data to.
And I saw a lot of that, particularly on, you can buy things like that from Amazon and various other online retailers
that don't tell you about the risks that are involved with that,
nor does it give you much of an understanding of what is happening on the back end.
So I felt that it was time to revisit some home automation and really put the power back into the end user.
And the Pi is a great platform to do that because it's really designed for the home enthusiasts and allows you to not only understand the operating system that's running on it, but all the interfaces that are connecting to it.
And because it's a learning system, it's really optimized for that experimentation,
automation, exploration. Yeah, I think the Raspberry Pi is a revolution, right? It's the
beginning of a revolution, basically, because it really gives you this tiny little machine
that doesn't require necessarily a screen and a keyboard and all the things you can simply SSH
into it.
Now, it kind of provides that you are more in line with our core audience, which is,
you know, where's the developer at primarily.
But, you know, this enthusiast is almost semi-developer in a way.
Like you can know some developer things.
You can know that you have a terminal or a shell or something like that in your operating
system.
It could be Windows, it could be Mac.
But this idea of of tapping into Linux,
there's so much documentation out there for Linux.
There's an immense amount of documentation
and YouTube videos for Docker.
So I mean, even getting to Docker Compose
and fiddling with a lot of the stuff you can do
with a Raspberry Pi in a Linux machine like it is,
it's just such a small piece of nothing, basically. I just can't even believe it's even possible, really.
You used to have to build or buy this really expensive machine. And in terms of
cost, maybe the Pi is expensive now. I don't know, even hard to get because of
supply chain issues and whatnot. But it's generally a sub-150
all-in device, right? Like $150 US
all-in. Maybe you get Like $150 US all-in, you know, maybe you get your SD card,
you get potentially even an SSD if you really wanted to,
you know, which isn't required.
But for that little bit of money,
you get this tinkering machine
that just really can open up the world to you.
Well, in addition to that,
you think about a server-mounted rack or rack-mounted server
from 20 years ago. Yeah. It is now somewhat equivalent to that Pi.
So just like the old days when they used to talk about computers filling a room or being the size of a refrigerator,
it's the same kind of miniaturization that's happened here, which is also great for letting it just run continuously
because the power requirements are so low that it keeps it so that
it's something that you can have work for you while you're asleep. In fact, one of the projects
in my book really compiles and does a text-to-speech audio translation so that it compiles
various news sources or RSS feeds that you prefer and puts that into an audio feed ready for you to listen to in the
morning. And you know, you did all that during while you were asleep. So I use that every day,
actually. Yeah, that's so cool. What struck me about the book is how much of the time you spend
in the hardware selection and like, here are some hardware stuff you should know. And then the
software setup, because when Adam talks about not knowing that much Python, I was struck by how little coding you have to do.
There is code to write, but even your Waterleak notifier project,
the test script is like 12 lines of code.
There's coding to do, but it's very accessible.
You're really kind of gluing together other people's projects.
I'm sure that your text-to-speech engine, you didn't write your own neural networks to get that done. And so a lot of it's like the know-how, getting started,
getting it set up, understanding the command line, Linux a little bit, gluing some things together,
and then just kind of like step-by-step, wading deeper into it, and writing like a little bit
of glue code. And then of course, once you get that working, your mind starts to really move and you're
like, OK, now what can I do?
So it seems like it's both fun and I think approachable.
You don't have to be a full time software engineer to do these kind of things, right?
Right.
And in fact, that's the reason I also selected Python for the book was because of the fact
that it is so easy to get up to speed. There's,
as you commented earlier, there are literally thousands of actually pretty good tutorials
on YouTube and various other sources on the web that teach you the basics of Python. And once
you've got the basics down, you can pretty much put together a lot of this capability
with just a few lines of code. And that's what I
really stuck with the book was to make it as simple and painless as possible. The other thing
I also stuck with was particularly on the hardware side, you know, the first book that I did had a lot
of wiring diagrams because, you know, you're actually putting the bed boards and you're
putting wiring certain servos and, you know, other electronic products together to make certain things work.
Well, again, now, 10 years later, a lot of that stuff has been made relatively simple and straightforward.
So for me, I was really, really trying my hardest to make sure that there was not going to be a breadboard
or a wiring diagram anywhere in the book.
And I think I've succeeded with that because most of the products are off the shelf and you just plug it in and you're able to talk to the device
yeah i think it's important because on the hardware side for me at least and probably some other
people as well as soon as i see soldering or like diagrams i'm pretty much just out i'm just like
yeah that's for other people that aren't me i'm not an electrical engineer i don't really have
that tinkers spirit.
I know lots of people do, and they love that kind of stuff.
But I need a little bit higher up on the hardware side,
and it seems like what the Pi has done
is kind of brought that stuff to more people.
Absolutely.
Which seems like really cool.
So help us out with the hardware then.
Specifically, maybe we can outline a few of the projects
that are in the book,
some things that we can use as talking points.
I already talked about the water leak notifier, which is neat.
You talked about the RSS feed reader slash announcer thing.
Maybe outline a few of the other projects,
generally the kind of things that you're going to be doing,
the sensors that you need.
And then we can talk about what Raspberry Pi do i buy and that kind of stuff well let's
actually start with the pi if you can get your hands on it i would recommend going with the pi
4 and if you can get it uh the 8 gig just so that you future proof yourself because i found
over the years as i bought pi right from the first version all the way up to the fourth release that I've always run out
of resources on it. It's just the nature of the Pi, particularly if you've only got one or two
Pis available. Now, I've got quite a library of my Pis, and I've actually had to start to recruit
some of my old Pis that I have decommissioned a while back because of the supply chain constraints.
But that being said, if you can't get your hands on it,
you can try to go with the Pi 4.
That being said, the book will work with the Pi 3 or even the Pi 2,
but I do recommend at least the Pi 3 at minimum
because of the capability of running 64-bit applications.
The days of 32-bit apps are like the days of 16-bit apps.
They're going away, and most newer distributions
and applications are 64-bit
enabled. So that's just the reality of the world today. So if you can get at least a Pi 3,
that's a great start, but preferably a Pi 4. All that being said, in terms of hardware,
you mentioned the Waterleak notifier, and as I also mentioned about minimizing any kind of
breadboard. Well, Waterle leak actually does have a detector that
detects leakage, which is really just two metal surfaces that determine whether or not there's
a connection between them. And of course, water will allow that conductivity so that if there's
water between the two sensors, then you've got a water leak. So that actually has just two wires, but you can actually
connect those two wires directly onto the pins of the GPIO pins on the Pi. And I tell you which
ones they are in the book. And it's really simple that you can then just pull those pins for any
change, any state change. And once there is, then I show you how to hook that up to a notification
mechanism, which is for most the most part, email.
Although I do do other projects where I use Discord API to be able to send messages through Discord, et cetera.
But for the really simple stuff, you know, again, try to keep it as low level or as basic as possible so that there's not a lot of overhead.
You don't need all of this additional knowledge or additional resources on the web
to be able to utilize the services.
So just go with HTTP, SMTP, the basic protocols.
And then when you're ready to start to go further,
then you can hook into things like the Discord API,
which takes a little bit of getting used to,
but once you get a hang of it,
I actually use that in two different projects in the book.
It's actually pretty straightforward.
So just like everything in the world of development, DevOps,
once you've done it once, it's fairly repeatable after that.
There are a few flavors of the Raspberry Pi, though.
So you recommend the Model B4, right?
Is that what it is, Model B4?
And they have, I believe, the compute module
where you can
extend it and do different things
like add a
graphics card and all this extra stuff.
So you can essentially treat the
I think that the compute module is like
the Raspberry Pi 4 minus
the I.O. essentially. You've got Ethernet,
USB, those things
go away and all you simply have is just a
compute module which connects to other boards
and there's third parties out there
there's tinkerers out there and hackers out there
they're building their own boards that adapt and work with
the Pi and just extend, so if you want to do
Jeff Geerling, I'm sure you're probably
a fan or aware of Jeff
he's got an amazing YouTube channel, I've followed him for a while
now, and if you want to go to the
absolute fringe edge of the
Raspberry Pi
and its capabilities, check out Jeff because he's an adventurer for sure.
Oh, yeah.
But there's this landscape where you can start very simple
with the board that has the I.O., which is the Raspberry Pi 4,
or you can go the compute module route,
which gets you additional, I guess, just a possibility.
Would that be the easiest way to describe it?
Yeah.
And again, the compute board is really for a different use case, but the Pi 4,
you know, it has the various USB, USB-C, Ethernet, like you mentioned, all the ports are necessary,
plus, of course, it's got Wi-Fi and Bluetooth. Now, if either because of supply chain constraints,
you can't get a hold of a Pi 4, or you're just looking for something that's a little less
expensive, because, you know, even the top-end Pi 4, even before all the difficulty of trying to get a hold
of this hardware, was still in the close to $100 range, which still for a full-blown Linux computer
is fairly cheap. But then again, for people with a limited budget or they just wanted to start
testing the waters, there's the Pi Zero 2W, which is also a
phenomenal piece of technology. It's about the size of a gumstick. And while you don't have the
pins mounted on the board, they're easy enough to put on the board with either an attachment or if
you don't need them, you know, a lot of people, if they aren't interfacing with the GPIO pins,
it's really not that big of a deal not to have those pins actually mounted on the board. But, you know,
only the limitation I can think of with the Pi Zero 2 is the fact that it does not have onboard
ethernet. But, you know, if it's just a Wi-Fi device, I've got several of them throughout my
house just because of the fact that the wi-fi connectivity is solid
yeah solid throughout the facility i can't trust the wi-fi only versions i have to have that
myself personally in fact the way i power my pies in particular is with the poe hat
and so i was going to ask about that because i would love to have poe on these
yeah exactly and that's that's what you're going to want to do. Raspberry Pi,
they have their own branded version of it. I think there's some aftermarkets or
whatever, but they all work. I think I have an
aftermarket version of it. So you call it a
PoE hat? You put a hat on it?
It's a hat because it
goes onto the GPIO. What's it called,
Mike? Is it GPIO? Yep.
So it sits on that GPIO
pin and powers itself via that.
So it accepts the power via PoE,
and I believe it's 3 volts or something,
something less than 5 volts.
It's not very much.
And that's how it powers the Pi,
rather than going through the normal power route,
which is the power adapter.
Right.
So I prefer that route because it's less wires.
It's just an Ethernet plug.
Plug it in.
You know, simple.
I understand, though, if you really push the edges of this Raspberry Pi, though,
that if you're powering via PoE, that you can have some power limitations.
So if you had an SSD drive attached to it or other things,
or maybe a RAID of SSDs, for example,
you're going to probably hit some power issues.
You need to go power adapter.
But for my
use case, the main thing I use it for personally, which I haven't, as I said before, I aspire to get
more tinkering and do the stuff. But thus far, I'm simply a Pi hole user, a Plex user, that kind of
thing. Maybe a portainer user, for example. That's the extent I've gone so far. I want to get into Home Assist and all these other fun things.
I just haven't found the time to really dig deep into it.
But one can dream, basically.
Well, you're a lot further along than a lot of Pi users.
So it seems like, okay, the Raspberry Pi 4,
if you bought a maxed out one,
would it be the kind of purchase where you could run
three, four, maybe five different automation things on it?
Does it have that kind of power?
For sure.
Or would it be like, well, I kind of run one per home automation project?
Now, if you got that for with the 8GIG, you'd be able to run all the projects in the book and then some.
And then some.
There's just plenty of growth space.
And that's why I say to be able to future proof it, if you you can get that 8-gig version, that's what I'd recommend.
Yeah.
So it seems like the horizontal scaling, if we will,
like the buying of more Pis,
is more tightly coupled to your sensor distribution throughout your house.
Like if you want to have a sensor in this room and a sensor in that room,
you're probably going to have to have two Pis,
or I guess you could run long, little, low energy, you know, sensor cables or it seems like, is that the way
it's like if you want one in your office and then one in your bedroom, sensor wise, whether it's,
you want to make sure there's no water leaking in either place, you got to have two in that case.
Yeah. And again, that's where I use the Pi Zero now. Unlike Adam, my Wi-Fi is fairly solid.
And so I can, for the most part, able to trust that I've got a good, strong signal.
And consequently, so for one of the projects in the book, which I've actually got in the back, that little fan back there.
When things get a little warm in the room, it automatically kicks in. So it's basically a very simple straightforward thermostat. And so what I've got is that connected
to a Pi Zero Two, sitting on top of it is the temperature sensor that tells me when if it gets
too warm, I'm going to trigger that hue light switch that is going to enable the electric power
to turn on the fan. And then when it starts getting cooler in the room, the fan will turn off.
So all that is automatic.
I only have to think about it.
So it's a great little home automation that comes in quite practically.
That's a baller move right there.
Yeah.
And then that same Zero actually controls an older TV of mine that is not internet enabled.
It's got an old IR blaster that you turn it on and off. But
again, I've made it internet enabled by using the project in the book that I show you how to use
a simple USB-based IR transceiver, which does both send and receive, but in my case, I'm just sending.
And then I send it the proper IR code to turn on the TV and turn it off. And
I've hooked it up to my Google Home so that I can just say, hey, Google, tap the screen.
Tapping the power button on the TV and soundbar.
Yep, that was Google responding, saying, I've just turned on the screen for you.
There you go.
So now my TV's on.
Sorry, I didn't understand.
She's still listening to you. She's back there still talking.
That's awesome. Cool. What's the
connectivity from the Pi
Zero 2 to the TV? What's that?
Is that Ethernet? What's the connection?
Nope, just Wi-Fi and then
the transceiver, the USB transceiver
is sending the IR commands.
So it's all wireless. Oh, I see.
So it's actually doing the
connection via the IR blaster, essentially.
It's certainly, okay, interesting.
Yep.
And the Pi Zero 2 is essentially the smarts of the non-smart TV.
Okay.
Just basically listening for that state change.
Yeah.
Could you, this might push a little further.
Maybe this is not even on that device, but at some point, I guess you could probably,
is there like a Android Fire Stick or something like that? Is there a software version you could put on the Pico
or the Pi Zero 2, or would you somewhere else have a media server on your network?
Yeah, you could do that. I mean, you know, the Pi Zero 2, though,
doesn't have the processor capabilities that you would. I've seen
certain projects run like a Game Boy emulator,
for instance, on them. And that really is pushing
the capabilities of that processor. What I have done, though, is that on some of the Pi zeros
that are just kind of sitting idle most of the time, like the water sensor, for instance, well,
that's going to only on those rare occasions where I do have a water leak trigger, that it's
actually going to do some useful work. But in the meantime, what I've done is I've set up a Git server on it. So anything that I want to post into my private network for
whatever Git, and that could be everything from code that I'm working on or, you know, another
book project or just something that I'm writing up for articles, et cetera, that I can just make
sure I've got a backup so that it's always ready to go in case there's any kind of failure on my
primary system. So, you know, there's so many things in case there's any kind of failure on my primary system.
So, you know, there's so many things in the multipurpose capabilities of the Pi.
Open it up to more than just, you know, specific projects, whether it's going to be a media
center or it's going to be a home automation sensor.
Use it for a lot more things.
And as long as you've got the resources available, take advantage of it.
So here's a question going back to your fan now. So here's
a use case I have, which is we have a freezer in the basement and every year we buy a quarter or
a third or half of a cow and we put it in that freezer. And so I've got a lot of money wrapped
up in that freezer, right? For a year, that's like our meat for the family for the year. And
one of the things I desperately want to know is if for some reason that freezer stops working.
And I want to know like right now before that meat goes bad.
And so is that the kind of thing you could wire up?
I think you could use a temperature sensor to do exactly that.
Absolutely.
You got it.
You basically take the same kind of approach that I did with the thermostat
with the fan and just kind of reverse it.
In other words, what you do is you take that temperature sensor,
put it into your refrigerator or your freezer,
and obviously you would have to do some creative thinking
about how you'd want to do that,
but because the leads are fairly thin,
they shouldn't interrupt too much with regards to the seal
or your freezer.
But once you've got that lead put into it,
then it's just a matter of monitoring the temperature,
and then if it reaches a certain threshold on that temperature,
send yourself a notification,
either whether it's a webhook
or if it's going into one of these different IM systems
like Teams or Slack or Discord,
send your notification that way,
or just plainly email, and you'll know about it.
Seems like what's the easiest notification
system from one of these it seems like it'd be email or maybe you could use twilio for sms or
something but maybe email is the easiest good although again you know anytime you start to
rely on a third-party service that's when things get right you know you not only do you have to
worry about things like uh their availability but you have to deal with terms of service and
other aspects that uh you know a lot of services, the reason they're giving it away for free is so that they hope that eventually you'll upgrade to bigger and better services.
Right. And the last thing you want when your freezer is broken is for your Twilio account to have been suspended and you didn't notice.
You don't get that desperate SMS message.
So keep it simple.
Keep it local, maybe maybe if you can.
Yeah, that's the other thing you could do.
You could use another project in the book
utilizes the Philips Hue lighting system
so that if the threshold is succeeded,
then you can have like a light that turns on.
And if you've got the colored lighting,
you can make it a red light.
You can even make it pulsating
so that when you come into the physical area,
you'll see that red pulsating light saying, oh, I got a problem.
I actually wrote an article about this similar type of scenario.
It was a Medium article, and it was basically using Grafana because I was making sure that I've got a constant Internet connection.
And if the Internet connection went down, well, rather than hearing from my family, hey, you know, there's no internet, I automatically get like a red alert with the lighting that I have, a strip lighting across my room here, which will pulsate red when Grafana says, you know, your internet has been down for more than a minute.
You may want to check on things.
So I know about it visually before anybody else does.
Wow.
Nice.
That's interesting.
I love that.
Thank you.
I wonder, like, in Jared's freezer slash temperature scenario,
if an alternate could be confirming the existence of power.
Because if your power is not existing,
because I have a similar scenario, Jared.
I have a fridge outside.
It's not a year's worth of meat.
Sometimes it's champagne.
Sure.
Sometimes it's wine.
But obviously, when we buy that, it's very coveted perishables, basically.
You don't want these out.
And it's in my outside refrigerator, so I'm not out there getting into it on the daily.
It's more like once a week or a weekender thing.
Maybe it's got some kids' sodas in there.
Maybe it's got some juices in there.
Maybe it's got some beers in there.
Who knows?
Whatever.
But it's an outside thing.
And it's usually a GFCI issue where it tripped it somehow who knows why i wonder if maybe there's a way to confirm power versus temperature if the
if there's a flip side of that essentially well there aren't sensors that will monitor power
the problem with most of them though you see there they are complete closed black boxes
which require some sort of subscription service that and it's actually a plug that goes into your outlet.
Between the two, yeah.
Exactly.
And then that's monitoring.
But again, it's sending out to a cloud source,
which you don't know what they're doing with the data
because they're fairly opaque about what kind of data they're collecting
and what their terms of service, et cetera, et cetera are.
The other thing I've seen is where it connects actually directly into, say, your fuse blocks so that you can monitor power throughout your home.
But that usually requires a little bit more electrical expertise, maybe even calling an
electrician. And it's fairly expensive, too. I mean, it's not outrageously expensive, but
it's something that would take a decent financial commitment to make sure that you're going to actually use it and get
your value out of it.
I just wonder if the leads do create a leak, if there's an alternate route you could take.
So if you determine plan A is leads in the freezer,
however it does inhibit the ability to seal
the freezer and there's a small leak.
What are some alternative routes that you can do?
What are different ways you can think about the problem, basically?
Yeah, yeah, yeah.
I think that's a good way of thinking about it.
Like Mike said, there are holdups there.
My current solution is suboptimal,
which is I did buy this detector that goes in the freezer
and it's built for this exact purpose.
And it's wireless and it speaks to this other device
that's over there that will actually, it's an alarm alarm system the problem with it is it's run on double
a batteries so that's the problem with it you know so you got to have power to that sucker right like
that's that's like rule one of yeah alert systems just don't let the batteries run out right and
you know you have the pi not only could you have it so that it's constantly monitoring and censoring,
but then you could also have a backup that's monitoring that Pi.
So if that is down for whatever reason, you know that you've got a problem with your sensors.
Which, again, after you start to acquire a few more Pis, that's how you can put your Pis to good use.
One of the other things I use with my Pi that is the one that's collecting my news feeds for the day is I have a Ansible server set up on it so that it's making sure that all my Pis are up to date
every day. So I don't even have to think about going in manually, depending on what distribution
it is, whether it's a Pac-Man update or if it's a pseudo app get, it's all done for me automatically.
So I don't even have to think about it. Here I am manually sudo apt-getting all these things for myself.
SSH into this Pi, sudo apt-get.
It's like, you know, I do that manually.
Are you tinkering with your distros, Mike?
Or how come you got Pac-Man going on one and apt-get on the others?
You're setting up Arch, you're setting up...
You know, in the book, of course, I do recommend using the Raspberry Pi OS
just because it's the easiest one to work with.
But as you get a little bit more comfortable and sophisticated, I found that the one that runs the
best, most lightweight, that's the one I've got on all my zeros because of the fact that it's got
such a low footprint, is the Manjaro distribution that is available for installation directly from
the Raspberry Pi OS installer. But it's an Arch distro that's extremely lightweight,
only puts on what you need to.
I do have to do some manual configuration when it comes to setting up Wi-Fi,
so it's not for the faint-hearted.
But once you've got that set up, again,
you can simply build an Ansible script that takes care of the rest of it for you.
So really simple.
That's cool. I hadn't heard of that one.
Manjaro will link it up in the show notes.
An operating system for everyone.
Neat.
This episode is brought to you by our friends at FireHydrant.
FireHydrant is the reliability platform for every developer.
Incidents, they impact everyone, not just SREs.
They give teams the tools to maintain service catalogs, respond to incidents, communicate through status pages, and learn with retrospectives. What would normally be manual, error-prone tasks across the entire spectrum
are responding to an incident.
They can all be automated
in every way with FireHydrant.
They have incident tooling
to manage incidents of any type
with any severity with consistency,
declare and mitigate incidents
all from inside Slack.
Service catalogs allow service owners
to improve operational maturity
and document all your deploys
in your service catalog.
Incident analytics allow you to extract meaningful insights about your reliability over any facet of your incident or the people who respond to them.
And at the heart of it all, incident runbooks, they let you create custom automation rules, convert manual tasks into automated, reliable, repeatable sequences that run when you want.
You can create Slack channels, Jira tickets,
Zoom bridges instantly after declaring an
incident. Now your processes can be consistent
and automatic. The next
step is to try it free. Small teams
up to 10 people can get started for
free with all Fire Hydrant features included.
No credit card is required.
Get started at firehydrant.io
Again, firehydrant.io. Again, firehydrant.io.
So, Mike, let's assume our listeners are excited about segment one.
And they're like, you know what?
I just have to take my money.
Give me a Raspberry Pi 4 if I can find one.
You said you recommend the 8-gig version because that's future-proofing.
But what's the good next step? Like if they didn't want to read the book, if they want to listen to the podcast version only, what's a good next step once you get the Pi?
What's that first step?
Well, a lot of times when people first get that Pi,
they don't realize that storage does not come with the Pi.
That's true, yeah.
Now, if you buy these kits, which cost a little bit more,
that include the power supply and a case and maybe a few connectors
because not everybody has a USB-C to HDMI converter.
So if you want to spend a little bit more money for the kits
that have
all that typical stuff bundled in, that's probably a better approach, especially for newcomers who
aren't aware of the fact that you've got to have all these different attachments in order to fully
utilize the Pi. If you don't do that, then you will have to get yourself a USB to HDMI adapter,
or if you've got a newer monitor that actually accepts USB,
you can get a USB to USB-C cable that will allow that signal to come through. You're going to need
power. So again, if you didn't buy the Pi with a power adapter, you're going to have to make sure
that you get the USB-C power adapter. In the earlier models of the Pi, it was somewhat a
proprietary choice on their part, on the part of the Raspberry Pi Foundation, and it was not compatible with a few other USB-C power adapters.
I know the newer ones have rectified that problem, but either way, you do probably want to get yourself a power adapter, and you want to make sure that it's going to be Pi compatible.
So you look for your fully Pi 4 compatible USB-C power adapters.
The Raspberry Pi Foundation actually sells one.
It's not that much more of an increase in price compared to some of the third parties.
So if you want to stay safe, I recommend going with the Raspberry Pi Foundation's version of the USB-C power adapter.
Then after that, you're going to need a micro SD
card. You can get started with low-end, low-cost at 32 gig, but if you're like me and a lot of
other Pi users, you're going to find out that that 32 gigs gets consumed real quick, especially if
you've got projects that are either looking at video or you're processing a lot of data, you've got it for storage needs,
what have you. So I usually go with a minimum of 128 gig. Now you can get those SD cards for
under 25 bucks these days, even cheaper whenever they're on sale. So the 128 gig is not that bad.
All told though, by the end of the day, when you've got all those pieces of external accessories put together,
that 8 gig Pi 4 is probably going to cost you around $110,
which is still quite reasonable considering the amount of computing power and the capability you're getting out of this computer.
But once you've got that all connected, then obviously you're also going to need a keyboard, probably a mouse if
you've got the Raspberry Pi OS, which has its own GUI, which is Ubuntu based. And then you're going
to have to have a monitor so that you can see what you're doing. Once you've got the Pi set up,
though, normally what I recommend is you try to get that on an SSH daemon as quickly as possible.
So that way you don't have to have that Pi
connected to your keyboard, your mouse, your monitor. That's why you've got a network connection,
whether that's through your Ethernet wire connection, or you've already set it up for
your Wi-Fi. It makes it much, much easier to just secure shell into it and then be able to
issue your commands that way. There's a couple of really nice add-ons for something like IDE, like Visual Studio Code,
that allow you to really easily remotely connect to a device like a Pi over SSH
and be able to browse the files, be able to modify them, to update your on almost in real time.
And it's like you're working locally on the Pi,
but in fact, you're doing it over this SSH connection.
So I talk about that briefly in the book as one of the recommended add-ons
if you're using Visual Studio Code for your Python code.
Yeah, that's super cool.
Is there any world where a particularly skilled hacker,
not like Cracker, but like a person who's ready to rock,
could get one of those Raspberry Pi Zero 2Ws,
put it on their network and SSH to it
without ever deploying a keyboard and a monitor to it
to get it set up?
Like, can you just, I would love to just spend 15 bucks,
get it out there, SSH write it in and be rocking.
Is that possible?
The only thing I can think of is if you
prepare that SD card
so that you already configure
all those Wi-Fi settings.
And then you can just plug it in and it'll automatically
connect whether it's a DHCP connection
or if you want to do static IP.
I know that there's
developments underway with the
Pi 4, which is utilizing
the Ethernet connection to be able to do that Pixie boot.
Yeah, there you go.
So that it automatically picks up
and downloads the operating system automatically.
So you don't have to do anything.
You literally just plug it in.
But I think that's still under beta.
So that probably won't be available
until later in the year.
That would be awesome
because you can have a base image
that just gets flashed onto all your new Pis
as you buy them.
Yep.
I would love that.
Yeah, that's cool.
That's coming to the fore.
Again, without having that Ethernet connection, though, I suppose the other possibility is you could, you know, set up some sort of like a Pixie emulator and then plug into the Pi Zero's USB port like an Ethernet adapter and then plug that into your network but whether or not
that actually is going to be existing on the pi zero firmware is another question so whether you
know ends up to the pi foundation which i doubt they probably would put on the pi zero just because
it doesn't have an ethernet port right okay so you got ssh access you have VS codes, fancy connect somehow and edit files remotely. You have it
on your network. Then what do you do? Right. And then once you've got that,
you pretty much can put it anywhere in your home. So what I typically do with my pi zeros or my pi
fours that don't have wired ethernet connection is I get that into that state where it's completely
wireless. And then I just do a shutdown command so I can safely remove it.
Now, of course, you don't have to,
but it's good practice to make sure all your file sessions are closed
before you just unplug your Pi.
But, you know, if you didn't have the patience for that,
you can simply unplug it and then find another power source somewhere in your house.
You can even run it off of a battery.
A lot of people do that for short-term uses of Pis, and then find another power source somewhere in your house. You can even run it off of a battery.
A lot of people do that for short-term uses of pies,
where if they're wanting to, say, monitor something for a 12- or 24-hour period,
you get yourself a really solid, large-capacity lithium-ion battery. You attach it to the pie's power supply or power adapter,
and then you're able to run it that way as well.
But typically, you know, most people,
they're able to find a power outlet relatively close
to wherever they need to set things up.
And, you know, once you've got your sensors attached,
then you can pretty much continue to debug remotely
while you're sitting in front of your favorite PC.
And it could be, you know, several PC. And it could be several doors down.
It could be three floors away.
But the nice thing is that from a development standpoint,
everything seems like it's right there, local,
and you're getting immediate responses to whatever sensor that you're trying to pull.
So it makes debugging really easy that way when you're set up remotely.
That's how I do it, is SSH.
I just image with the Raspberry Pi Lite, move along, add the SSH file to the root,
SSH into it, it gets an IP address from my DHPC server, so it's pretty simple there.
If not, I can hop into Unify and see, okay, which device is on my network,
what's the IP address, find it, log in viaSSH, add my key, do some additional stuff.
These are things I don't use Ansible, so these are things I can probably eventually
automate. Where I have, like you had said, where you're updating your
operating system, doing things like that, but I'm manually doing
things now. I have two pies, so it's not that hard, but the additional thing I do
that's probably not necessary, but it's a nicety if you want it,
is enable the VNC server inside the Raspberry Pi.
So I use a Mac, so I can use the screen sharing tool or the remote app
that lets me remotely access other Macs on the network. Use that essentially to
visually see the screen. So you said before with
adding a monitor or HDMI,mi i skip all that i buy
the absolute base level pi uh an ssd i happen to go with 64 gigs because i'm just slightly crazier
than you power it however i want in my case it's a poe hat i put on the network like that ssh into
it i never literally never look at it again unless i have to go and physically unplug it to reboot it because something went crazy or the temperature's off the wall, which in most cases it's pretty
nominal, maybe 50, 60 degrees Celsius, which is pretty hot. It does run pretty hot with no fan.
I don't run a fan, but that's the way I run mine. It's a pretty minimal kit. And at that point,
it's Docker services, HP services,
so I can access any visual that is actually running it,
whatever service, via a web browser.
And I happen to use PyHole, so I set up all my DNS via that.
So if I want to log into my PyHole, for example,
I type in pyhole.home.lan slash admin, and that goes to my PyHole,
despite it being 192.168.99.3.
That's the link to that particular pyehole on my network.
I don't want to plug in that IP address.
I want a nice, known kind of domain-looking thing.
So the pyehole really adds a lot of greatness to my local network.
And if that thing is down, like, gosh, the world sucks in my house, basically,
because it does a lot for the network. Yeah, I know exactly what you're talking about. I use the
Pi hole for the exact same purpose. It's a really nice DNS server for local addressing and makes,
you know, being able to pull up local resources much, much easier than typing out a, you know,
full IPv4 address or having to help you if you've got an IPv6 network, even worse. Right. Yeah. So I mentioned Raspberry Pi Lite, that operating system. Is that the one you
recommend for most people? I know you mentioned, what was the operating system you mentioned?
Manjaro.
Manjaro.
Yeah, the Raspberry Pi OS is the great starter for most people. That's the one that comes
usually stock on a lot of the Raspberry Pis that
are prepared. A lot of schools use Raspberry Pi OS for, you know, just inexpensive workstations even.
But if you're ready to move up a little bit further along the stack, you know, there's Ubuntu
and Ubuntu has different flavors. You can get the full blown 64-bit desktop. That one's a little
heavy. I've noticed also performance-wise, particularly for video playback, it can exceed the processor capabilities sometimes.
I think they're obviously working on optimizations.
So if you're trying to use VLC on it, for instance, that's gotten a little bit better.
And they're trying to target and tie in a little bit more with hardware acceleration. But the Raspberry Pi OS has
got most of those optimizations built in, which is why it took a lot longer for the Raspberry Pi
OS version, the 64-bit version, to come out of beta. So that's probably the best one to go with.
But when you're ready to start to graduate, again, going with an Ubuntu server, or if you really want
to go lightweight, go with Manjaro. I use Ubuntu server on three of my Pi 4s
because I'm running a Kubernetes cluster with the Pi,
just because I can.
I was going to say, why?
That way I absolutely make sure that whatever applications
must absolutely be running at all times,
I've got that capability and that scalability.
But yeah, it's mostly just for fun.
And to say that, yes, I can run a full-blown Kubernetes cluster with two nodes and a master or a primary server that is controlling everything internally.
That's also great for experimentation because this way I can blow it up if I need to or experiment.
And I don't have to worry about any kind of AWS or Azure or any expensive metered rate kind of scenario.
And it gives me an opportunity to experiment and throw things at it and see what works.
The only thing I found out that particularly when it comes to containerization running like a Docker or Kubernetes scenario on the Pi is that it's ARM-based.
And as we all know, anybody who's worked with any Docker containers and images and such realized pretty quickly that while the universe is slowly starting to expand for ARM-based images,
it's nowhere near the x86, 64-bit Intel-based images that are out there.
So a lot of people discover pretty quickly when they're running things like
Docker on a Pi that, why isn't this working?
Well, because you're using an Intel-based 64-bit image,
and you have to look for ARM in order to run on it.
And if you're running, hopefully, a 64-bit version of the OS,
then you should be able to run either 32-bit or 64-bit images of ARM.
But that's the trick that a lot of people discover when they get into running containers on a Pi,
that it's totally doable, but you've got to make sure it's those ARM,
probably best to find an ARMv8 version of the image that you're looking to run in question.
The Pi hole, for instance, is a nice image that you can run on the Pi.
But again, you've got to make sure that it's that ARM-based version that you're running. Same with Plex. Plex is similar. I started Plex on the Mac,
then tried and failed with the Raspberry Pi. And now I actually have it on a full-blown
45 drives, massive Stornator AV15 setup with just so many terabytes of storage it's it's just should
be absurd that you can actually do that but i tried to run plex on there and i run portainer
on the that same linux box it could run on the raspberry pi but it just i found it was under
powered right really for a full-blown media server especially like the use case for me that pushes it
to a full blown Linux box is
the fact that I'm running 4k MKV files.
So those are just super thick already.
Like minimum file size on a 4k image of a movie is like 50 gigs at a minimum
usually.
So,
and I also want it to be as less choppy as possible.
I want the best viewing experience.
And so I just went full blown withown with lots and lots of RAM,
lots and lots of storage, and lots and lots of CPU.
It's a Xeon storage or a Xeon CPU on there, so it's plenty capable.
Well, maybe when the Pi 6 or 7 comes out,
it'll have a compute capacity to handle that.
But by then, we'll all be running 8K displays, so it won't really matter.
True.
4K will be like the old 1080p.
That's right.
Which is really interesting because I think the Pi has already gone so far at version 4.
Oh, absolutely.
I cannot imagine what the 5 is going to give us.
I mean, they're already pushing so much.
Well, it blew my mind that you can set up dual 4K monitors on a Pi 4.
Now, granted, you know, your your performance you're not going to get hardware
accelerated performance but at the same time if you have fairly straightforward relatively static
displays that you just want to have for you know a couple of terminals up you can have a full-blown
tool monitor 4k scenario that plugs directly into the Pi, and this little piece of hardware can power that.
That just blows my mind.
So you're absolutely right.
It's an amazing piece of technology.
Where they're going to take the 5, I can only imagine it's going to continue to increase both the CPU, GPU, and probably even some sort of a RAM upgrade.
I can imagine they'll probably offer a 16 gig version because they can.
And anybody like me who is really starting to get to that limit of the 8 gig
will probably appreciate that and, once again,
allow me to future-proof for another couple of years.
So when you push your pies,
since you say you try to minimize how many you buy or kind of buy the 8 gig version, do you simply go full utilization to each pile?
Is that the way you look at when you might pull out another one or buy another one?
Is it more like I want to fully utilize this single pie here and then maximize it and then feel like if I have more services to run, then it's a whole new pie I then begin to fill up and maximize.
Yeah, it's actually a combination of various factors.
So a lot of times it's resource constraints,
but other times it's just, you know, I need a pie in this location.
Or, you know, I want to experiment with one
without having to disrupt my sort of production pie
so that I've taken a lot of time and effort to make
sure that this thing is fully optimized. So if I'm going to toy with something, I'd rather not
use that on everything else that's running on the services. But when I do notice that things are
either starting to slow down or if I see that RAM usage on my Grafana dashboard is starting to get fairly high and consistent,
then, you know, unfortunately with the Pi, you can't just put in another slot of DRAM.
You can certainly increase your storage, but, you know, RAM is that hard ceiling.
Right.
So when it starts to get in around, you know, about 6.5 to 7 gig of RAM utilization consistently,
that's usually when I say, okay, time to start
to decouple some of the things I'm running here and distribute it elsewhere.
So you basically would have a dedicated Grafana Pi basically at that point, or maybe
it outgrows the Raspberry Pi and you got to get an actual Linux box beyond the Pi for that reason.
Fortunately, I haven't had to do that yet with my Prometheus and Grafana servers.
As a matter of fact, what I recently did was I used to run Grafana on site, on-prem, but
they've got that Grafana cloud and I got tired of always having to upgrade anyway.
So I just got lazy and they'd offer a free tier.
You just have to be careful not to send too much data.
Otherwise, they start to concatenate so you don't have a large history to be able to fall back on.
But the Grafana cloud that they offer at the free tier is, you know, that way I don't have to worry about versioning and such.
And, you know, it's just data that I'm spitting out from my Prometheus on-site server anyway that's connected to that cloud.
Yeah.
And it also allows me to check it wherever on whatever device, whether I'm at home or not.
And also, I got the alerts set up so that if I do get threshold issues, CPUs running hot, whatever, I'll get the alert from the cloud as opposed to on-prem.
Yeah.
You mentioned production.
Is production, and you also mentioned the Kubernetes cluster, so is it a cluster sitting on your desk? Do you have these things rack mounted? Do you have other gear
like networking gear and whatnot that's rack mounted? I imagine you probably got
a server room or something like that in your house, in quality server room, you know,
maybe it's a closet, you know, recommissioned as a server room. What's your setup for production?
Yeah, actually, you know, I'll be honest with you. I used to have a lot of hardware. And of course, I had to pay for the electricity to run all that hardware. But with the Pi's just occasionally ping it. So, you know, I got
myself a couple of the Pis and even for, like I said, with the experimentation stuff with the
Kubernetes cluster that I put together, that's really just three Pis stacked together. There's,
I got a mounting kit from one of the Pi distributors and it's just a plexiglass
mounting kit with the brass mounts. And it looks really nice.
I probably could go downstairs and pull it out of the wall and bring it up here.
But then, of course, my cluster would go down and I'd get all these alerts.
Can't have that.
Right.
But it's really simple.
And, you know, even those three pies running 24-7 doesn't even come near the expense of running one of my old Dell 1U servers that I used to have back in the day.
So networking-wise, do you have a server closet that you got like a couple switches in?
I got one switch. It's a Cisco switch.
It's a one gig managed switch and 16 port.
Very simple.
Like I said, most of my Pis, which are the Pi Zero W's, are all running wireless.
The only ones that I'm running wired are those Pi's that I absolutely have to have connected for, you know, fast Internet connectivity and doing whatever kind of Internet processing, pulling things down or, you know, being able to make sure that I'm getting solid connectivity upstream for things like my Prometheus server emitting to the Grafana cloud,
for instance. But, you know, in terms of wired devices, I actually, when we built the house,
I put together a wired network. Unfortunately, at the time, it was Cat5. So all that, you know,
Cat6 goodness, that's all in the walls now. So I actually get better speeds out of a Wi-Fi 6
than I do out of my Cat5s, which are topping out at 100 gigabits.
But, you know.
Wow.
Hey, when you build something 20 years ago, it can only future-proof for so far in advance.
Yeah.
I was an absolute fool.
I only went Cat 6 on certain rooms in my house.
When I had the full ability to do Cat 6 anywhere I wanted to.
But, like, idiot me just did not know then.
I was like
in retrospect i'm like why would you do that why would you like split your house some
cat 5e and some cat 6 it's like make any sense well you know when whenever cat 7 comes out with
these or it's 50 or 100 gigabit capabilities yeah or terabit capabilities then you know all
that stuff is going to be sure like uh the old twisted pair copper wire from old telephone pot systems.
But hey, you can use it.
I got a good 15 years of great utilization out of it
before my cable modem said,
it doesn't matter what your internal speed is,
you're not going to be able to take advantage of
the kind of throughput I'm pushing through this modem.
Yeah.
This might go one layer deeper, but you mentioned Wi-Fi 6, you mentioned one single switch.
Like, how are you dealing with, because you utilize the Wi-Fi more than wired.
Right.
I'm just curious for those listeners out there who take your advice, maybe some advice on
Wi-Fi setup,
like what particular setup do you use to get such good throughput throughout your house?
Yeah, I use the pod peer-to-peer so that I've got those spread out throughout, and it's a
continual mesh network so that it's persistent, and I've got full bar across anywhere I go in the
home. Now, it took me a little bit of tinkering
to make sure that wherever I plugged those mesh repeaters in, that it was getting a really solid
connection as well as being able to broadcast to all the available space in that particular
location. And it was a little bit expensive because each one of those Wi-Fi 6 repeaters
do cost some money. But if you want to make that investment and you've of those Wi-Fi 6 repeaters do cost, you know, some money.
But if you want to make that investment and you've got the Wi-Fi 6 devices to take advantage of it,
that would be a recommendation to go with. You could always go less expensive if you don't need
Wi-Fi 6 throughput. But again, I always like the future proof. So make the early investment first
and then you don't have to worry about it for another couple of years. Before you know, you got 15,
20 clients on your network,
maybe more.
And you're like,
I'm maxing out,
you know,
not so much the actual bandwidth,
but the,
you know,
multi-client bandwidth,
how many clients can connect to one single point and get decent throughput to
that point while also broadcasting to others.
It's,
it gets heavy traffic.
So,
and you're also you know
got clients in your home that are streaming 4k videos from you know various streaming sites so
yeah that that collapses pretty quickly if you don't scale accordingly what was the manufacturer
that you use for those uh it's actually i got you know i'm an xfinity user so xfinity sells those
pods uh the one thing i didn't like about the fact is that, you know, it's locked into that platform.
But, you know, when beggars can't be choosers, so that's the one I went with.
Yeah.
But it's pretty solid, though.
And fortunately, you know, they've got their little Xfinity app that allows you to do full monitoring and tracking and helps with the placement and such.
So it worked out pretty well.
And I'd say it was a decent investment.
Not my ideal investment because I always like to go with a third party that I can use outside
of a lock-in network.
But I was pretty much locked into their modem anyway.
So I figured I'd make it simple.
Yeah.
At that point, you're like, well, I've got these Xfinity pots.
I got to do this stuff.
Yeah.
And then you got to deal with the calling them every six months to get the best deal.
Because if you go with a non...
Absolutely.
And that's what drove me crazy.
Yep.
Drove me crazy.
I was an Xfinity user.
And great network, great service, but just having to call back all the time for the best deal.
It's just like I cannot pay the enormous price that is not the deal price.
Because that's just absurd.
Nobody does that.
Just give me one rate i can pay monthly i'll pay on time and give me great service and
let's walk away almost nobody does that uh you know they're just comcastic that way This episode is brought to you by our friends at Retool.
Retool helps teams focus on product development and customer value,
not building and maintaining internal tools.
It's a low-code platform built specifically for developers.
No more UI libraries, no more
hacking together data sources, and no more worrying about access controls. Start shipping
internal apps that move your business forward in minutes with basically zero uptime, reliability,
or maintenance burden on your team. Some of the best teams out there, Trust Retool, Brex,
Coinbase, Plaid, DoorDash, LegalGenius, Amazon, Allbirds, Peloton, and so many more.
The developers at these teams trust Retool as their platform to build their internal tools, and that means you can too.
It's free to try, so head to retool.com slash changelog.
Again, retool.com slash changelog.
And by our friends at SourceGraph, they recently launched Code Insights.
Now you can track what really matters to you
and your team in your code base,
transform your code into a queryable database
to create customizable visual dashboards in seconds.
Here's how engineering teams are using Code Insights.
They can track migrations, adoption,
and deprecation across the code base.
They can detect and track versions of languages or packages.
They can ensure the removal of security vulnerabilities like log4j.
They can understand code by team, track code smells and health,
and visualize configurations and services.
Here's what the engineering manager at Prezi has to say about this new feature.
As we've grown, so has a need to better track and communicate our progress
and our goals across the engineering team and the broader company. The next step is to see how other teams are using this awesome feature.
Head to about.sourcegraph.com slash code dash insights.
This link will be in the show notes.
Again, about.sourcegraph.com slash code dash insights. so all of the examples in your book are python but as we've been talking
this is a general system this is a lin machine, so pick your favorite programming language.
This is a full-fledged Turing-complete operating system.
So you can write stuff in whatever language that you want.
The thing that ties it all together, though, are the different sensors that you can plug into these devices
and then access the data off those sensors.
And your mileage may vary based on your programming language du jour how you access that particular information and all of mike's examples will show you how to get
at it from the python side of things what other sensors haven't we talked about we talked about
the water leak notifier which is a particular type of sensor water sensor we talked about
temperature sensors we talked a little bit about power and how that's kind of a hard thing to sense.
You mentioned Hue.
We haven't touched on it directly.
Hue lights.
You want to open us up more into the world of different things that you can actually plug into your Pi to get data off of?
Absolutely.
Yeah, so again, with the Pi, it's already been recognized as a nice home automation tinkering device.
And there's a lot of third-party, what they call pie hats, which are what those we talked about earlier, how you can put those add-ons and plug them into the GPIO pins.
A lot of them are already situated so that they'll sit nicely once they're connected.
There's one particular sensor board that I talk about in the book that has a whole range of sensors. The ones that I focused on were really just the
temperature sensors, but it's also got a humidity sensor. So if you want to do, say, like greenhouse
monitoring or just general humidity censoring in the room that you're measuring, it's got that
built in. Like a humidor, a cigar holding a pen. Right. It's got a photo sensor on it so that if you have motion detection, you can do that type
of thing. As a matter of fact, in one of the projects that I tie in the motion sensor along
with another attachment that you can buy for the Pi, which is the Pi Camera, and that's sold by
the Raspberry Pi Foundation. There's others you can buy too with different kind of imaging quality, but the one that the Pi sells, the Pi Camera 2, is actually
pretty good. It's got both video and still frame capabilities built in, and they're fairly
decent, even on low capabilities. So what I did in the book was show you how you can connect
that motion sensor so that when there is motion
detected, you can do a capture. And that capture, again, it could either be a video or in my case,
I just wanted a still image and then took that still image and you could email it as an attachment.
But what I did was I tied into the Discord API so I would get an immediate notification along
with the image that shows me somebody just walked in the area that I was measuring. So I would get an immediate notification along with the image that shows me
somebody just walked in the area that I was measuring. So if you wanted to protect your room
or you wanted to see if there's anybody stopping by in front of your home or any other place that
you want to see, if there's motion detected, you have a house pet that is looking to get into
things, you could set that up so that you would immediately get a notification on your phone or on your computer saying, this is what happened, this is what I saw,
and now you can act upon that. So that's kind of a nice sensing capability. Talking about the Hue,
the reason why I like that so much for my lighting and electrical triggering needs is because they
do have an open platform. In fact, there's Hue libraries, not just for Python,
but for Go, for Rust, for Java.
There's pretty much any popular language that's out there.
The Hue supports it either through third-party libraries
that people have posted on GitHub.
And it's just really, again, it's a nice open platform to work with.
So you're able to interact with that Hue hub very, very simply.
And I show in the book how it's easy to use this very popular Hue library called P-Hue
for Python.
It's very comprehensive, very complete, and yet very easy to use so that you can not only
interrogate the Hue to see what all the lights that are connected, including the names that
you may have assigned them, but also to be able to trigger on-off connectivity.
You can do dimming.
You can change the color.
And so it really gives you a lot of flexibility.
The deeper that you want to get into it, the level of sophistication is just really off the charts.
The other cool thing about all of this capability, as you start to connect all these pieces together is the complexity that can grow out of a very simple project.
And yet, because you were able to build it in stages, you're very competent on knowing exactly what's happening and all the dependencies that are connected to it. the same time, it's acting almost not like a sentient system, but certainly you would never
be able to do something as sophisticated with those level of triggers and actions and reactions
if you didn't have these capabilities and these systems in place. So, you know, again, think about
all the sensors that you can deploy and all of the different feedback systems that you can enable.
So based on all of these sensors and whatever their values may be,
you can act upon them and make them do things that you would not possibly be able to do,
even with a very, very expensive automation platform that is custom designed for those
kind of interactions. Just because it's such a unique use case that you can't scale it to make
it a commercial product, but for your own special needs, you can do some amazing things and make it specifically tailor-made for exactly what you need
to do. And that's why I think that Pi platform and all these automation capabilities in these sensors
really make a lot of sense for the home enthusiast. The security has got to be one thing. You mentioned
like leaking data in the first part of the call. And I think that's probably part of it too.
It's like you could probably buy some of these things at Costco or pick your
nearby place. That's got systems and you know,
maybe you can do similar cobble it together or duct tape it together and make
it your own.
But at some point you have to think about the terms of service you mentioned
before the privacy aspect of it, the data leak of it, you know, in the closed box, the opaqueness of some of these systems where with a Raspberry
Pi, you may be, you know, venturing into uncharted territory, maybe you're a web developer and some
of these things are pretty common to you. But if you're somebody who's listening to the show,
that's not even, you know, in quotes, a developer, or just someone who's willing to kind of get
dirty handed in the terminal and do some different things and whatever.
But you may not think of yourself as a developer.
These are things that you can protect your household by not giving away all this data to these companies.
And the other thing that comes into play with these business models that are out there, particularly in the home automation space, are they're subscription based. And some of these companies, they may just vanish overnight. And I know there are several
have, and it has left all these people with these very expensive deployments completely out in the
dark, because now all of that investment is absolutely worthless because there's no mothership
for it to talk to. And if you did it on your own, well, there is no mothership for it to talk to and if you did it on your own well there is no mothership you are the mothership so you don't have to worry about all of a sudden
these services going dark right are there options are there ring alternatives so i just recently got
a ring for my wife and plugged it in and i don't think ring's gonna disappear because amazon owns
them now or is it google i don't know they're owned to disappear because Amazon owns them now, or is it Google? I don't know. They're owned.
But they do give you video logging,
and then after 30 days, they're like,
hey, it costs $3 a month for this.
And I was like, wait a second, I already bought the Ring.
Why would I buy?
And then I started thinking, well, I should have researched this more.
There's probably alternatives that might be a little bit more open.
The hard part with that is it's there on your front door or your front porch you want to be a nice looking device they
do have a great experience so i'm happy with the hardware and the software are there things in the
world of pies that are trying to compete with you know smart doorbells and camera devices and things
like this yep but of course they won't have that level of ease of installation, ease of use.
Right.
Because, you know, you don't have a massive platform behind it and a company that's willing to invest multi-millions of dollars into a fairly robust environment.
Like you said, you know, Ring is probably not going to go away anytime soon.
So you probably don't have to worry about going down.
However, you probably do have to worry about it becoming obsolete at a point.
Probably not in the next five to ten years.
Planned obsolescence, perhaps?
Oh, absolutely, yeah.
So, you know, while your ring basic may be working at a certain level,
if you want the new one with all the whiz-bang features,
you'll have to upgrade to that.
So that's, you know, their planned obsolescence roadmap, I'm sure. But then again,
the other thing is, you know, a lot of people have talked about what the privacy implications
of certain ring configurations may be. I think because of the pushback, Amazon's gotten a little
bit more aware of allowing some users to dial some of that back. But there's certain areas,
just like on today's smartphones, whether it's Android or iOS, you know, hey, why can't I see what's going on with that firewall? Why can't I
see what kind of telemetry Google or Apple are sending back to the mothership? It's just maddening.
You could block that with a buy-all, though. I mean, there are some remedies there. You may get
less service, but you can block. There's a lot of bug snag on blocking. There's a lot of telemetry
on blocking. As long as you of telemetry I'm blocking.
As long as you never leave your house.
Exactly. Don't leave your house. So forget about the mobile aspect.
Adam never
leaves his house anymore.
In the wide world, Adam,
you're on a cell signal. You can't piehole that
stuff. Well, that's true.
I don't know what you're talking about.
The one thing I think,
have you ventured into the world of locking your doors and stuff too,
then since we're talking about like cameras and front doors and rings and
whatnot, like, you know,
have you begun to like automate locking your doors and real security level
things versus like temperature and lights and things like that,
which is more aesthetic and appearance and, you know,
comfort versus security.
Yeah. That's a little bit more of a tricky proposition because you have to figure out,
number one, the power source for those locks.
Right.
A lot of homes don't have some sort of electrical connection that goes and looks nice, by the
way.
Of course, you can have it all exposed.
Right.
Look like a harness nest of wiring.
You have to unplug your front door before you open it. let me unplug this thing from the wall right then you've got
all the machining that's necessary is my door fully charged that could be a defense mechanism
all its own like don't mess with this guy's front door you know right i mean people who want to go
that route i would suggest looking at some of the you manufacturers like Schlag, for instance, they make Bluetooth capable.
But again, as far as I know, I haven't checked Schlag out in a few years, but I remember that
when they first came out with their devices, it was tied to their platform. So you had to use their
app to be able to communicate. It wasn't an open platform, I think partly because of some security
and also because it was first
to market.
So they weren't really sure how capable they were when it came to, should we open this
thing up and be beholden to the world coming down on us?
And we're trying to say it's secure, but all of a sudden there's all these security
vulnerabilities that are discovered with this piece of hardware and it's firmware and we
can't update it.
Then what do we do? So that's, I think, some of the more concerning
problems. There's certainly for those people who are, you know, have electrical electricians bent
and they are woodworkers. Yeah, they certainly could implement something like that, but
it would not be for, you know, anybody who's just looking for a simple solution at this point.
Yeah.
Well, you've got to remember your home is still production, right?
If it doesn't work and it's not convenient, you're going to get upset that your front door doesn't lock or something's not working right.
For sure.
And if it's all called together by you, you're the one who has to deal with it.
And you're like, I just want to be done with work, and here I've got more work to do.
Right.
So at some point you've got to minimize.
But maybe some others go further and they're content with it now some of the things
i have done and i've also seen implementations of on the web are people who are checking when
their garage door is open yeah so you can certainly put various sensors in place there
one of the easiest one is you know just for looking for any kind of motion detection
so that if that garage door goes up all the way, you can immediately check on that status.
And again, with a pie with that camera, you can instantly check.
Did I leave the garage door open?
Well, let's find out.
And you can just simply pull it and have it show up either on your Discord or whatever messaging platform you have and just send it a quick message and say, garage door, and it sends you a snapshot
and showing, yep, everything's closed and buttoned up.
That would be nice.
I've always had that circumstance
when you're in bed at night, it's 10.30 or 11,
and you're about to fall asleep and you think to yourself,
did I leave the garage door open?
Yep.
And you gotta get up and go look.
And sure would like to stay in bed
and just pop open pop open a your
cell phone and i know there's commercial products for all these needs as well but you know it's fun
to do it yourself it's fun to absolutely build it and hack it and and figure it out that's the joy
and and you know run your home with a raspberry pi it's just it's more holistic and it's more fun
and you learn a lot and it's empowering because once you feel the confidence of, hey, I did this,
then you're ready to go and build on that.
So it's no longer this mystical black art.
It's something that I understand it.
I can do it.
And when I've got an idea,
it's no longer something like,
well, where do I get started?
It's like, oh no,
I can just build on the knowledge I've already got
and easily scale it out.
So as I said, with my home,
I've got a number of pies running, but, you know, they're all doing different kind of home automation
that I don't think I could actually purchase some of the things that I'm doing. But I, because of
that knowledge base, I was able to build up and the confidence that I got with working with the
sensors that just made it so easy. And so for me, it was that empowering moment of saying, I can do this and
it's no longer anything that's going to deter me from thinking of what new ideas can I implement.
And it's not a matter of can I do it, but how quickly can I do it? Yeah. Well, Mike, I am sold
on the concept. I am going to build my freezer is working detector just as soon as a raspberry pi is available i have been
clicking through on their website to all of the various retailers resellers retailers i don't know
the people that sell the devices and they sure are sold out everywhere with many places saying
we do not know when this is going to happen in the meantime of, you have the book, Portable Python Projects, Run Your Home on Raspberry Pi.
We have, thanks to Jackie and our friends at PragProg, we do have a discount code for the listeners.
It is PIPROJECTS, all one word, all caps.
I'm not sure if the caps matter, but all one word.
Take that code for 35% discount on the book, which is good for 60 days from the day that we publish this to our feed.
So if you're listening to this within the next couple of months
and you want to check out Mike's book, you can use that code and save 35%.
So that's pretty cool.
Thanks to Jackie and our friends over there for making that available for our listeners.
That's cool.
Anything we missed, anything we didn't talk about,
any projects that you want to highlight real quick before we call it a day?
We know we're hitting up against your time here.
Yeah, I think it's really just a matter of just get started.
There's always that time when people get excited by this,
but then it's always, well, I'll do it when I have the time.
No time is better than right now.
And so if you do have access to a
pie and maybe if, if you really want to get one, you know, you may have to pay a little bit more
on eBay, but, um, you know, there are pies out there or you may, who knows, you may have friends
of yours who've had purchased the older pies and it's just sitting in their drawers somewhere.
And they've discovered, Hey, I've got this old Pi 2 or Pi 3. Put it to use. That's enough to at least get started.
Absolutely.
Yeah.
You know, just get started.
It's one of those things where if you can just spend 10 minutes a day to get learning it,
you'll find how tremendously productive you can be in just such a short amount of time.
And once you've built your first project, there's no holding back.
You're on a roll.
Mm-hmm. Well, we've got Mike's book.
We'll link up, of course.
You've got the discount code out there.
We're also going to put two more links in the notes.
Jeff Geerling, I mentioned his YouTube channel is a wealth of information.
And there's also TechnoTim.
I follow his stuff.
A lot of stuff on Pi there as well, especially Kubernetes and automation and Portainer and just a lot of fun things around your home.
It's really interesting stuff. So between the book, blog post Mike has written, and those two links there to those YouTube channels,
it's going to be a great amount of resources for anybody looking for that confidence in that first project.
So, Mike, thanks so much for the time, the wisdom in the book.
We appreciate you.
Thank you.
Thank you so much.
It's been a great time.
I really appreciate the ability to talk about the book and also just talk tech in general. I love it. Thank you. Oh, yeah. It was so much fun. Thank you. Thank you so much. It's been a great time. I really appreciate the ability to talk about the book and also just talk tech and general.
I love it.
Thank you.
Oh, yeah.
It was so much fun.
Thank you.
That's our show for this week.
Thank you for tuning in.
If you haven't subscribed yet, now is the time.
Head to changelog.fm for all the ways.
And if you dig this show, I think you'll dig some others in the Change Law Podcast universe.
I want to mention Ship It,
episode 50 from our Kaizen series.
This is Jerry sharing details
about our new info we moved to on fly
and how he's an old school Heroku fanboy.
I've been excited about this shift
because I'm a Heroku fanboy from way back.
I'm an old school sysadmin.
I was like, you know, SSH into the machine,
send us some cron jobs, you know, I was like, SSH into the machine, set up some cron jobs,
copy the stuff, rsync the things, backup the database. And once I didn't have to do that stuff anymore with Heroku, I never wanted to do any of that stuff ever again. I am a loyal listener
of Ship It, but I don't do any of the things that you guys talk about doing on Ship It. I just like
your show, Gearheart. But once Heroku came around, I was just like, yeah, let's just let Heroku do all the things. And when it came to
Elixir, I lost that. And we're like, gonna go deploy this Elixir app. And so that's when I
brought you in to help me do the things that I used to be okay at, but also don't know how to
do things well anymore. And in this ecosystem, it thus began our story. When it came to Ansible,
I was along for the ride. When it came
to Concourse CI, I was just riding your coattails. When it came to Kubernetes, I was like, I hope
Gerhard knows what he's doing because I don't. And so just a Heroku style Paz for me is exciting
because it's like, I feel like it's a pool that's shallow enough that I can swim in it safely and not have to turn to you and say,
what's the cube cuddle thing or the canines thing?
Because those are just areas that I don't normally swim that deep.
And just being back on this short time,
I've been able to figure out some stuff of myself and do things the way.
I mean, it's not as polished as Heroku.
I can probably get into some of those details, but it feels familiar.
And for me, my mental model is so much simpler
and it's not for any reason, I don't think,
except for that I never acquired the knowledge,
the deep knowledge of the other platform.
And so this is something I feel like I can rock more simply
and administer without you.
And even the other day, I asked you a question
and you weren't around.
I figured it out.
Continue to listen to that show at changelog.com
slash ship it slash five zero.
That's episode 50.
Thank you once again to Mike
for sharing his time on the show today
and also his awesome books out there.
Also to our awesome friends and partners at Fastly
for making all of our podcasts super fast globally check them out at fastly.com that's it for this week thanks again for tuning
in we'll see you next week