Right around the time of Google I/O, SparkFun announced the IOIO board, a bridge-board for Android phones to talk to other electronics like sensors, etc. The IOIO uses the adb service port to send data back and forth between the board and any Android phone running Android 1.5 or later.
I am Steve Okay and I believe this could be a pretty big deal for some mobile sensor applications in the ICT4D space, especially when companies like Huawei are selling fully-featured devices like the $100 Android IDEOS phone in Kenya.
A simple temperature sensor
In this post, I’ll be talking about how I got an IDEOS phone talking to a TMP36 thermal sensor using the IOIO board to create a simple temperature sensor that can transmit readings via the multiple mobile phone communication technologies.
Being a good geek, I have a ton of spare wires and cables and stuff to harvest the cable harness for the sensor:
TEH ]<0dez
The IOIO is designed to be sort of an Arduino-for-Android and it pretty much programs like one. It has its own SDK/Libraries that you load into your favorite Android-supporting IDE. There’s support for Digital & Analog I/O as well as UART, SPI, I2C and PWM.
Programming the board is pretty straightforward. Here’s a snippet of how to read from the temperature sensor:
protected void loop() throws ConnectionLostException {
InputStream debugIn = debug.getInputStream();
OutputStream debugOut = debug.getOutputStream();
try {
v = temp_input.getVoltage();
} catch (InterruptedException e) {
temp_input.close();
// TODO Auto-generated catch block
e.printStackTrace();
}
proc_temp = ((v*1024) - 500)/10;
String proc_string = new String(Float.toString(proc_temp));
roundtemp = Math.round(proc_temp);
String digits_str = new String(Integer.toString(roundtemp));
String v_string = new String(Float.toString(v));
try {
debugOut.write(new String("v=:"+v_string+"\r\n").getBytes());
debugOut.write(new String("proc_string="+proc_string+"\r\n").getBytes());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tempValueTV = (TextView) findViewById(R.id.tempValTxt);
tempValueTV.setText(digits_str);
}
This, wrapped inside a AbstractIOIOActivity.IOIOThread
, is pretty much the IOIOLib version of the Arduino startup()/loop() paradigm. Keep in mind though that this is also an Android application so it should be possible to have multiple threads going on in the background doing other tasks, have services running, etc. If you had other phones connected via Bluetooth to the one connected to the IOIO board, you might be able to broadcast sensor readings across a group of phones or have multiple phone/board systems share readings.
It’s getting a little hot in here…
For now, the project looks like this:
Steve Okay is an Inveneo Geek at Large and published this post previously as A simple temperature sensor with IOIO Board.
why not develop a Python API to the Android Bluetooth and that way you can “talk” to the Arduino Bluetooth sheild…