Introduction: Building an Android App to Communicate With the HC-06 Bluetooth Module
In this Instructable we will look at how to build a simple Android App that can connect and talk to an Arduino over a wireless Bluetooth connection. We will use the popular and low cost HC-06 Bluetooth module to create the Bluetooth signal from the Arduino. To create the Android App we will use the MIT App Inventor II, which is an easy to use graphical programming interface.
- Link to download the Android app to load into MIT App Inventor II:
https://dl.dropboxusercontent.com/u/26591541/Andro...
- Follow this link to my blog to access the Arduino code:
3 Comments
8 years ago on Introduction
Great tutorial! Many a time, an Error toast message pops up on the screen saying Error 507: Is device switched on? Do you happen to have a remedy for that?
Also, you have a typo in the app - Chose should be choose.
Thanks.
Reply 7 years ago
HC-06 datasheet
http://www.tec.reutlingen-university.de/uploads/media/DatenblattHC-05_BT-Modul.pdf
For HC-06 (slave device)
Pin11 = RESET (pull low to reset. Leave float for normal operation)
Pin24 = LED (output squarewave period of 102ms = unpaired, output high = paired)
HC-06 works fine with AppInventorBluetooth application. However there will be occassion where user encounters Error 507 whenever trying to connect.This error stays unless user power cycle/reset the HC-06 module. From my observation, this usually occurs
when improper bluetooth disconnect,connection lost or trying to connect more than once without disconnect. I have not found any software solution for this but there is however a hardware workaround to avoid/recover from the Error 507.
Typically HC-06 module comes with 4 pins. TX,RX,GND and VCC only. Will need to solder additional two wires on HC-06 which are Pin11 for Reset and Pin24 for LED.
Microcontroller(example: Arduino) which is connected to HC-06 needs to be programmed with additional task which is to detect the LED pin to determine paired or unpaired state.
If a paired state followed by unpaired state is detected, then only trigger the reset line (pull low for about 1s then leave it float)
That way everytime there is a bluetooth disconnect, the HC-06 module will reset. Therefore error 507 will be avoided.
Hope this helps.
Reply 8 years ago on Introduction
Hello, the error is basically saying that it can't find or make a good connection with the comm signal of the Bluetooth module. It could be that you are too far away or the antenna of the module is in a bad position. I found the HC-06 does not have a long range. From a software standpoint there is not much you can do because the MIT app inventor abstracts the low level controls so there is not a lot of adjustments that can be made. Sorry wish I had a better answer. If anybody else thinks I am missing something please share.