Sunday, August 18, 2013

Ideas for the Raspberry Pi



A collection of brainstorming ideas that the Raspberry Pi: (in no particular order)

Hardware
  • Turn on / off lights
    • Lights on when you enter and off when you leave room 
  • Sprinkler control
  • Motion detectors
  • Weather monitoring station
  • Security system
  • Garage door open / close
    • Proximity opening
    • Driveway monitoring
  • Day time / night time lighting
  • Sensors Sensors Sensors
    • Temperature, humidity, acceleration
    • Magnetic reed sensors (good for garage doors and windows)
    • Mercury tilt switch
    • Dry contact switch
    • Pressure switch
  • Control relays - for pretty much anything
  • Detect mini fridge being opened (or left opened)
  • Heated toilet seat
  • Monitor summer home / construction

Software
  • Media Center
  • Web server
  • Automated notifications and event reminders (maybe based off of sensors)
  • Broadcasted messages
    • OSD pop up messages on desktops

More
  • Deep freeze UPS monitor
  • Internet sprinkler controller
  • Security system monitor
  • Proximity garage door opener
  • Cubicle entry early warning system
  • Better power options
  • battery powered
  • solar powered
  • directly wiring (bypassing usb)
  • Wifi remote controlled car
  • RC controlled car
  • Laser tag RC cars
  • Christmas lights
  • Security camera system
  • Environmental daily snapshots
  • Spy camera
  • Kitchen recipe station
  • Media center
  • Robot wars
  • GPS tracker for car
  • Car media center





A Better Way To Power The Pi

Generally one powers the Raspberry Pi using a recommended setup of a standard USB Cable (type A to Micro-B), used by many cell phones, connected to a 5V USB wall adapter that is capable of supplying at least a recommended 1000 mA of power, which is then connected to the Micro USB Power port on the Pi.  This works great.  But, are there other ways, that might better fit your particular setup?

USB Cable - Type A to Micro-B
USB Cable - Type A to Micro-B
5V USB Wall Adapter
5V at 1000 mA (or more) USB Wall Adapter

Words of Caution

First, a couple words of caution:

Warning: There is both a Mini and a Micro USB type, and Micro is the one you want. (which is unfortunate because I have a bucket full of Mini USB cables)

Warning: It is not recommended to try and power the Raspberry Pi from a computer's USB port.  The USB spec says that a USB port should supply up to 500 mA of power, which is below the 700 mA requirement for the Raspberry Pi (Type B), and well below the recommended 1 A.  Although, you might be able to get away with it, if you use a Raspberry Pi (Type A) with nothing connected.

USB Powered Hub

As USB devices are connected to the Pi, such as a mouse, keyboard and Wi-Fi adapter (the big consumer), the Pi is eventually no longer able to supply sufficient power and will begin to behave erratically (reboots, power on failure, CPU hangs, CPU stalls).  At this point it is recommended to move the USB devices to a USB Powered Hub.

If you were like me, this initially involved two power adapters connected to the wall, and a mess of wires running to the Pi.  I then found a recommendation that said, if the USB Powered Hub is capable of supplying the appropriate power to each port, you could actually connect the Raspberry Pi to the USB Powered Hub and have only one power adapter connected to the wall.  I immediately tried this, and it worked great!

"It is possible to power the Rpi from a powered USB hub the Rpi controls, but only on 'dumb' devices, that allow the port to supply the full current without waiting for the usb device to ask for it. As the power input of the Rpi doesn't have its data leads connected, there is no chance for a communication loop of some sorts." [source]

GPIO Header

The next trick is you can power the Raspberry Pi directly through the GPIO header.  If you have a project that is not using wall power (like a mobile robot), and is using some type of alternative power supply (like a car battery with regulator), this can be a handy way of powering the Raspberry Pi.  Just make sure you regulate the power to exactly 5V (+/- .25V), and that the power supply can supply the required current.

"As the 5V rail is brought out in the GPIO pins, you can power the Rpi from there too. You should mind however, that those are behind the power protection circuitry, so you should provide your own." [source] 

Checking 5V Power

So how does one tell if you have an adequate power supply?

The Raspberry Pi conveniently includes 2 test points (labeled TP1 and TP2) that you can quickly check the voltage with a voltmeter / multimeter.  Set your multimeter to DC V and touch the red probe to TP1 and the black probe to TP2.  You should see a voltage between 4.75 V and 5.25 V.  If you see negative values just swap your probes around.  Anything outside of this range is bad.  Anything close to the edges of this range may cause problems.

