Android Garden Monitor

Overview

One of the coolest things announced at this year’s Google I/O was the Android Open Accessory Kit, which allows Android devices to interact with accessories over USB. As an attendee, I received the Arduino-based ADK DemoKit board, which I’ve used to build an app to monitor my Aerogarden.

Hardware

Arduino and Breadboard

The garden monitor project was built with the following components:

  • Arduino-based Open Accessory Kit
  • Breadboard
  • LM34DZ temperature sensor
  • HS1101 humidity sensor
  • 0.5″ force sensing resistor
  • Analog servo

The force sensing resistor is mounted below the Aerogarden’s water tank to measure the weight of the water, and the servo is used to open and close the tank door.

Software

Nexus One running the Garden Monitor app

Arduino

The Arduino firmware reads the values from the temperature, humidity, and force sensors and sends them to the attached Android device over USB using the Open Accessory protocol. It also accepts commands over USB from the Android app to open and close the door.

Android

The Android app reads the sensor data from the Arduino and broadcasts them over the wifi network using xPL so they can be monitored by MisterHouse, which can alert me via email and text-to-speech when the water level is low. When the water level is below 20%, the app signals the Arduino to open the door as a visual indicator that the tank needs to be refilled. After the tank is filled, the app automatically closes the door again. The app also snaps a photo every hour, which I’ve used to create the time lapse video below.

Source

The source code for the Arduino sketch and the Android app are available on github.

Time Lapse

This video was created by combining the hourly snapshots taken by the Nexus One using ffmpeg and then edited in iMovie ’09.

Writing an Android Sync Provider: Part 2

One of the great new user-facing features of Android 2.0 is the is the new Facebook app, which brings your Facebook contacts and statuses into your Android contacts database:

So, how exactly does my Nexus One know that Chris is excited about the upcoming launch of his new mobile apps? The answer is a Contacts sync provider in the Facebook app. Read on to learn how to create your own!

Writing an Android Sync Provider: Part 1

One of the highlights of the Android 2.0 SDK is that you can write custom sync providers to integrate with the system contacts, calendars, etc. The only problem is that there’s very little documentation on how it all fits together. And worse, if you mess up in certain places, the Android system will crash and reboot! Always up for a challenge, I’ve navigated through the sparse documentation, vague mailing list posts, and the Android source code itself to build a sync provider for our Last.fm app. Want to know how to build your own? Read on!