A framework that enables you to use your android phone as a shield for hardware platforms such as Arduino, Raspberry Pi, Beaglebone Black and more.
The framework contains the android app, and hardware specific libraries. The communitcation happens over serial-bluetooth or serial-usb.
I started working on this framework because I was tired of not having the right sensors and actuators to prototype my project. Simple stuff like sending SMS or getting the geo-location required costly hardware add-ons. At the same time our mobiles are loaded with sensors and actuators - such as accelerometers, touch display, flash light, camera, proximity sensor, GPS, GSM capabilities (calling, text), 3G net connection, etc. just to name a few.
So I started asking myself what would be the easiest way to leverage the plethora of hardware utilities available on my mobile for my projects? What is the best way to seamlessly integrate them into my prototype? DroidShield was the result.
Of course, at the high level the goal is to solve the problem stated under the motivation section. How do you effectively enable the use of sensors and actuators on the mobile phone in your hardware projects/prototypes.
Being a bit more specific, the idea is to have an API for the hardware with which can get or push data to the mobile. The user should be able to connect via Bluetooth or usb-serial, and use the APIs.
For example
#include "droidShield.h"
// witch on flash light
droidShield.flashLight.write(1);
// end SMS
droidShield.sms.send("9012345678", "Hello! How are you?");
// read accelerometer 'x' axis
int x_val = droidShield.accel.read('x');
To make this happen, on the mobile side there is the droidShield mobile app. For the user it should be a simple 2 step procedure :
- Switch on the app - app connects to the arduino either via Bluetooth or USB.
- User uses the API in his/her program.
No more complexity on the user side should be needed - no android side coding, no looking up complex documentation, no buying and configuring hardware add-ons. Have an idea? Execute it!
The following image explains the high level working of the system.
- When the user uses the APIs, the droidShield code internally creates a bytecode representation of the command selected. Command being
accelerometer.read
orflashLight.write
. The parameters of the command are also encoded in the generated byte code. - This byte code is sent to the android device over the connection. This could be bluetooth, USB-serial or some other medium (though only BT is supported as of now). Irrespective of the transimssion medium, the interface remains the same to the user.
- Once the android app recieves the bytecode, it parses it and executes the command requested. This is returned to the user's hardware platform. After this the API call returns on the user's side.
A brief presentation of the project can be found here.
(Note : the project is a proof of concept. It is not yet ready for production/distribution)