IOT Projects

Raspberry Pi Rack

Even before buying any Raspberry Pi computers, I had this sort of vision for neat rack to put several of them in. The idea evolved a bit as the logistics of it got ironed out but after picking up a second Pi (and planning to get a third), I went and built the thing.

Raspberry Pi Rack

Sorry for the mediocre pictures, I didn’t think to take photos until things were running and I didn’t really want to unplug it. It currently holds a Raspberry Pi B+ and a Raspberry Pi2 B, the B+ is running a ZNC server to keep me connected to several IRC channels and the Raspberry Pi 2B is running a small OpenSIM server, though I’ll probably re-purpose it since in testing performance seems to top out at around 2000 Prim cubes and 4 Avatars. The instance I’ve got running on my VPS is much more suitable. On the other hand, it could be a good place to “archive” builds.

Raspberry Pi Rack

The build itself is pretty straight forward. I used (roughly) the following materials picked up at Lowes:

  • 3 pieces of 10×8 plexiglass cut to 5×7 size.
  • 6 6″ #8 thread rods.
  • 8 (2 packages) of #8 rounded caps.
  • 3 packages of #8 nuts
  • 6″ Micro USB cables from Amazon
  • Cat 5 Cable cut and crimped as needed
  • 1 Netgear Switch I had already
  • 1 Choetech 40W Smart power from Amazon.
  • The smaller screws holding the Pis in are 4mm i believe, and it took two packages of them (16 screws and 32 nuts).

The hardest part was working with the Plexiglass pieces. I could have cut it with the Dremel but the edge would have been all crooked for sure. Instead I scored and snapped them, which did leave a jagged edge on one edge but it could easily be sanded off. On a starting note, the Plexiglass comes with a plastic protective layer, this should be left ON until final assembly to protect the clear surface as much as possible.

Anyway, to cut the sheets down, I used a square and a box cutter to but a line where I wanted the break to be on one side, then clamped the sheet down on the edge of the workbench between the surface and a 2×4. The 2×4 was mostly to help protect the surface of the plexiglass from the clamps. The cut edge should be on the up side, right at the edge of the surface and the 2×4 (or whatever) at the edge on top. The Plexiglass should snap more or less cleanly off. I had some small chips left hanging on the shorter 1″ breaks to shorten the shelves to 7″ from 8″. I used a small hammer while the pieces was still clamped down to chip these down a bit.

The real trick was drilling the holes. In the end, I found the best results came from clamping all of the plastic sheets together between some boards and drilling them all at once. There should be a piece of wood completely covering the bottom of the drilling spot to help support the plexiglass as the drill penetrates through.

I had some trial and error trying to drill my sheets separately, so the holes are not perfect. For the mounting holes I laid the Pi itself where I wanted it and uses a pen to mark the holes. I probably could have done a bit better with a paper guide though.

Assembly was pretty easy, just a lot of tedious screwing of nuts as the thread rods were fed through the holes. Each shelf takes at a minimum, one nut above and below to hold them in place and the rounded caps go on the top and bottom. The power supply and switch are not mounted, they are simply sandwiched in place between the shelves, though the supporting long bars were positioned around the Switch to prevent it from sliding left or right or backwards.

The Power supply I picked because it has two standard wall outlets on one side. I used the Dremel to cut holes in the top sheet to allow these plugs to be accessible. I wanted the unit to be as self contained as possible, these plugs give me a place to plug the Switch in. It’s important when choosing a power supply that it has enough power on all ports to power a Pi. A USB HUB doesn’t work since it will distribute power across all the ports. Several ports I looked at had 2 “high output” ports for iPads and iPhones but the rest were lower output.

The USB power cables were 6″ jumpers I found on Amazon and the CAT 5 cable were small jumpers I made myself with ends and a crimper. When I add the back two Pis I’ll need different cables though, likely cables with a 90 degree connector and definitely longer ones.

Raspberry Pi Rack

The whole package sits nicely on top of my desktop box next to my Synology NAS.

Building up to the Raspberry Pi

Raspberry_Pi_LogoI’ve been hitting the Raspberry Pi and Arduino pretty hard lately.  I plan to detail my projects some here in the future but I figured it would be good to start off with a little “why” and a little history.  I mentioned the Arduino, but I only plan on touching on the Raspberry Pi here today.

