Introduction: SensoDuino: Turn Your Android Phone Into a Wireless Sensors Hub for Arduino


UPDATES
  • Nov 23, 2013: SensoDuino 0.160 gets a face left.  
  • Nov 19. 2031: OPINION: The Amazing Synergy Between Arduino & Android.
  • Nov 19, 2013: SensoDuino 0.159 is out. Android phone date (y,m,d) and time (h,m,s) are supported as sensors. Support for Android KitKat (4.4/API 19). 

INTRODUCTION

Think of SensoDuino as having over a dozen virtual shields for your Arduino each providing a function or feature such as GSM, GPS, Gyro, etc but without having to stack or wire these components. SensoDuino is a free Android application that captures data from sensors built into your Android mobile device then transmits the data over the HC-05 Bluetooth module to Arduino Uno or any device with serial Bluetooth capabilities such as a Windows PC, Mac, or Bluetooth equipped microcontroller. SensoDuino also saves the captured data to a comma-delimited text file.  This app has been tested and designed for the HC-05 Serial Bluetooth module. Other Bluetooth modules may or may not work. Please refer to comments by users who tried other Bluetooth modules with this app. 

You can install SensoDuino from Google Play only. 

https://play.google.com/store/apps/details?id=com.techbitar.android.sensoduino

You can control the frequency of sensor data reading, transmitting, and logging (subject to the specifications of the sensor vendor.)  This is my second Android app for Arduino Uno. You might also be interested in my first app Andruino  which is a simple 2-way Bluetooth-based Android controller for Arduino Uno.

SensoDuino eliminates the need for USB Host hardware for your phone or Arduino Uno. For Arduino Uno or microcontroller, you only need a $10 HC-05 Bluetooth module (or equivalent).  

Save over $200 in sensors and parts for your Arduino Uno or microcontroller project, if you already have a mid-range Android device such as my Samsung Galaxy II Plus. See section titled: Android: A Capable Electronics DIY Platform.

SUPPORTED SENSORS

SensoDuino recognizes the following Android sensors: GPS, Orientation, Gravity, Rotation Vector, Gyroscope, Accelerometer, Linear Accelerometer,  Magnetometer, Light Level, Audio Level, Proximity, Pressure, Temperature, and Relative Humidity.

Some software (virtual) sensors relay on the presence of hardware sensors to function. For example, the gravity sensor, linear acceleration sensor, and rotation vector sensor all of these software sensors relay on the presence of hardware gyro sensor on your Android device to function.  
 
SensoDuino also features an Android sensor scanner that will list hardware and software sensors supported by your Android device as well as key sensor specifications such as max power consumption, resolution, vendor, etc.  Some Android devices have duplicate sensors from different vendors. The Android SDK will return the default sensor.

FEATURES OVERVIEW
  • Reads Android sensors. 
  • Saves sensor readings to comma-delimited text file. 
  • Transmits readings in ASCII comma-delimited format via Bluetooth. 
  • Lists your Android device's built-in sensors both hardware and software (virtual sensors). 
  • Set speed of sensor data capturing, logging, and transmission from 100 milliseconds to 10 minutes (subject to sensor limits). 
  • Keeps track of accuracy for logged sensor readings and provide visual clues for inaccurate sensor data. 
  • Geo-tags sensor readings using your Android device GPS.
  • Optimized for speed of operation and transmission. 
  • Keeps device awake to prevent loss of sensor data logging. 
  • Scan and list available sensors in your device and their specifications.
WHAT CAN YOU DO WITH SENSODUINO

With the help of Arduino or other microcontrollers, SensoDuino can be used in robotics and UAV guidance. Its support for 12 motion and environment sensors covers a wide range of sensory feedback. Also, SensoDuino can be used for logging. The ability to set the speed of logging from 10Hz to once every 10 minutes allows for high-speed as well as time-lapse logging of sensor readings.

PROJECTS BASED ON SENSODUINO

Bluetooth-controlled Pan/Tilt Servo Platform Using Android (SensoDuino) & Arduino
http://www.techbitar.com/bluetooth-controlled-pan-tilt-servo.html

