Raspberry Pi

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 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 Phase 2 – Doors and Windows (Planning)

I just wanted to start off by saying, this isn’t a how to at all, it’s more some general ideas I’ve been looking over for how to add door and window security to my recently set up video monitoring system.  Basically, I want a log of when and if the doors and windows are opened and closed.  I’d prefer not to run a bunch of wires, so wireless sensors are in order.

What I ultimately want is for an indicator light on a webpage to change based on the status of the door or window, a timestamp log to be created and possibly for some sort of email or text alert to occur.  ULTIMATELY I may even use this whole project as an excuse to finally develop my Phone app skills and build an app that I can view it all on, but that’s farther down the road.  A basic web page is fine for now, and it’s something I can manage.

My worry with wireless sensors was that I’d have to constantly change the batteries.  Until I realized that it would be trivial to design the sensor so that it only transmits when the window is open, and while I am not building my own sensors (I probably could) I imagine the makers of such sensors realize that you could save a ton of battery life by designing the sensors to only work when open.  I did a bit of searching on Amazon and found a6 pack of sensors for less than ten dollars.  It appears that each sensor has it’s own receiver/indicator which emits an audible tone.

This is actually probably alright for my needs.

While I am not an Electrical Engineer, I am familiar with basic circuit flow and basic electronics.  I don’t have any of these sensors yet but I can make some basic assumptions based on what I know.   When the window/door is opened, some trigger is closed and the sensor starts transmitting some sort of radio signal.  The fob thing which is always listening will receive the signal and activate some sort of internal speaker. 

There are a couple of issues that need to be solved here.  One, while the sensors hopefully are designed to conserve battery power, the FOBs are probably not.  I also want the signal to go to a computer and not sound a mostly useless audible alarm.  The power issue isn’t a huge issue.  With the right transformer brick providing the proper voltage, it wouldn’t be hard to rewire the contacts to allow for the units to be plugged into the wall, all at once, off of one power supply.  They look to be small enough that they could be mounted inside an electrical box in a small array and wired for power.

A similar method can be used to transform the speaker signal into a trigger for some sort of simple IO board.  To activate the speaker, some sort of voltage is applied to the speaker, the speaker can easily be removed and the contact points that would previously have fed the speaker could be wired to am IO board.  When the voltage is supplied to the "speaker" it will instead be read by the IO board, triggering a signal that "the Window/Door is open."

The main puzzle I have right now is, what would work best for the IO board.  I see two options here, and both would function differently, and I may even require both.  I could go with an Arduino board or a Raspberry Pi.  Both of these options seem to have advantages and disadvantages, and there may even be a third option which corrects the disadvantages.

arduino

Let’s look at the Arduino.  The Arduino is ideal for dealing with the IO board.  It is, by design, meant to work with this sort of "hands on" electronics systems.  It even has build in contacts for working with two wire IO interfaces.  I don’t know anything about Process, the programming language of the Arduino, but I’ve been meaning to learn and I am capable of learning it.  The problem is on the output.  Arduino is not designed to work with PCs in any simple way.  From some quick research online, the Arduino would require a serial interface and likely special software running on the server to poll the Arduino at set intervals.  Which brings up another issue.  As near as I can tell, the Arduino is a "pull" interface, meaning the server would have to pull the status from the Arduino, as opposed to "push" where the Arduino would push the data to the server as it changes.

Raspberry_Pi_Photo

So there is also the Raspberry Pi.  The Raspberry Pi is a computer itself, which makes interfacing with the server simple and easy.  It runs a simplified OS but connecting the Pi to the network is simple and telling it to push even a text file status update to the server via FTP or some similar network protocol is trivial.  the issue comes in the need to read the sensors.  I’m not entirely sure the Raspberry Pi is even capable of reading an analogue IO interface right out of the box.  Some searching suggests it is possible through an additional interface board of some sort but not right out of the box.  Looks like there are a handful of GPIO points build into the PI.  The PI also feels like much more than is really needed for this simple application.

Its kind of a tricky decision, I’ve been wanting to play around with both the Pi and the Arduino so I may just pick up one of each and see what works.  Both are around the same price and the whole system in the end will end up costing around $50-$75, which is almost nothing.  The final step once the sensor data lands on the server is updating the web page but I already am familiar enough with building webpages and simple polling scripts that this step is the easy part.  Whatever I end up going with I’ll certainly document the results in the future.