3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Use your android phone sensors on the arduino !

Use your android phone sensors on the arduino !
Hello, this is my very first step-by-step instructable, and today, we're going to learn how the sensors in your android smartphone can communicate with your arduino.
In modern smartphones, there are a lot of useful sensors for an ingenious arduino project. I have a motorola DEFY, for example and it has (at least) 6 sensors :
- light sensor
- proximity sensor
- aGPS (assisted gps)
- compass/magnetometer
- accelerometer
- orientation sensor
This instructable's purpose is to get you started using these sensors from your arduino. For this, we're going to use an application that was made for that single purpose : Amarino 2.0 . This app was first started by Bonifaz Kaufmann during his visit at the High-Low Tech Group in 2009 at the MIT Media Lab in Cambridge, USA and further developed at the University of Klagenfurt in Austria.

The overall cost of this project, considering you already have an arduino and an android smartphone, can be pretty low (it cost me about 12$).

If you liked this instructable, please rate it !


 
Remove these adsRemove these ads by Signing Up
 

Step 1Required Parts/Tools

Required Parts/Tools
«
  • HPIM6498.JPG
  • HPIM6503.JPG
  • HPIM6505.JPG
  • HPIM6506.JPG
  • HPIM6516.JPG
  • HPIM6511.JPG
Required tools :

- solder iron with fine tip
- tiny solder wire
- good magnifying glass
- "Third hand" helping tool
- good soldering skills

Required parts :

- Arduino
- Android smartphone
- Bluetooth serial adapter (not needed if you happen to have an arduino BT)
- 10 and 20 kOhm resistors 
- Breadboard
- Standard servo motor
- jumper wires and/or small wires


Since the ArduinoBT has Bluetooth functionality built-in, setup is much easier (no soldering, risks of messing up bt adapter, etc...) but since it costs pretty much, I went the cheap way, and bought a bluetooth to serial adapter from ebay.

Okay, so where do you buy those parts/components...

- Arduino : you can get this at sparkfun : (http://www.sparkfun.com/products/9950 ), from ebay or you can check the arduino website for other distributors (http://arduino.cc/en/Main/Buy )

- Android smartphone (I guess you already have that...)

- Bluetooth serial adapter : You can get this from sparkfun too, with a breakout board (http://www.sparkfun.com/products/10269 ). These don't need level shifting so if you buy this product, you don't need to buy the resistors. You can also get it from ebay, like I did, but they are more complex to set up and documentation isn't always accurate (mine was wrong on the default baud rate, for example) Here's the link to the one I bought : Bluetooth adapter.

- 10kOhm and 20kOhm resistors : these are needed to shift the 5v from the arduino serial pin to the 3.3v on the bluetooth adapter. You can get these at your local electronics shop.

- Breadboard : Not really necessary, but it is much easier (and cleaner) to wire the voltage divider on a breadboard, than to solder it and have wires everywhere. The breadboard isn't required if you choose to get the arduino BT or the bluetooth module from sparkfun. You can get a breadboard on ebay or again at sparkfun.com

- Jumper wires/small wires : you can get this from sparkfun too, but you can also salvage small wires from old electronics to keep the costs down.

- Servo motor : Not really required, but used in this instructable for an example with the accelerometer sensor. I'm using the futaba s3003. You can get this at your local hobby shop, ebay, or sparkfun  .

Now It's the time to choose :
- you can go the pretty expensive, but also pretty easy way (no soldering) : go get an Arduino BT . (more than 100$)
- you can go the less expensive way, but less easier (a little soldering but no level shifting) : get a bluesmirf silver breakout board from sparkfun (approx. 40$)
- you can go the cheapest and hardest way (soldering AND level shifting required) : get a bluetooth module from ebay (less than 10$). 

In this instructable,I'm going to get you started with the Bluetooth module from eBay.

So make your choice, get the parts/tools, and head to Step 2. 
« Previous StepDownload PDFView All StepsNext Step »
29 comments
May 28, 2012. 4:07 PMMr.What says:
Which of the white, orange, red, and yellow wires are for Tx, Rx, 3.3v, and GND respectively. Assuming that we are taking about the Tx, and RX for the BlueTooth module (not Tx, Rx for the other side)

I believe that this is the same BT module you can get for $6 ish at DealExtreme.com (dx.com ?). Look for datasheets on EGBT-046S and RF-0417C
Apr 21, 2012. 3:47 PMHSS1978 says:
Hello, i new in this things.

When i'm installing the amarino arduino library it gives a "Deprecated file" and asks if i want to download the latest version and i download it.

When i try to run the compass_led.pde it gives me a error:

------D:\Programas\arduino-1.0\libraries\MeetAndroid/MeetAndroid.h:104: error: conflicting return type specified for 'virtual void MeetAndroid::write(uint8_t)'
D:\Programas\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'--------


CAN ANYONE HELP ME, PLEASE !!!
May 10, 2012. 4:15 PMsyanikog says:
I am having the same problem as HSS 1978. I am trying to complete the tutorial with the RN-42 breakout bluetooth module from sparkfun with an arduino uno. I have no problem uploading the servo sketch without anything plugged into the arduino, but when i am configuring the sketch with just the GND pin (from module) disconnected i get the error.

processing.app.SerialException: Serial port 'COM5' already in use. Try quiting any programs that may be using it.
at processing.app.Serial.(Serial.java:144)
at processing.app.Serial.(Serial.java:76)
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:75)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:88)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:66)
at processing.app.Sketch.upload(Sketch.java:1664)
at processing.app.Sketch.exportApplet(Sketch.java:1624)
at processing.app.Sketch.exportApplet(Sketch.java:1578)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2314)
at java.lang.Thread.run(Thread.java:619)
processing.app.debug.RunnerException: Serial port 'COM5' already in use. Try quiting any programs that may be using it.
at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:99)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:88)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:66)
at processing.app.Sketch.upload(Sketch.java:1664)
at processing.app.Sketch.exportApplet(Sketch.java:1624)
at processing.app.Sketch.exportApplet(Sketch.java:1578)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2314)
at java.lang.Thread.run(Thread.java:619)