IR Remote Control Station for SensoDuino
http://www.techbitar.com/universal-ir-remote-control-station-for-android.html

THANKS

Special thanks to colleagues from PIN13 Protospace who helped with testing, usability, guide review and proofreading. Mainly, I wish to thank Jafar Quttaineh for his detailed product testing and for his invaluable insights and feature suggestions. Also thanks to Mujahed Al-Tahle for his detailed analysis and testing of the product and guide.

PLEASE RATE ON GOOGLE PLAY

This is a free app and only through your ratings can I determine if it's worth supporting or discontinuing.


Step 1: How to Use SensoDuino

SensoDuino is very simple to use. Basically you have rows of sensor names (number of sensors may change in the future). Each sensor has three checkboxes next to it labeled On, Tx, and Log:
  • ON: The first checkbox  turns the sensor On or Off which means SensoDuino is either reading this sensor or not.
  • TX: The second checkbox when enabled, SensoDuino will transmit the associated sensor readings via Bluetooth to any paired and connected Bluetooth serial device.
  • LOG: When the third checkbox is checked, the associated sensor readings are logged to a comma-delimited text file named "sensoduino.txt" in the root of your Android's SD card.
SENSOR READING FREQUENCY

You can control the speed of sensor reading from the Preferences menu. You have a choice between 100 millisecond (10 Hz) to 10 minutes. The speed of the sensor is subject to the limits of the vendor specifications. Most GPS sensors today generate location data once per second (1 Hz). Some GPS modules generate location data 10 times per second (10 Hz). On the other side of the speed spectrum, some sensors generate readings over microseconds.

SENSOR SENSITIVITY

Motion sensors (gyro, accelerometer, magnetometer) are sensitive to environmental conditions such as presence of magnetic field or slight physical vibrations. So even when your phone is placed on a flat stationary surface, you will still see changes in sensor reading affecting mostly the least significant digits. The least significant digits of motion sensor readings may produce more data than you need for your application. Your application requirements should determine how many digits will be truncated or kept.

POWER DRAIN

SensoDuino is a power-hungry app. Between active sensors, Bluetooth transmission, logging to device storage, and keeping your device awake so as not to interrupt sensor readings, you are bound to drain your battery. 

For prolonged use of SensoDuino, an additional power source should be considered either in the form of power brick, solar/wind energy, or power outlet if one is available.

There are many tips on the web on how to conserve your mobile device's battery power that could extend your SensoDuino logging time significantly.

For example, enabling Airplane Mode on you device can save battery power. Different vendors use different names for Airplane Mode such as In-Flight Mode.

Step 2: Wiring the Arduino to the HC-05 Bluetooth

To take advantage of SensoDuino out of the box, you don't need anything. You can start logging sensor readings to a text file then process the logged data with myriad graphing and data analysis tools. But if you see the added value in wirelessly transmitting sensor readings over Bluetooth to a microcontroller or PC, you should get the HC-05 Bluetooth serial module.

The HC-05 package comes in two flavors, SMD and breakout board versions. Both can be purchased for less than $10 from ebay. I strongly recommend buying the HC-05 with the breakout board to avoid unnecessary soldering and debugging headaches and to take advantage of useful features included with the breakout board such a status LED that blinks in patterns to show if the HC-05 is paired, connected, in command mode, or not even powered.

CONVERTING 5V TO 3.3V

The breakout board has a 3.3V regulator which can convert Arduino's incoming 5V power but you still have to drop the Arduino's 5V pins down to 3.3V. The simplest way is a voltage divider from two resistors but you can use a level shifter such as the CD4050 level shifter IC.

I use 2K & 1K resistors as voltage divider to drop the Arduino's 5V TX pin to 3.3V, which is the operating voltage of the HC-05 pins. This is to protect the HC-05 3.3V RX pin.  On the other hand, the Arduino 5V RX pin can handle the 3.3V sent from the HC-05 TX pin. Even if the HC-05 works without the voltage divider, there's no telling for how long.

