Android + IOIO + Temperature + Light

  

Sensing temperature and light with Android and IOIO.  This article will demonstrate a basic thermometer / ambient light level detection input accessory.

For additional background information on interfacing Android with IOIO, check out my other introductory tutorials:

Android + IOIO + Simple Digital Output
Android + IOIO + Simple Digital Input
Android + IOIO + Simple Analog Output
Android + IOIO + Simple Analog Input

Background on Android development, IOIO, and electronics:

Meet IOIO
IOIO for Android Beginners Guide
IOIO Wiki
Android Developer’s Guide

 

Hardware

Parts needed:

  • Android Device (1.6+, 2.1 for Bluetooth)
  • IOIO (available at Sparkfun)
  • Photocell
  • 10k ohm resistors
  • TMP36 temperature sensor
  • Breadboard
  • Power supply
  • Hook-up wire

 

Assembly

Connect the ground and power leads of the TMP36 to GND and +3.3V respectively, and connect the center signal lead of the TMP36 to the desired input pin (34 below).  Then connect one lead of the photocell to +3.3V and the other to the desired analog input pin (pin 35 below). Also connect the same lead through a 10K resistor to ground creating a voltage divider.   Other IOIO pins can be used, as long as they support analog input (pins 31 – 46 on the IOIO). Here is a diagram of the completed circuit (created with Fritzing):

 

Software

Get the source

With the circuit assembled, the next step is to get the demo application on the Android device. You can either download the pre-built .apk or checkout the source from Github:

git clone git://github.com/mitchtech/android_ioio_temp_light.git

If you are building from source, you will also need to import the IOIO Library project, and optionally the IOIO Bluetooth library projects, both available here:

git clone git://github.com/ytai/ioio.git

 

Install, connect, profit!

Finally, upload the app to the Android device (or browse to this page on the device and download the apk above). Connect the device to the IOIO, and start up the app.

 

5 Comments

  1. I have a IOIO mint and I did everything you did except I only used a temperature sensor. My problem is, the temperature sensor is reading at 458 degreeF. How can I get my sensor calibrated to an accurate reading?

  2. IMPORTANT: the graphic above has the power +3V going to the wrong lead on the Temp probe. You need to swap the ground and +3V on the Temp Probe in your pic.

  3. Mustafa

    Agreed with James, I burnt a TMP36 because of misconnection so:

    ATTENTION: SWAP 3.3V WITH GROUND

  4. Why do you multiply the lightreading value per 100 ?

  5. What type of photo-resistor are you using ?

Leave a Reply