Little break

I took a little break last week. There was no real reason other than I was busy coding! There are times when I really get involved in something and I can’t stop coding. This was one of those times! Working from home and a little side project has been keeping me busy, but there is another project I’ve been working on for fun.

Story

A bit ago, I wrote about our building maintenance worker shutting off our AC unit and the servers were about to melt down when my boss went in to clean. We haven’t had an incident sense, but there is no one in the office to keep an eye on the server. How would we know if the server was melting down? …Hmm. I decided to try and build a temperature sensor for the server room.

The Project

I am a huge fan of the Raspberry PI and have done several projects. The Parking Lot Project is one of them. This time, I took a Raspberry PI and a USB Temperature Sensor and hooked them up into a makeshift temperature monitor for our server room. The system will send out an email when the temperature reaches “warning” temperature and an “emergency” temperature. Let me tell you about the setup. I’m not going to tell you everything I’ve done and show code. If you want that, I can share it.

  • Raspberry PI 3
  • Case – This is probably my favorite case that I’ve used so far.
  • Raspbian OS
  • USB Temperature Sensor
  • NodeJS
  • Python & Pyteams – Used to post the current IP Address to Microsoft Teams when the system boots up, so I can find the IP address. Very important
  • Temper-Python – Used to read the sensor.
  • Smart Plug – This is also key when the server stops working and you have to reboot it from home.
  • Sqlite – I’m currently just writing the logs to a local DB. I really want to change this
Before placing it in the server

Grabbing the temperature

I wrote a little tool, in Node, that calls “temper-poll” every 15 minutes to read the temperature with a cron job. This is a super simple script that grabs the temperature and inserts it into the DB along with the time. I really want to change this and sync the dates with a server. What if the server shuts down? If I can see the temperature trend, it may give me an idea of why the server is down. (Was it climbing to it’s death?)

Web View

The next piece was the fun part. I am not a UI guy, but I like to play one sometimes. In recent interviews at the HackerX events, they are always looking for a Full Stack individual. (see “Out of My Shell” post) I think that is where I had the most fun on this. I decided to deviate from what i’m use to,Bootstrap, and go with Semantic-UI and Jade. It’s been a bit of a learning curve.

What you see in the image is a week of tweaking. I’m still not happy with what I have but it is ok. I’m sure I break a lot of UI rules, but it is functional.

Last week I decided to add an “Average” temperature line that, I was hoping would tell me how the current temperature relates to the average. The average is hard to show when the air conditioning is kicking on at random times and the heat outside, etc. (that’s my guess) As of this writing, the temperature has been the same for 7 hours. It is making me nervous. It’s hard to see but the temperature is 65.9 for the last several hours.

What is next?

This has been a fun little project that has kept me a little busy. It’s a super simple concept, but it’s a bit hard to debug remote and keep it up. The smart plug helps. I’m sure I’ll be tweaking this a bit here and there. A few things I want to do.

  • Figure out why the temperature has been the same.
  • Sync the temperatures to an offsite DB

This has been pretty fun. I hope it doesn’t fail me when the air conditioner goes out.