I’ve used a secondary PC for projects for a very long time now.  A second or third or even fourth PC an be extremely useful for learning more about PCs.  The main nicety is that if you want to completely wipe it out, you don’t have to worry about what to do with your important data on your main PC.  Want to try a new Linux distro?  Screwed up some configuration?  Just reformat and try again.  You can do some of this with Virtual Machines but that can mean sharing resources which isn’t always a good solution.  Also for any long term “always on” projects like a web server, having a dedicated box is generally cleaner and more secure.

The first project PC I had was my first personal PC that wasn’t “the family machine”.  When I graduated from High School, I was given a PC of my own. It was at the time a pretty “top of the line” Pentium 2 IBM with a blazing 450mhz processor.  Over the years i upgraded the hard drives and RAM and eventually the motherboard and processor.  Eventually, I found that I had a box containing all of the parts from the original machine, so I rebuilt that machine, installed Redhat Linux on it and started playing around with web server software.

During my time working IT/Engineering at my old television job, I accumulated several project machines.  When computers were upgraded, we just sort of let the old machines pile up in the back.  Sometimes these machines would go to employees if they needed a computer.  Sometimes I’d do projects at work to streamline the processes and we’d use a machine for some sort of ftp or scripted copy project.  If they were too old or just broken they’d get recycled.  I ended up with several of these machines as well.

The problem with these project machines is they are full PCs.  They need a lot of power to run, especially for something that is a very low use webserver or game server.  They also take up a lot of space.  Also, since many of the machines were used and old, they were prone to failure.  I started replacing the towers with old laptops but these have their own issues.  They take up less space and use marginally less power, but they also tend to over heat in confined spaces and if a laptop had been replaced at work, it likely had a severe issue and thus these laptops were more prone to failure and less easily repaired than the towers.

These days I’ve been phasing out the bulky old machines for Raspberry Pis.

The Pi uses way less power than a whole machine.  They are also super cheap, so buying several of them over time doesn’t really break the bank.  They aren’t super powerful, but I really don’t do anything that requires a ton of processing power, and because they are cheap, I can use several of them running single tasks to spread the load.  Frankly, they are still better than some of the towers I’ve used in the past spec wise.

So why the Pi?

There are a lot of options out in the micro PC space.  The Raspberry Pi is probably not “the best” but it’s definitely the “most supported”.  I like to learn and play around with new technology, but I’m at a point where I’m not super keen on having to fight with obscure technology.  This is pretty much the why of the Pi.  It just works.  Or at least, I can generally Google how to work it.

The Pi also runs Debian based Linux, which I am most familiar with when it comes to Linux.  Since the Pi is a full computer, it’s great for software projects.  There are GPOI pins but I’ve not really explored them yet.  I’m leaving the hardware tinkering to the Arduino for now.

Raspberry Pi Project 01 – Web Server

Raspberry-Pi-Logo So, just as a start, this isn’t a how to of any kind.  There are already plenty of tutorials on how to do whatever with the raspberry Pi.  Unless I’m pushing something unique, I don’t feel the need to provide another explanation of how to do the same thing a hundred other people have done.

I completed my first trial project on my Raspberry Pi of setting up a web server.  This is a pretty simple process that I have done dozens of times before on Ubuntu and Windows so it isn’t exactly an amazing feat.  The most amazing part is that I followed through on it instead of putting the Pi aside for “someday” like so many other projects.

The set up is really straight forward.

sudo apt-get install apache2

sudo apt-get install php

sudo apt-get install mysql

wget wordpress from wherever

sudo apt-get install vsftp

sudo mysql

create database wordpress

Futz with some permissions…

That’s it, pretty much the same as Ubuntu.  I guess this is a hot to after all.  I followed up by setting up WordPress through the WordPress interface.  I added a theme and some plug ins and created a few dummy posts.  Mostly I wanted to gage performance.  Granted, a single user web server sitting inside a firewall on a LAN is probably not the best way to gage functionality.

Everything ran fine though.  FTP uploads were a little slow, but I imagine part of that can be attributed to the memory card access speeds.  It wasn’t unbearably or unusably slow.

The main issue is that, I already run a private web server on a full blown machine inside my house.  It’s useful for playing with web dev stuff, I run a WordPress instance archiving all of my posts online together, I host a couple of other web apps for things like my webcams and Twitter analytics.  It is already running and does more than the Pi is probably capable of doing all at once.

Using my Pi as a single WordPress host is a waste of a good Pi.  It was a nice exercise to get familiar with the mechanics of the Pi, but it’s not really all that useful long term.  So I’ve wiped it out to move on to a new project.