any ideas? could it be because i am using an uno instead of a duemilanov?
May 17, 2012. 8:22 AMsyanikog says:
I got it working, thanks for the help. It was a serial port problem, I was on the right port, but my bluesmirf module wasn't at the correct baud rate. I had to switch both to 115200 for it to work. Also I get the error:
' avrdude: stk500_getsync(): not in sync: resp=0x00'
if I try to upload with the Rx Tx pins connected to my UNO. I simply uploaded then connected the module and everything worked fine.
Thanks for the great tutorial!
Feb 29, 2012. 12:21 PMbwrussell says:
Glad I stumbled on this page before my BT module showed up for a different project, probably would have cooked it with 5 V. Thanks!
Feb 23, 2012. 8:58 PMmkhanbag says:
Hi,

Please help me with the bluetooth module, i want to change the baud rate and the pairing info, i used a usb to ttl adapter, connected TX, RX of USB to ttl to RX, TX of Bluetooth Module respectively and applied 3.7V to the Bluetooth module(made sure that its not in paired mode, Led flashing) - The problem i have is, as soon as i open session - hyper-terminal or putty or any com tool, the BT module is contentiously sending non stop 'Y' kind of characters
"ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ"

This is what i bought off ebay : "NEW Serial Bluetooth RF Transceiver Module RS232 Master + backplane 4 pin TTL"
Item No: 110805911219

I tried going through all the google searches but no vail, please help. Thanks in advance, Khan
Dec 20, 2011. 2:23 AMfjohn says:
ok im sorry i really didnt read the full thing but now its working thanks!!(im not a patient boy)by the way if ur not busy could u help me with my project ???(bluetooth
motion sensor car?)
Dec 21, 2011. 2:19 AMfjohn says:
thats the xact thing i was looking for thanks a lot by the way!
Dec 19, 2011. 5:59 AMfjohn says:
(removed by author or community request)
Dec 20, 2011. 2:04 AMfjohn says:
i thout the sketch book was in the arduino ide file --> sketch book!! but as i told u earlier that doesnt open....and wat do u mean wen u said it is located in my documents?? i searched there but nothing like sketch book!
Dec 15, 2011. 6:57 AMfjohn says:
hey thats a gr8 post !! im using a aubtm 20 bt module which is a 3.3V module !! so could i use the same level shifter principle u used? and i dont have a 20K resistor so can i use two 10K resistors together?(like one after the other??(serial))
Dec 16, 2011. 6:20 AMfjohn says:
what did u mean by android side??? did u mean that the app doesnt support accelerometer untill we program it'?? aka i have to make an (separate) app for the acceleromter? ? u said u have the arduino code pls send it to me!! thanks my email id: francisroan@gmail.com
send it via email pls!!
Dec 15, 2011. 7:01 AMfjohn says:
good work!!so i wanted to ask if u have the code to get the accelerometer reading?
Aug 12, 2011. 8:17 AMsshanbhogue says:
hi man!! loved your work on explaining the amarino.. shocked u doin such a good job at your age.. :-)
Thanks a lott!!
Jul 10, 2011. 11:14 AMb7035957 says:
Thank you nice tut. i just bought the cheapest module on dealextreme.com.
Jul 24, 2011. 2:30 AMnoik says:
me too, this instructable will help me very much, thanks! ;D
May 26, 2011. 7:46 AMJoxson says:
Hi! Thanks for the anwsers! But when I started to look at it and started to change the code and se whats doing what it wasnt that hard :) Right now the arduino is sitting an my rc car :) Really fun actully, little to senive, but thats step two, also make an failsafe^^ I found out that it reaches more than 25 meters :D
May 23, 2011. 3:31 PMJoxson says:
Also, can I skip the tx from the arduino to the rx on the bt module.
I just want to recieve data from the Bt module, I dont have to plug it in right??
May 23, 2011. 3:26 PMJoxson says:
Just LOVE this!
Today i recived my BT module, going to solder it later, but now in trying to think about the code.

My goal is to make a rc car that you controll by tilting:)
How do I change the code to get the arduino to react when I tilt the phone another way?
Witch variable should I change??

Joachim!
P.s. Sorry for bad english(I'm Swedish)

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
38
Followers
4
Author:a1r(A1Rstudios.com)
My name is Jonathan Rico, I'm 17, I'm french and I live in Morocco near Casablanca. I'm in Terminale S (French equivalent to 12th grade) at the CNED (homeschool, but controlled by the french governmen...
more »