My Raspberry Pi Weekend

Categories Techy

Extended weekend really. I spent my four days off this week without too much to do, but I felt super productive because it’s my first days to myself since the holiday. Amongst catchup up with washing and actually doing some drawing I set up my Raspberry Pis again.

I’ve currently got two Raspberry Pis set up – A Raspberry Pi 2 which is the main one I use. I’m doing some home automation stuff and the Raspberry Pi 2 acts as the hub of that, with a Raspberry Pi Zero feeding it data from across the room.

I just want to talk about some of the stuff I’ve done, because I’m not ready to post tutorials and code snippets yet, but I will soon!

Firstly, I have set Dexcam back up. So tweets of whatever my rabbit is up to get posted once an hour. It might be a little boring compared to last time as he now has a two floor bunny mansion, so if he’s not on the top floor it won’t really show much. The aim is to change it to sense motion, wait a second then take a picture? But for now it’s fine the way it is.

I’ve also been working with the Phillips Hue API so I can control the lights using my own code. I wasn’t going to touch them at first as anything I’d need them to do can be done via the Hue app or IFTTT. But that attitude wasn’t letting me play with code so I’ve added a few scripts to the Pi which I can call for fun.

Speaking of calling the scripts, check this out:

This is my (currently very ugly) control panel I have been making. Any scripts I’ve written can be called on this page. The bunny button takes a one-off Dexcam picture and tweets it. The lights below let me change colours or do a colour loop on the light behind our TV. 

I’m yet to add our other lights to the system. We did however discover our Hue lights fit our fish tank. SO GUESS WHAT THE RAINBOW FISH BUTTON DOES?

I know I know, that’s the most pointless thing you ever saw. But it looks freakin’ cool. Did I mention we got new fish? Uh, yeah, nothing to do with me that…

Speaking of nothing to do with me being the reason we got new fish; I also bought a temperature monitor for the Raspberry Pi. It’s attached to the zero because we needed it hidden away behind the tank and no-where near the Dexcam Pi.

So on my control centre screenshot the final figure is the tank temperature. It’s actually a little high in that screenshot which Terry is fixing. The final plan now is to set up a text alert in case the tank temperature suddenly drops, you know, in the totally hypothetical situation where someone might accidentally unplug the tank and kill them all. That, coupled with a smart plug where we can remotely flip it back on? 

I totally don’t sound like I’m trying to make up for a past mistake, huh?

I guess the best part of this whole thing is me just coding some junk for the control centre. I’ve levelled up in PHP because of it though, and written my first functional object orientated PHP scripts.

That, coupled with some Python, Bash and some pretty shady hacky things have been really fun. For example, I’m not the best coder, so the only way I saw to get the temperature to display on the Raspberry Pi 2 hosted control panel was to have the python script taking the temperature dump the output into a .txt file, then SCP the file to the main Raspberry Pi, then the PHP reads and displays it. 

Which seems rather convoluted but for me it was a good way of discovering some of the things I can do. 

Anyway, I’ve rambled enough without really showing any code or circuit set-ups so I’m going to work on prettying them up so I can write some guides!

 

No Comments

Leave a Reply