Hi peeps,

Thought i ought to share what I'm working on, in brief it's an IMU using an android smart phone's sensors.  Here goes...

 

 

Practically all Anrdoid phones have a 3DOF accelerometer and a 3DOF magnetometer, so i've decided to take up the task of using them for robotics/UAV's/fun (!?), the reason being i'm a student ie. a little scarce on funds for goodies like 9DOF boards!

 

My goal is to use these sensors as an IMU AHRS or similar, but unfortunatley (I have read) Android is not a real-time OS so isn't suitable for running AHRS code.  So instead  I'm trying to get the sensor data to be spewed out of the phone into an arduino, and for this there's so far 2 solutions i've seen.

  1. Amarino, a fairly complete interface between Android an Arduino using bluetooth
  2. Android SerialPort API, to allow use of the serial ports hidden in all phones

I'm going for number 2, and have already started making an app to push sensor data down the serial port,  trouble is i'm an android/java MegaNoob so it's proving hard!

 

If anyone could help I'd be real grateful!

 

I'll post my progress here, please leave comments and suggestions as I need all the help I can get!! wish me luck!

 

note - I know the sensors are a little crappy compared to, say, the Oilpan - in fact my phone is an LG GW620 which has a Bosch BMA150 accel (i2c, 10 bit-ADC),  and a [chinese] ak8973 mag. (i2c, 8-bit ADC).  The idea here is cheap and cheerful not a billion Hz driftless.

Also I'm aware I need a gyro - all in due time amigo, all in due time

Views: 1092

Tags: Android, IMU, beer-money-budget, port, sensors, serial

Comment by Hamish on February 19, 2011 at 10:02am

Already making progress!!

I've used my elite reverse engineering (copy-pasting) skills to combine an example serial app with an accelerometer example, and my phone is now happily spitting out its euler angles!! ( azimuth, pitch, roll ).  It's currently working at the modest rate of 10Hz, so I think i'll go get it a coffee.

 

I'll write up how its done (and if it's any use) once I speed it up a bit!

 

Comment by bcr on February 19, 2011 at 1:38pm

The gyros are really key. If you have a good gyro, you can do DCM with a low-quality accel. The converse is not true.

Comment by Hamish on February 19, 2011 at 2:25pm
unfortunatley true . . . I'm still going to try anyway, just to see the results.
Comment by Kim Skatun on February 22, 2011 at 11:42am

sometime ago cris posted sth about an android phone which have a gyro inbuilt, the lds chip or so..

 

Comment by Hamish on March 8, 2011 at 8:53am
To anyone following, I'm not dead and nor is my project.  I'm just a little busy, but things are coming on nicely for an android segway robot thing !
Comment by Inopia on April 3, 2011 at 11:20pm
Remember that you'll need gyroscopes, so get a Nexus S. Afaicr they contain invensense parts so the sensor fusion should be handled by the Android stack (possibly inside the sensor chip). Sensor fusion was added to Android in Gingerbread, so I'd say it's fair to assume we'll be seeing more devices with gyros in the near future.

As for the Android<->MCU bridge, have a look at my project:

code.google.com/p/microbridge
Comment by Hamish on April 4, 2011 at 5:53am

epicsauce! 

I was actually looking at using Oleg's USB host shield to access the USB virtual serial ports, but that would still need a modded kernel.  So using ADB like you are is definitely the best way forward.

 

I'm aware of the need for gyros but can't get a new phone right now.  When i'm not so fecking busy i'll try microbridge out and tell you how it goes!

Comment by Navigator on January 27, 2012 at 5:02am

Hi Hamesh,

I am also working on smartphone orientation using Gyro and Accelerometer and Magnetometer sensors, I am trying to use DCM Algo, How is going on on ur side , any Progress, I am sure u need Gyro for correct orientation.

Regards

Navigator

Comment by Hamish on January 27, 2012 at 1:21pm

OhSoot I made progress ages ago but forgot to post!

Here's a site with most of what I managed

I got serial working and made a program that uses the android orientation functions + a PID to feed a serial output, which an arduino could interpret and then power a motor appropriately.

Trouble is, only-accelermoneter has too poor a reaction time.  But the principle was there and working, even though the robot needed a little helping hand. With a gyro it would have definitley worked.

I don't know if a DCM algo is necessary, android sorts out most of the filtering and orientation itself so I would first find out if it does the sensor fusion too. Then it's one step less for you!

Best of luck dude, I hope you manage what I failed to finish.

Comment by Imtiyaz on July 12, 2012 at 12:26pm

This is interesting project.. I am willing to contribute if there is group working on it. I just posted a question at http://www.diydrones.com/forum/topics/use-smart-phone-sensors-to-bu...

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service