/phew

Dead simple IoT RGB LED, powered by Firebase

Primary LanguageObjective-CApache License 2.0Apache-2.0

Phew RGB Lightbulb, powered by Firebase

Phew, as in, "Phew, I'm glad that's done" is an easy (yes, easy, we promise) sample that demonstrates connecting an IoT device to an iOS app through Firebase. You'll need a Firebase application, so if you don't have a Firebase account, sign up for free right now!

This project was initially built for a tech talk entitled "Simplifying IoT with Firebase" at NSLondon on 22 October. Slides for this talk are available here.

Hardware Needed

Phew was mostly built from parts lying around in my electronics box, but all the parts are inexpensive and redily available from your favorite online (electronics) retailer:

  1. 1x Beaglebone (or RasPi, or similar)
  2. 1x BlinkM I2C LED (datasheet)
  3. 2x 4.7kOhm resistors
  4. 4x long wires
  5. 1x breadboard
  6. 1x ping pong ball (to be used as a bulb diffuser)

Once you've got everything, wire it up like so: Fritzing wiring diagram for Phew Bulb

Instructions:

  1. Connect Ground (BB Pin 1) to Ground (BlinkM Pin 1)
  2. Connect Power (BB Pin 3) to Power (BlinkM Pin 2)
  3. Connect SCL (BB Pin 19) to C (BlinkM Pin 4)
  4. Connect SDA (BB Pin 20) to D (BlinkM Pin 3)
  5. Add 4.7k resistors as pull-ups (so wire them to Power) on SCL and SDA (see why)
  6. Cut a hole in the ping pong ball (careful!) and insert it over the LED

Bulb Software Installation

Once you've got your circuit set up, you should SSH into your Beaglebone (or RasPi, etc.). Make sure it's got an internet connection, as well as has git set up. Do the following:

git clone git@github.com:mcdonamp/phew.git
cd phew/Bulb
npm install

Assuming everything went perfectly, you should now have everything ready to go for running your server by typing node server.js.

In the event that things errored out, you're likely having issues with your I2C (I know I did).

If you're on a Beaglebone, do the following to enable the second I2C port:

echo BB-I2C1 > /sys/devices/bone_capemgr.9/slots

Then follow the Beaglebone setup instructions on the I2C node package then try again.

App Software Installation

All of the code for the Phew App lives in PhewApp. Once you're there, run the following:

pod install
open PhewApp.xcworkspace

Then build and run on the simulator or your favorite iOS device :)

You can also play with the App online via Appetize.io.

Questions, comments, contributions?

Contact me @asciimike or mcdonald at firebase dot com to learn more about Firebase, IoT, iOS development, or with any burning questions you may have!