Use Your Android Phone Sensors On The Arduino
Use Your Android Phone Sensors On The Arduino
Table of Contents
Step 8: End . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Author:a1r A1Rstudios.com
My name is Jonathan Rico, I'm 16, I'm french and I live in France near Carcassonne. I'm in Premiere S (French equivalent to 11th grade) at the Lyce Jules
Fil (http://lyceejulesfil.com/). And, the most important, love robotics and electronics ! I'm currently learning how to use ROS (Robot Operating System) to
make a semi-autonomous robot for a robotics competition (Eurobot Junior) in which I participate each year. I'm currently building a website with a friend,
colin, to share our work (It will be operational in one or two months).
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$).
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.
- 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 )
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
- 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 .
In this instructable,I'm going to get you started with the Bluetooth module from eBay.
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
2. 10 kOhm 1/4 watt resistor
Image Notes
1. Standard servo (Futaba 3003)
Let the Bluetooth module cool down a bit, and head over to the third step : The level shifter
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes
1. TX pin
2. RX pin
3. 3.3v pin
4. GND
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Step 3: The level shifter
Note : If you bought a bluetooth module from sparkfun , skip this step, and head to step four.
Since the Arduino's serial output (Tx pin) is 5-volt logic, if we connect it directly to the Rx pin of the Bluetooth module - which is using 3.3-volt logic - it will fry the
Bluetooth chip. Fortunately, the Arduino supports 3.3-volt logic in reception (Rx pin), so no complex circuit is needed. All we have to build is a simple voltage divider :
Image Notes
1. The other end of this wire is soldered to Bluetooth module's RX pin
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Step 5: Software setup
Now that we've done the physical setup, it's time to work on the software side.
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes Image Notes
1. Open this 1. Install this first, but dont start the app yet.
2. Then install this. You can now open the Amarino 2.0 application
3. The next instructable : python and sl4a
4. Scripting layer for android -- next instructable
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes Image Notes
1. Open the settings. 1. Open this
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes Image Notes
1. Activate bluetooth 1. The pin code is : 1234
2. Then scan for devices
3. Then click here
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes Image Notes
1. When it says "paired", you can quit the settings 1. Open this
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes Image Notes
1. Click here 1. Select your freshly paired device
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes
1. Click here
Now if you want a more advanced example, using the accelerometer and the servo, head to the final step !
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes Image Notes
1. Click here 1. Second example
2. First example
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes Image Notes
1. Click here 1. Connected !
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes
1. And select this
2. If it doesn't work, long press on that
- Open "File->Sketchbook->Amarino_servo"
- Upload to the board (remember to disconnect the GND pin while uploading)
- Open the amarino2.0 app
- Remove the compass event
- Add an Accelerometer event
- Connect to the bluetooth module
- Let the magic begin !
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes Image Notes
1. Second example 1. click here
2. First example
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Image Notes
1. Connected !
Step 8: End
So thanks for following this instructable ! If you have questions/comments, please leave a comment ! I would also really like to thank the guys that made the Amarino
application, which is very useful. Visit amarino-toolkit.net !
The next instructable is going to be about installing and using sl4a and python on android, with again, examples with the Arduino.
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/
Related Instructables
http://www.instructables.com/id/Use-your-android-phone-sensors-on-the-arduino-/