UPLOADING ARDUINO SKETCHES 

TO UPLOAD A SKETCH TO ARDUINO YOU MAY HAVE TO REMOVE THE POWER FROM THE HC-05 MODULE TO AVOID ANY CONFLICT OVER SERIAL. Alternatively, you can wire the HC-05's TX/RX to different Arduino pins supported by Arduino's SoftwareSerial library. 

Step 3: Transmitting From SensoDuino to Arduino

NOTE: I have published a project that demonstrates how to make use of this Arduino sketch to process sensor data transmitted by SensoDuino. The project employs the Accelerometer sensor on the Android device to control the angles of a pan/tilt servo platform. 

SensoDuino can transmit sensor readings to an Arduino via the HC-05 Bluetooth module. Other comparable Bluetooth modules may work as-is or require changes to their default settings.

The attached Arduino sketch "sensoduino.ino" reads data transmitted by SensoDuino over Bluetooth then parses and converts this data from strings to numeric values ready for utilization in your Arduino application be it robotics control or UAV navigation or sensor logging.

The process of connecting SensoDuino to Arduino is simple.As with all Bluetooth communication  you must pair your Android device with the HC-05 Bluetooth module attached to your Arduino. You only need to do the pairing once.

Please refer to previous step regarding how to resolve errors when uploading a sketch while your Arduino pins 0  and 1 are connected to the HC-05 Bluetooth module.  


Step 4: Pairing and Establishing a Serial Connection Between Windows 7 and SensoDuino

Pairing Bluetooth devices is a very basic task. On Windows 7 (or similar OS) opening serial over Bluetooth involves one additional step and that is assigning a virtual COM port to the Bluetooth connection between Windows and SensoDuino. More often than not, this is done behind the scenes and the user does not have to worry about it. But if you like to debug your Bluetooth connection to SensoDuino, you may need some basic details of what takes place when connecting serial over Bluetooth.

To simplify debugging the HC-05 Bluetooth connection, make sure SensoDuino is running with only one sensor enabled and transmitting (check Tx checkbox for that sensor) at slow speed preferably once per second. 

For testing the Bluetooth connection between SensoDuino and Windows PC, I use Tera Term. You don't have to but it's a robust terminal emulation software that helps me test serial connections either Bluetooth or wired. You can download the latest Tera Term from here: http://ttssh2.sourceforge.jp/index.html.en 

If you see garbage on the screen after you established a connection, match the baud rate for both Bluetooth devices.

The data you will see on the terminal emulator console may not be neat looking but it's properly formatted for the attached C++ , C# and the Arduino skeletal programs to consume.
  • Let's start by establish a pairing between the Bluetooth on your Android device and your computer's Bluetooth. Once you do this step successfully, we can move to the next stage.
  • Check to make sure Bluetooth is set to Discoverable on your Android device.
  • Check to make sure Bluetooth is enabled on your Android device.
  • Run SensoDuino.
  • To test the setup, enable the Orientation sensor and enable its Tx (transmit) checkbox and bring down the transmission rate to 1 per second, from the preferences menu.

Step 5: Capturing SensoDuino Data on Windows PC Using C++ and C# Over Bluetooth

I have attached two skeletal programs written in C++ "main.cpp" and C# "Program.cs" to serially send and receive data to and from Arduino and SensoDuino either over wired serial or Bluetooth serial.

These two programs were extracted and modified from sample code published by the Microsoft Developer Network. The programs are simple, robust, and can handle reasonably high data transmission speeds.

For one test, I enabled all SensoDuino sensors at the highest speed and could not detect significant loss in data transmission. I used a Samsung Galaxy S2 Plus and re-configured my HC-05 Bluetooth baud rate to 115200. Results may vary depending on your Android phone and Bluetooth module.

To modify your HC-05's default baud rate and other settings, refer to the section titled Boost Your Bluetooth Transmission Speed.

I have tested both utilities on my Windows 7 workstation using the free Microsoft Developer Express 2012 which you can download for fee from Microsoft. You can easily modify this code to add functionality such as graphing, logging to hard disk, and sharing sensor data with other applications and users. 

