Sensor Graph

By September 12, 2013Uncategorized

Sensor Graph is an Android app that uses the Amarino Toolkit Plugin to read real time data from Arduino.

I thought I would post a little tutorial on this, since it took me quite a while to get this running. The Amarino Toolkit consist of an Android application, a Arduino Library, and a Android plugin, that allows android applications to communicate with Arduino. While it is relatively simple to get the examples working, you will require some knowledge of android phones, android os, soldering, Eclipse IDE or equivalent for modifying and packaging an android app, Arduino, Java programming language.

Tools I am using are,

Mac osx Snow Leopard 10.6.4
Arduino Duemilanova ATmega 328
Arduino app for Mac
Samsung Galaxy S: Android OS 2.1 Eclair
Eclipse Galileo
Androidsdk
Amarino Toolkit
Zterm * mac osx program to change your bluetooth shield’s baud rate.
Bluetooth Modem – BlueSMiRF Gold * attach to your Arduino board if you do not have a Arduino BT board.
Bread board and wires
Potentiometer,  Temperature Sensor, any variable resistor will do.

1. To Start, head over to the Amarino website , download the android app and the android plugin bundle app and install it to your phone.
You can do this two ways, either use a barcode scanner app to scan the QR code on the website, which will open a browser and download the app.
The other way is to download the application using the link on the website, and use Terminal to install it to your phone (android sdk is required).

2. Download the MeetAndroid Library and place it in(your_arduino_sketches_dir/libraries/MeetAndroid).
To do this on a mac, go to Applications Folder > Right click on the Arduino.app > Show Package Contents and place the MeetAndroid Library inside (Resources>Java>Libraries).
If the Arduino program is open, restart it, if everything went well, the MeetAndroid library can be found under “Sketch->Import Library…”

3. Setting up your blue smirf gold adapter.

Solder wires to your blue smirf gold, you only need connections to RX, TX ,GRND and VCC ports.
*important* The TX wire from blue smirf gold connects to RX on the arduino board, the RX wire from the bluesmirf gold connects to TX on the arduino board.
DO NOT connect these wires before uploading your sketch to the arduino board, you will receive an error.

4. ** Optional , I had issues pairing my blue smirf gold to arduino and needed to change the baud rate.
The instructions to do that is here.

5. Once you have your bluesmirf soldered and wired to your arduino board try to connect the amarino app to it.
You do this by, opening the Amarino app on your android phone
Select add BT device
The device name should be FIRE-FLY(some numbers)
The password should be “1234” without quotes.
The bluesmirf gold should stop blinking red and go to a steady green
The app should also show a green indicator next to device showing that it is connected.
Good, now you know the phone can speak to arduino.

6. Installing the Sensor Graph App
Download the Sensor Graph example from Amarino website .
Place the folder anywhere you want.
Go to Eclipse and right click your project panel, and select new android project.
‘*important* you need to already have Eclipse and Androidsdk plugin installed”
Select create from existing source.
Use the browse button to find your Sensor Graph folder that you just downloaded.
Select android 2.1 as the targeted device from the list.
Click Finish.

*If you have a yellow exclamation warnings next to your sensor graph project file in eclipse it should still run fine.
*If you have a red “X” you might need to make you have your “AmarinoLibrary.jar” file is included.
*”The AmarinoLibrary.jar is on the Amarino toolkit website and you should have already downloaded it and placed it somewhere for example your androidsdk folder.”
*To include the file right click on your SensorGraph folder and click build path > configure build path > libraries > add external jar > and browse for the file. > ok
*you should not see any errors.
**super important* Open the SensorGraph.java file in Eclipse and place your bluesmirf device number inside this line of code ( private static final String DEVICE_ADDRESS = “YOUR BLUE TOOTH DEVICE NUMBER”;)

– The Amarino Android app will have the device number on the list of pair devices.
Next, your phone should already be connected via usb to your computer, In your phone settings, developer debug mode, and install from unknown sources checked.
Open the SensorGraph arduino file from Eclipse, this launches the arduino application
check which pin to attach your variable resistor to, also modify your baudrate if neccessary.
– make sure when you are uploading your tx and rx wires are not attached-

Upload your sketch to your arduino board, and then attach the rx and tx wires.
Next, right click on your SensorGraph folder and > Run as Android Application
When the dialog box of the AVD manager launches select your phone as the targeted device. It will be the one that does not say emulator and probably have some device number to it.
Launch
This will install the SensorGraph app to your phone and run it.

If everything goes well the app will show you a graph of your variable resistors input.
In my case I used a potentiometer, so as I turned it, the graph changed.

Pics ­čÖé

any questions drop a comment below


Also check out my graduate thesis project, for which I am using the Amarino Toolkit and a Android Tablet to control some car functions. VDI Project

Leave a Reply


+ 7 = eleven