Voltage Test Points
Voltage Test Points

When I test my two Raspberry Pis, I see 4.86 V on one and 4.89 V on the other (both being powered by USB Powered Hubs).

"You should see a voltage between 4.75 and 5.25 volts. Anything outside this range indicates that you have a problem with your power supply or your power cable, or the input polyfuse F3. Anything inside, but close to the limits, of this range may indicate a problem." [source]






Thursday, August 15, 2013

Connecting to the Pi

After unwrapping the Raspberry Pi (Model B - Rev 2), I realize that I missing a few things. Important things.

Things such as...
  •  SD Card (4 GB+ / Class 4+)
  •  USB Micro Cable
  •  USB Wall Adapter (1A+)
SD Card (4 GB+ / Class 4+)
SD Card (4 GB+ / Class 4+)
USB Wall Adapter (1A+)
USB Wall Adapter (1A+)



USB Micro Cable
USB Micro Cable










A bit of research showed that getting a USB Wall Adapter that is able to produce 1000 mA (1 Ampere), or more, is critical as the Raspberry Pi will consume about 750 mA.  Also important is an SD card with a minimum 4 GB of storage and minimum class 4 speed (4 within a circle).

A quick run to the local store, to pick up these commonly found items (check photo / cell phone departments), and I am ready to load my Pi.

Following the helpful Raspberry Pi Quick Start Guide, I download the "SD Formatting Tool" and then divert from the guide slightly by downloading a copy of the RAW Raspbian "wheezy" image, instead of the recommended NOOBS image, and the Win32DiskImager.  Using the Win32DiskImager, I write the "wheezy" image to the SD card, using a SD card reader that I keep with my camera.  Almost ready to boot my Pi for the first time.


Not wanting to hunt down a HDMI cable, I take faith that the Pi will just boot.  I intend to just watch the DHCP records of my router to determine the IP address of the Pi.

I connect the SD card to the SD slot, connect an available Ethernet cable to the Ethernet port, and attach the USB Micro Cable to the USB Wall Adapter.  Now I am truly ready to boot my Pi for the first time.

There is no "power button" on the Pi, so I simply connect the USB cable to the Pi, and then to the wall, and then watch the mini fireworks display on the tiny LEDs.  Things seem to be moving, and a few minutes later I am happily notified that the expected DHCP request hit my router.  I've got you now!

Putty is by far my most favorite SSH client, so of course I open Putty.  According to the Raspbian notes, the default user name is "pi" and the default password is "raspberry".  Obvious, no?  A few seconds later I am pleasantly presented with shell access to the Raspberry Pi.  Achivement Unlocked!




All Things Raspberry Pi


A coworker introduced me to the wonders of the Raspberry Pi, so I thought I would take a crack at it and see what I could do with it.

First, you may ask what a Raspberry Pi is: "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video." (faqs)  It can also be used for hardware hacking and home automation.

As I pondered the many options, I came up with 6 projects I would like to try and tackle (in no particular order).

Project #1 - Deep Freeze UPS Monitor
    The deep freezer tends to loose power (tripping the GFCI), and we don't know why.  Would like to monitor it with the Pi and send off a text/email notification on a power outage.

Project #2 - Internet Sprinkler Controller
    We tend to set our sprinkler system at the beginning of the season and forget about it.  Time to actually monitor usage, control through the internet, and maybe even disable after a rainstorm.

Project #3 - Wifi Remote Controlled Car
    Back in college we built, as a team, a rather large, but simple, roaming robot controlled by a micro-controller and wifi.  Let's see if I can reproduce that on a miniature scale.

Project #4 - Security System Monitor
    When we moved into our home, we found a disconnected, but still active security system.  As we walk by the sensors they still trigger, but there is no controller on the back end.  Let's see what the Pi can do for us.

Project #5 - Proximity Garage Door Opener
    As I am driving home from work, I would like the Pi to pick up my cell location, and when I am within a few hundred feet of home, have it automatically open the garage for me.

Project #6 - Cubicle Entry Early Warning System
    When I get focused on a project, it is very unnerving to have someone walk up behind you, stand there watching you, and then get your attention.  This early warning system would pop up a message on my screen, notifying me I should watch for company.

This, of course, will require learning how to connect various components, program the Pi, and use the GPIO pins.

Let the Pi adventure begin...