ESTABLISH THE CONNECTION

I have included an instructional video to explain the steps below. Make sure you have paired your Windows PC Bluetooth with your Android Bluetooth first. Let's install and run the C++ sample program:
  1. Download the attached "main.cpp" and save it to your computer.
  2. Download and run Visual Studio Express 2012.
  3. Select New Project.
  4. From Templates,  Select Visual C++  CLR Empty Project (call it SensoDuino).
  5. From Solution Explorer, right-click on project name, not solution name.
  6. Select Add Existing Item then pick the file main.cpp from Step 1.
  7. Run SensoDuino and make sure you select only one sensor to transmit at 1 reading second. You can increase speed and add sensors later.
  8. Run the C++ program.
  9. A console for the C++ program will open up and it will prompt you to enter the COM port you wish to communicate with.
  10. Enter the COM port assigned to your Bluetooth SensoDuino.
  11. You should see a stream of numeric data showing up on your C++ application console each made up of comma-delimited numbers representing sensor information such as type, count, and raw sensor readings, reading accuracy.
If the connection does not work the first time, stop the C++ application. Exit SensoDuino. Launch SensoDuino again then run the C++ program. Sometimes when SensoDuino sends too much serial data to the serial buffer, the C++ program chokes on it. So make sure you sync running SensoDuino and the C++ program.  If you see garbage on the C++ console, adjust the baud rate.

Additional programming will be needed for the C++ and C# programs to parse the incoming SensoDuino strings into floats and integers per your requirements.


Step 6: Log SensoDuino Data to File Then Import Into Excel

SensoDuino logs data to a comma-delimited text file with a format that's consistent across all sensor data which means ease of importation into application such as Excel or other analytical and charting tools.

The logged sensor readings follows this format:
SENSOR TYPE (string)
SERIAL COUNT (integer)
FIRST VALUE OR X (float)
SECOND VALUE OR Y (float)
THIRD VALUE OR Z (float)
ACCURACY (Integer)

Step 7: About Android Sensors

In the list of official Android sensors below I have retained the sensor name and number as listed by the Android SDK SensorManager. For Audio (mic) and GPS, which are not part of the Android SDK SensorManager family, I have assigned my own numbering and naming scheme starting from 99 downwards.

OFFICIAL ANDROID SENSORS

1- ACCELEROMETER (m/s^2 - X,Y,Z)
2- MAGNETIC_FIELD (uT - X,Y,Z)
3- ORIENTATION (yaw, pitch, roll)
4- GYROSCOPE (rad/s - X,Y,Z)
5- LIGHT (SI lux)
6- PRESSURE (hPa millibar)
7- DEVICE TEMPERATURE (C)
8- PROXIMITY (Centimeters or 1,0)
9- GRAVITY (m/s^2 - X,Y,Z)
10- LINEAR_ACCELERATION (m/s^2 - X,Y,Z)
11- ROTATION_VECTOR ( X,Y,Z)
12- RELATIVE_HUMIDITY (%)
13- AMBIENT_TEMPERATURE (c)
14- MAGNETIC_FIELD_UNCALIBRATED (uT - X,Y,Z)
15- GAME_ROTATION_VECTOR ( X,Y,Z)
16- GYROSCOPE_UNCALIBRATED (rad/s - X,Y,Z)
17- SIGNIFICANT_MOTION (1,0)

UNOFFICIAL ANDROID SENSORS

97- AUDIO (Volume in generic units)
98- GPS1 (Lat., Long., Alt.)
99- GPS2 (Bearing, Speed, Date/Time)

ANDROID SENSORS CATEGORIES

The Android platform supports three broad categories of sensors:

Motion sensors

These sensors measure acceleration forces and rotational forces along three axes. This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector sensors.

Environmental sensors

These sensors measure various environmental parameters, such as ambient air temperature and pressure, illumination, and humidity. This category includes barometers, photometers, and thermometers.

Position sensors

These sensors measure the physical position of a device. This category includes orientation sensors and magnetometers.

