Getting Started

How to connect my phone to Arduino in 10 steps

This quick start guide assumes that you have installed Amarino on your phone and you have added the MeetAndroid library to your Arduino working environment and your Bluetooth module is set to 57600 or 115200 baud (depends on your Arduino board, oder boards are more likely to work with 57600 baud whereas newer ones only will work correctly with 115200 baud)! Note that Arduino BT boards will work with 115200 baud. If not please go to Installation first. Look at the documentation of your Bluetooth module to figure out how to set the baud rate to 57600 or 115200.
Discover Arduino Bluetooth device
1. This is the first screen you will see when you start Amarino on your phone. Since Amarino is all about connecting your phone to an Arduino, the very first step you have to do is to search for your Arduino Bluetooth device you want to talk to (in geek lingo we say discover a BT device). To do that hit the "Add BT Device" button and wait until your Arduino Bluetooth module pops up. If it will not show up even if the discover process has already finished, you should check if your Arduino Bluetooth module is powered and discoverable.
tl_files/images/screenshots/searchDevices.png2. Maybe you will find more than one device, because of other Bluetooth devices around you. You need to find out which one is your Arduino Bluetooth module. You found it, then select it to add it to Amarino. (Each module has an unique address and normally also a human friendly name assigned, in our case here it is FireFly-1717).
tl_files/images/screenshots/1Device.pngIf you managed to add your BT device to Amarino you will see one new device, namely the device you added, with a connect button next to it at the main screen of your Amarino application. (I know its hard, but please don't push the connect button yet! ;-) )

Congratulations, the first important step is done. Hurray!

One thing you have to know before we proceed is, that Bluetooth devices need to become acquainted to each other (authenticated) before they can communicate. A process called "pairing" or "bonding", I am rather sure you heart of that.
Ok then, let's do the pairing thing.
3. Finally it is time to hit the connect button. Don't worry you will get a "Connection failed" message or a message telling you to pull down the status bar to enter the pin, but that is just fine. We tried to connect to an unpaired device, which is as I said not possible, and now you proved it!

But apart from that, it was necessary to get the pairing request notification in your notification bar (on the very top of your phone). Pull down the notification bar as shown in the screenshot and you will see the "Pairing request" notification.

tl_files/images/screenshots/pairing_request_enterpin_1234.png tl_files/images/screenshots/pairing_request_enterpin_1234.png 4. Tap on the "Pairing request" notification and the Bluetooth pairing dialog pops up. This is where you enter your Bluetooth module's super high confidential top secret PIN. Almost always it is "1234" or for ArduinoBT boards "12345". Some modules will have "0000" but less common. Type it in and hit "OK". If the PIN was right, pairing is done.

Wow this was tuff. But now you have successfully authentictated your device, which is required before we can connect to it.

Connect
tl_files/images/screenshots/pairing_request_enterpin_1234.png5. Ready to give it another try? Hit the connect button once again. This time it should connect successfully indicated by a green light on your Bluetooth module and a green light right above the connect button. If not, repeat the pairing process.
Perfect, this means basic connection works! Before you proceed, hit the "Disconnect" button to (guess what) disconnect.
Activate events
tl_files/images/screenshots/noEventsAdded.png tl_files/images/screenshots/addEvent.png tl_files/images/screenshots/testEvent.png
tl_files/images/screenshots/testEventAdded.png6. Tap on the left red cabinet icon to manage events which should be sent to your Arduino. Select "Add Event" and search for "Test Event" in the upcoming list. Select "Test Event". A description page will be opened telling you what Test Event is all about. For now simply say "Save". This will add the Test Event which sends random data to Arduino as soon as you establish a connection.

Gratulations! Your phone is now ready to talk to Arduino. However Arduino is not ready yet, so let's start setting it up.

Arduino setup
tl_files/images/screenshots/arduino_select_test_event.png7. Open your Arduino working environment and select "File->Examples->MeetAndroid->Test".

8. Change the baud rate of your Bluetooth module to either 57600 or 115200 baud. Newer Arduino boards will only work with 115200 baud, older ones only with 57600 baud. Note that Arduino BT boards work with 115200 baud and you are not supposed to change the baud rate for the Arduino BT. If you do not use an Arduino BT board with built-in Bluetooth than refer to your Bluetooth module documentation about how to change the baud rate of your external Bluetooth module. Make sure the baud rate of your Bluetooth module matches the baud rate in your Arduino sketch. All examples uses 57600 baud ( Serial.begin(57600) ), so if you use a BT module with 115200 baud you have to change the 57600 to 115200 in your Serial.begin statement.

9. Upload the sketch to your Arduino. If your Arduino has no onboard LED connected to pin 13 you might put your own LED to pin 13 of your Arduino. You should already know how this works. Otherwise you should look it up on the Arduino website.

Your phone is now set up, your Arduino is loaded with a test programm. So far so good. Now comes the great moment. Let's see if they understand each other.

Communicate
10. Power on your Arduino with your Bluetooth shield attached to it. Take your Android phone and go to the main screen. Hit the connect button next to your added BT device. It should start connecting. If your connection could be established the indicator changes to green.
Congratulations!!! Your Android phone speaks to your Arduino now.

If everything went right your led on pin 13 will blink every 5 seconds for 1 second.

Monitoring
tl_files/images/screenshots/monitoring.png To see what is going on in the background just hit the monitoring button and look at the communication process.
Real-time data
The event management module also gives you some feedback providing real-time data to you. Instead of monitoring go back to the event module (red cabinet icon) and see which random values are sent from the Test event. Real-time data are only visible if a connection is up and running. However you can force enable events to show their data without beeing connected (long press on an added event to get a context menu with options to force enable/disable).
Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions.