Android talks to Arduino board
This project slightly modifies the Google Android sample app called “Bluetooth Chat” so you can type a message in the Android app and that same message will appear on an LCD attached to an Arduino Uno.
Functionality: Android talks to Arduino
1. Run the Android “Bluetooth Chat” sample app (after we modify the app in this instructable). Type a message in the app’s text box and press the “send” button. The message you typed echoes on the app display.
2. Message travels through the air from the built-in Android Bluetooth modem to the Bluetooth modem connected to the Arduino Uno.
3. Arduino Uno receives the typed message.
4. The Arduino Uno prints the typed message on the LCD.
Functionality: Arduino talks to Android
1. Every 30 seconds, the Arduino sends a message (“hello from Arduino”) to the Android phone via Bluetooth.
2. The Arduino message appears on the Android “Bluetooth Chat” sample app display.
Why? Just an easy way to test the Arduino’s ability to not only receive messages from, but send messages to the Android phone. You can take the example sketch and change it however you want.
Step 1: Hardware list
– Arduino Uno (328, 16MHz, 5V).
– Bluetooth Modem: BlueSMiRF Gold, aka FireFly (Sparkfun sku: WRL-00582).
– Parallel LCD (Sparkfun sku: LCD-09051 but you can use pretty much any parallel LCD).
– 10k Potentiometer.
– Wires to connect electronic components.
– Computer and FTDI chip (to change BAUD rate).
– Android Phone (I used a Motorola Droid – operating system v2.2.2 – but Google has sample code for all versions).
Assemble your circuit as shown in the diagram. You don’t have to assemble anything between circle #1 and circle #2: that is the message going through the air from Android to the Bluetooth modem. Hey, I’m an Arduino beginner so I’m not assuming anything. 🙂
Step 2: Software List
– Arduino Source code from this project (bluetooth_chat_LCD.pde attached below)
– NewSoftSerial library from Mikal Hart: http://arduiniana.org/libraries/newsoftserial/
– Android Development Kit (explicitly follow all of Google’s installation instructions)
– “Bluetooth Chat” Android sample code from Google: http://developer.android.com/resources/samples/BluetoothChat/index.html
– Hyperterminal or TeraTerm to change BAUD rate
Android Beginners (like me):
Make sure you do at least a couple tests before you execute the rest of this instructable:
– Create a “hello, world” app (lots of examples out there) to make sure you have Android/Eclipse setup correctly to run an app on a virtual device.
– Plug in your Android phone and ensure that you can copy the “hello, world” app to your phone. Make sure your phone has debugging turned on. Settings –> Applications –> Development –> USB debugging (turn it on)
After you successfully copy an Android app to your actual phone, you can proceed with this instructable. Keep in mind that you are not going to be able to run this instructable on a virtual device; you have to have a real phone to deploy the “Bluetooth Chat” code.
Step 3: Change BAUD rate on BlueSMiRF Gold
Change the BAUD rate from the default 115.2k to 57.6k. If you leave the BAUD at 115.2k, the parallel LCD will display gibberish when you send a message from Android to Arduino. If you set the BAUD below 57.6k, the Android phone will “cut up” the message that the Arduino sketch sends every 30 seconds. So 57.6k BAUD is just right.
For more detail: Android talks to Arduino board
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw
This Post / Project can also be found using search terms:
- using camera with arduino and android