For a detailed reference to Android sensors start here:
http://developer.android.com/guide/topics/sensors/sensors_overview.html 

Step 8: Boost Your HC-05 Bluetooth Transmission Speed

SensoDuino reads and transmits data for 12 sensors at speeds ranging from 1 Hz to 10Hz (sensor reading speed will increase in future releases.) Most of the supported sensors send X,Y,Z data in floats converted to characters for serial communications. That's lots of data being processed, saved, and transmitted.

I doubt many application will require all SensoDuino sensors transmitting full throttle concurrently but it may be advantageous to configure the HC-05 Bluetooth module (or your Bluetooth module) for the highest practical baud rate.

You have to experiment until you decide which speed is acceptable to you. I have published a guide on how to change the settings of the HC-05 in preparation for SensoDuino increased bandwidth requirements.  Follow any of the two links below for detailed how-to instructions to change the HC-05 configuration.

Modify The HC-05 Bluetooth Module Defaults Using AT Commands:

https://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A
http://www.techbitar.com/modify-the-hc-05-bluetooth-module-defaults-using-at-commands.html

Step 9: Feedback & Bug Reorts

There are two ways to contact me regarding bugs and feature requests via SensoDuino.

CRASH REPORT

SensoDuino is equipped with a Crash Reporter from ACRA. When the app crashes it will open up a dialog box and prompt you for permission to send me the crash report next time you connect to the internet and run SensoDuino.

The ACRA crash reporter will send me technical info about your device such as Android version, app version, phone model, technical specs, stack info, etc to help me identify the source of the crash so I can fix the bug. You can also enter a comment to send to me from the crash report dialog box.

FEEDBACK FORM

From the action menu of SensoDuino, select Preferences. At the bottom of the list of sensors, there's a Feedback form that you can use to send me your comments and suggestions. You need to be connected to the internet.

Step 10: Android: a Capable Electronics DIY Platform

If you buy all the sensors supported by SensoDuino separately to go with your Arduino project from some of the well-known stores, you could pay over $200. If you have an Android phone why not use its built-in sensors. And since Android is the most popular phone in the world today, it's a ready and capable DIY platform. 

Even the newer SoC ARM boards being introduced today by top DIY vendors can't match the overall price, performance, and built-in features and integration of a mid-range Android phone.

Here's a breakdown of the costs when you buy sensors and parts supported by SensoDuino and included with many Android phones:

ITEM / COST
-----------------------
Gyro $30
Accelerometer $15
GPS $45
Magnetometer $20
Bluetooth $20
Barometer $20 
Temperature $5
Light Sensor $5
Audio Sensor $5
Display & Touch Input $20
Battery/charger $20
SD card $10
Open Source Dev Tools $0    
-----------------------
TOTAL:   $215
TAX:  Varies
SHIPPING: Varies.
CUSTOMS TARRIF: Varies

Step 11: Resources

Comments

author
skbpillai (author)2016-09-29

hi.

I tried installing SensoDuino from Google Play Store on my mobile. Unfortunately, it says that my device is not compatible. I use Samsung Galaxy Note Edge (SM-N915G). The phone runs Android 6.0.1

I have emailed Hazim Bitar a couple of days ago, and am awaiting response.

Does anyone in this forum face this issue, especially with newer smartphones / Android OS versions?

author
ZoubirS (author)2016-08-19

Very smart and useful app!
Thank you.

author
AndreyY9 (author)2016-04-08

Thx for nice app, a little script to export SensoDuino log to RabbitMQ - https://github.com/fxpester/androidSensors_to_rabb...

author
PatriciaH65 (author)2016-03-20

Thanks alot for nice sharing! I have got much clear idea regarding from this useful information.

author
PawanvirS (author)2016-03-15

hi there

i just wanted to know as like sensor data can we also send our android UUID to oure serial port bluetooth.

author
GeorgN2 (author)2016-02-22

hey friend,

is it possible that the APP tranamits the data while the camera APP is open?

Best regards

Georg

author
sakthikd3 (author)2016-02-05

shall we use two sensor at a time .. if it possible give the code

author
HEMANTV2 (author)2016-02-04

Can this app work for raspberrry pi 2

author
raj0987 (author)2016-01-30

can we use sensoduino in avr microcontroller. Please reply as soon as possible. thanks in advance.

author
raj0987 (author)raj09872016-01-31

please reply me as soon as possible

author
flefevre made it! (author)2015-11-12

Hello

I made it even if I have made several mistakes. Here some advices:

First mistake, I have bought a hc06 in place of the good one the hc05 !

Secundly I upload the sketch during the connection to the bluetooth connection: please remove your bluettoth before transfering

Thridly I have forgot to modify the sensoduino to get output on 9600 baud and not 115200 !

Bravo to the TechBitar !

First mistake bought a HC-06 in place of a HC5

hc05.PNG
author
pontifex100 (author)2015-06-20

E at pontifexpetrovich@gmail.com

author
pontifex100 (author)2015-06-20

E at pontifexpetrovich@gmail.com

author
pontifex100 (author)2015-06-20

Hi techbitar, pls help me regarding my thesis. I need to create an app that utilizaes the ambient temperature sensor of the phone then transmits the data received to an arduino. Also the app needs a control interface like a remote control for an inverter type aircon.

author
vaniapramos (author)2015-02-05

Hi! Did you ever try SensoDuino with HC-06 Bluetooth module?

author
flefevre (author)vaniapramos2015-05-25

Hello I have tried without any success. See my post.

author
flefevre (author)2015-05-25

At first, prima for the done jobs: itt is totally unbeliveable

I was previously a biocomputer scientist. I am trying to learn arduino and embedded system.

I have tried your app sensoduino. I have an arduino uno and a bluetooth module (jy-mcu, v1.06). I have paired it with a sony ericons smartphone.

The red light in the bluetooth board is now continuoulsy red. The Tx led of the arduino is flashing/blinking.

But baddly in the serial terminal, it never go down to the condition if(getChar != START_CMD_CHAR) return;

so it newer print anything about the sensor, that are On with Tx activated...

any idea why?

Thanks

Francois, from France

author
flefevre (author)flefevre2015-05-25

I have forgotten to precise that the module bluetooth seems to be named HC-06

author
hala.alkhalil.33 (author)2015-02-07

Could this application show readings from a sensor connected to the Arduino?

Thanks in advance.

author
mike_vasili (author)2014-02-11

hello... i have a an arduino mega 2560 a bluetooth module HC-05 and a galaxy s4. the problem is that, to watch the data received from the phone to the serial monitor of arduino i have to constantly press the reset button of the arduino. please help me...

author
esluisfe (author)mike_vasili2014-11-08

Hey friend did you solved how to do that?... I'm in the same problem

author
AndreP1 (author)2014-09-12

how can i use it with a raspberry?

author
DH6 (author)2014-08-05

Does this app still transmit data when running in the background (ie. hit the home button after syncing)?

author
alda1 (author)2014-05-29

Thank you Hazim for the app, and excellent and clear ideas. I have just ported SensoDuino into BB10 and planning interesting projects.

author
takkan (author)2014-03-20

hello!

I am planning on working on a project using SensoDuino and an old android phone, just wanted to know what is the oldest platform of android that this app is compatible with?

author
schel (author)2014-03-18

Great Job! I've got my senso' ! whens GPS n some of the other N/A's available?

author
yonache (author)2014-02-24

I have a problem

I am unable to establish communication between the HC-05 to the arduino

The HC-05 transmit data but the arduino didt get that

/*

PROJECT: SensoDuino 0.17

PROGRAMMER: Hazim Bitar (techbitar at gmail dot com)

DATE: Sep 30, 2013

FILE: sensoduino.ino

LICENSE: Public domain

*/

// Replace sensor numbers with Names

#include <SoftwareSerial.h>

#define START_CMD_CHAR '>'

#define END_CMD_CHAR '\n'

#define DIV_CMD_CHAR ','