I’ve been debating on what to use it for on my second Project.  I have been flip flopping between an XBMC media player and running Retro Pi to make it into an emulation station.  My main hang ups, the media player won’t be super useful without a media server to back it up.  I plan to buy a NAS later this year and start ripping all of my DVDs to it but that’s months off.  Retro Pi seems like the logical choice then except I have an old Netbook with a busted screen I plan to use to for building a retro arcade machine.  Still, it might be good to compare the Pi to the Netbook for the emulation station.  Also, I have more than one room so I could use two emulation boxes pretty easily.  I thought about using the Netbook guns to build a Stepmania/DDR box anyway, and it’s probably better suited to run Stepmania than the Pi is anyway.

Anyway, as usual, lots of ideas, lots of plans, maybe something fun will come out of it.

A Slice of Raspberry Pi

So, I got a new package and a new toy to play with in the mail.  Honestly I am surprised it took me this long to order myself a Raspberry Pi mini computer, When it was released, I was one of the people scrambling to try to order one immediately only to be disappointed that all of the stores that carry them were UK only.

And now I have myself a Pi.  I went ahead and ordered the suped up starter pack from Amazon instead of just the bare bones Pi and case.  I probably could have ordered the components separately for cheaper but I figured this would be much easier and would sort of guarantee compatibility.  The kid includes a breadboard and some wires and parts to let the Pi work better with the GPIO interfaces, which is something I wanted anyway.  Also it was listed as the #1 seller in it’s category so I figure it’s couldn’t be that bad of a deal.

IMGP1931

The Kid includes the Raspberry Pi B+ board, a case and power supply, a broadboard, a breakout cable for the GPIO, some LEDs, some wires for the bread board, a set of 3 heat sinks, an 8GB Micro SD card, a USB WiFi adaprot, and an HDMI cable.  I have several project ideas in mind for the Pi and my plan is that once I set up something that I am satisfied with, I can order another basic board kit and then use the parts on a new project.

IMGP1933

I’m kind of glad I waited actually.  The Pi has evolved quite a bit over time and this model, the B+ is definitely better in a few simple ways.  It lacks the Composite video output that the original had, but has 4 USB ports instead of just 2.  The B+ also is designed so all of the ports are on two sides instead of scattered all over the place.  The basic processor and memory are essentially the same though.

IMGP1937

The case in this kit is simple but effective, the cut outs all align properly and it snaps in pretty securely.  There are also 3 heat sinks included.  It was a little tricky to figure out where the smallest heat sink went since the photos online are all for the older model.

IMGP1938

The completed set up seals up nicely.  Not only does the case have holes for the major ports, it also has slits and holes for the lesser used interfaces, like the GPIO pins and the digital display port.

IMGP1939

What surprised me the most was just how light the completed set up is.  It’s a bit thicker than my phone but probably weighs half to a forth of the weight of my phone.  I feel like this board could easily be attached to some sort of kite or glider if one were so inclined.

pibooks

I’ve already got several Raspberry Pi related books full of projects to try and i have some ideas of my own once I get the hang of how the system works.  Plus there are the projects people have done over on /r/raspberry_pi.  I also am looking forward to seeing what I can come up with to combine the Raspberry Pi and Arduino boards.

Security Cameras Part 2: The Software

So, I recently, basically ran through my plans and such for my recently acquired security cameras.  The physical cameras are only half the equation.  I only ended up making one box, and the other two I simply mounted up under the eaves in the appropriate positions.

The second step is the software.  I’m currently using three pieces of software to monitor these cameras.  First was the included myDlink service/software.  This software is most useful for accessing the cameras from outside the house.  It includes some basic notification ability but it doesn’t have an easy to way to record based on those notifications, at least not that I can tell.  The cameras themselves can push files to an FTP, but it’s sort of an all or nothing deal based on a schedule.  Running 1 shot a second creates a TON of files that are mostly useless.  The Phone app is good though (works with Windows Phone even!)

So I set out to find a better solution for capturing during motion.  I already run a private in house web server for testing, so I set out to find something that I could host there, on Ubuntu.  I came across a nice piece of software called Zoneminder.  It’s an OpenSource solution that will monitor cameras for motion and save files based on this activity.  I believe it can also record actual video though I am just doing short term recordings.  It may be a feature that I have not found, but my main issue is that I can’t bring up a view of all three cams at once.  I’m also having the usual issues with the server and IPs, internal vs external, etc.  It’s also tricky to set up.

cams

For multicam monitoring I’m using some Windows Software called IP Camera Viewer.  This simple software allows me to add IP based cameras and view them in a grid as desired.  Simple, and effective.