#define DEBUG 1 // Set to 0 if you don't want serial output of sensor data

SoftwareSerial mySerial(3, 2);

String inText;

float value0, value1, value2;

void setup() {

Serial.begin(115200);

mySerial.begin(115200);

Serial.println("\nSensoDuino 0.13 by TechBitar.com (2013).\n");

Serial.println("Android Sensor Type No: ");

Serial.println("1- ACCELEROMETER (m/s^2 - X,Y,Z)");

Serial.println("2- MAGNETIC_FIELD (uT - X,Y,Z)");

Serial.println("3- ORIENTATION (Yaw, Pitch, Roll)");

Serial.println("4- GYROSCOPE (rad/sec - X,Y,Z)");

Serial.println("5- LIGHT (SI lux)");

Serial.println("6- PRESSURE (hPa millibar)");

Serial.println("7- DEVICE TEMPERATURE (C)");

Serial.println("8- PROXIMITY (Centimeters or 1,0)");

Serial.println("9- GRAVITY (m/s^2 - X,Y,Z)");

Serial.println("10- LINEAR_ACCELERATION (m/s^2 - X,Y,Z)");

Serial.println("11- ROTATION_VECTOR (Degrees - X,Y,Z)" );

Serial.println("12- RELATIVE_HUMIDITY (%)");

Serial.println("13- AMBIENT_TEMPERATURE (C)");

Serial.println("14- MAGNETIC_FIELD_UNCALIBRATED (uT - X,Y,Z)");

Serial.println("15- GAME_ROTATION_VECTOR (Degrees - X,Y,Z)");

Serial.println("16- GYROSCOPE_UNCALIBRATED (rad/sec - X,Y,Z)");

Serial.println("17- SIGNIFICANT_MOTION (1,0)");

Serial.println("97 - AUDIO (Vol.)");

Serial.println("98 - GPS1 (Lat., Long., Alt.)");

Serial.println("99 - GPS2 (Bearing, Speed, Date/Time)");

Serial.println("\n\nNOTE: IGNORE VALUES OF 99.99\n\n");

Serial.flush();

}

void loop()

{

Serial.flush();

int inCommand = 0;

int sensorType = 0;

unsigned long logCount = 0L;

char getChar = ' '; //read serial

// wait for incoming data

if (Serial.available() < 1) return; // if serial empty, return to loop().

// parse incoming command start flag

getChar = Serial.read();

if (getChar != START_CMD_CHAR) return; // if no command start flag, return to loop().

// parse incoming pin# and value

sensorType = Serial.parseInt(); // read sensor typr

logCount = Serial.parseInt(); // read total logged sensor readings

value0 = Serial.parseFloat(); // 1st sensor value

value1 = Serial.parseFloat(); // 2rd sensor value if exists

value2 = Serial.parseFloat(); // 3rd sensor value if exists

if (DEBUG) {

Serial.print("Sensor type: ");

Serial.println(sensorType);

Serial.print("Sensor log#: ");

Serial.println(logCount);

Serial.print("Val[0]: ");

Serial.println(value0);

Serial.print("Val[1]: ");

Serial.println(value1);

Serial.print("Val[2]: ");

Serial.println(value2);

Serial.println("-----------------------");

delay(10);

}

}

author
vickyhiggs (author)2014-02-21

Hi sir i'm doing my project based on sensoduino using my android accelerometer sensor for driving toy helicopter(like your pan/tilt servo).Can you please help me with coding???

author
grnbrgd4 (author)2013-12-21

this is going to work perfectly for my S4 Active on my UAV project with my two pals

author
cgrrty (author)2013-11-29

Can i send the Android Phone's data to the pc?if can do it,what is sofrware i would used in the pc?

author
techbitar (author)cgrrty2013-11-30

it depends on what you plan to do with the data on the PC. If you just want to display it, a terminal emulator like Tera Term running on your PC will do. if you want to parse the info and process it you use the sample code I provide with the SensoDuino project info. but you can log, plot, parse, etc the sensoduino data on the PC.

author
cgrrty (author)techbitar2013-12-02

where i can download the last version apk?

author
kindflower (author)2013-11-16

that's great

if i want to use arduino mega 2560.what are the changes to be made?

author
techbitar (author)kindflower2013-11-17

I don't have an arduino mega 2560 to test with but give it a shot and see if it works as is. judging from the 2560 's spec sheet I don't expect any major tweaking but I have been proven wrong before.

author
kindflower (author)techbitar2013-11-23

thanks

author
Raitis (author)2013-10-15

Right what I needed!
Can I put the phone down at a random position and set values to zero for that position?

author
techbitar (author)Raitis2013-10-16

One way to achieve something similar is to have your receiver application be it on PC or Arduino read and save sensor readings from your SensoDuino as initial sensor values. Then deduct these saved initial values from new sensor readings. For example if you start your app and it get from SensoDuino a GPS Yaw of 60, then every new Yaw value will get 60 deducted from it to give you the delta of the two values. So if next SensoDuino GPS reading gives a Yaw of 90 then the difference is 30. This is one way to "zero" your SensoDuino readings.

author
Raitis (author)techbitar2013-10-20

Well, that I've thought of myself, but still thanks! :)
The use I have for this is such that I need to log it to phone first and later just do some work with the data on PC alone. It wont be a big deal to just take starting positions and deduct those from every other position in Excel (I hope).
I've written a review on GPlay as well now with another issue - the app stops logging data when you turn the screen off. Given that my logging times are mostly 2 hours + I might have some issues regarding battery life and some accidental hitting on screen as well, can you do something about it?
Other than that the app does the trick for me even despite I log my postitions using accelerometer because gyro is not present on my phone. Exporting the log to Excel is quite easy too.
Thanks! :)

author
techbitar (author)Raitis2013-10-21

Hi Raitis, I replied to your comment on Gplay. Thanks for the rating :)

I will look into ways to extend the battery life in future versions. I have not tried it yet but maybe enabling Airplane mode if your mobile supports it can save additional power, if you don't need to be connected to the mobile network while logging. Thanks for the suggestions and rating.

author
Raitis (author)techbitar2013-10-21

You're worth the rating!
I kinda thought about using the airplane mode, since was not sure if let's say an incoming call would not stop the logging process as well.
Thanks for the effort!

author
techbitar (author)Raitis2013-10-23

FYI, I added the Accelerometer sensor to the latest version of SensoDuino. Before, I had the Linear Accelerometer only.

author
ArduMower (author)2013-10-23

Great job. We send the data to the mobile phone ;) http://www.youtube.com/watch?v=tOm5aNRvX0Q

author
techbitar (author)ArduMower2013-10-23

Nice! Thanks for sharing.

author
Temporalis (author)2013-10-17

This program is fantastic! Is there a way to send the accumulated data to an email address on a set schedule using the phone's wireless access? If so perhaps it might be a future feature. I think that would make this the perfect piece of software for me.

author
techbitar (author)Temporalis2013-10-18

Thanks for the good suggestion. I will add it to the feature request list.

author
NTT (author)2013-10-15

This is exactly what I was looking for! Thank you ever so much :-D

author
techbitar (author)NTT2013-10-16

You're welcome. Glad to hear it.

author
braserito66 (author)2013-10-15

This is a very interesting way to use old smart phones to share sensors and comms

author
techbitar (author)braserito662013-10-16

an Android phone, when paired with let's say an Arduino Uno, is a very cost effective DIY platform when compared to other bare-bone palm-sized ARM SoC solutions such as raspi after you add basic sensors and comparable features to the latter.

author
zx lee (author)2013-10-16

Hi, first i would like to say i really like how you connect between arduino and android.

My question is how to get started in programming android? what are the programming language used?

About This Instructable

130,017views

603favorites

Bio: Did I unplug the solder iron?
More by techbitar:IR Remote Control Station for Android - TURN THE TV DOWNSensoDuino: Turn Your Android Phone into a Wireless Sensors Hub for ArduinoModify The HC-05 Bluetooth Module Defaults Using AT Commands
Add instructable to: