Lately I’ve been getting a fair number of emails and comments from people having various problems connecting the Android application to the Arduino Digital Readout controller. Almost all of them fell into one of three following “buckets”:
- The controller does not appear in the “Select a Device” dialog
- The application is unable to connect to the controller
- The application appears to connect but connection is lost almost immediately
The good news is that those problems are usually easy to resolve, so in this post I will try to address the most common scenarios. The solutions are designed for Arduino UNO board connected via a Linvor HC-0x transceiver (AKA Bluetooth-to-serial adapter) but should work for other combinations as well.
The Controller Doesn’t Appear in the “Select a Device” Dialog
The Bluetooth device doesn’t show up in the “Connect” dialog or the dialog is empty.
The controller is not paired with the phone/tablet.
Pair the Bluetooth module to your android Device.
- Turn the controller on and make sure that the LED on Linvor module is blinking
- Make sure the transceiver is turned on (on Linvor the red LED should be blinking)
- Go to Settings -> Bluetooth and click “Scan”
- Once your transceiver appears in the “Available Devices” list, click on it
- Enter the pairing code. (For Linvor it is either 0000 or 1234.)
If the modem isn’t found there might be a problem with the hardware (i.e. the Linvor module is either defective or is configured for “Master” mode).
Unable to Connect
The device appears in the “Select a Device” list but when you try to connect to it the connection fails.
The most common reason for this problem to occur is a loss in pairing between the phone/tablet and the transceiver.For example the user might pair the module to another phone or a PC, etc. Even though the transceiver still appears in the list of paired devices, it will refuse connections from the current phone or tablet.
First of all, make sure that the Bluetooth module is powered on (the LED should be flashing). If that is the case and you still can’t connect, try unpairing it and pairing again following the steps in the previous section.
After connecting the DRO to the Arduino board the application briefly displays “Connected” status and within a few seconds switches to “Connection Lost”.
When a connection is established the application starts waiting for the input from the controller. If it doesn’t get at least one valid input per second, the application assumes the connection to the controller is lost. After 5 seconds it will drop the Bluetooth connection altogether and go into “Disconnected” state.
- The Arduino is plugged into a computer via USB cable
- The connection between Arduino and the serial-to-Bluetooth adapter is lost
- There is a Baud rate mismatch between the Arduino and the transceiver
- Microcontroller has halted and is not sending any output to the serial adapter
- Transceiver is not configured properly
Determining the cause of this problem will require a bit of troubleshooting. Before digging deeper, though, please power-cycle the microcontroller and the Bluetooth transceiver, and completely shutdown and restart the application (by using “Force Stop” or sweeping it away from the list of running applications if your device allows it).
|Output similar to this indicates|
that the controller
can successfully send the data
I. Ensure that the controller is sending correct output to the serial port.
- Disconnect the Bluetooth module from the Arduino
- Connect the Arduino to a computer via a USB cable
- Open Arduino IDE
- In the … select the correct port
- Open the “Serial Monitor”
If you see rapidly scrolling “x0;y0;z0;” etc., the Arduino is working.
If there is no output at all, try selecting a different ports (if there are any in the dropdown). If that doesn’t help there is a problem with the controller or the firmware, so please try the following:
- Download a “clean” sketch from the Downloads section
- Make sure the correct boards is selected in the … dropdown
- Re-upload the it to the board
- If the sketch uploads successfully, open the Serial Monitor and check for the output
If there is still no output your microcontroller might be defective or damaged. If you’re using Arduino UNO, a replacement chip can be purchased from Sparkfun or off eBay. Otherwise the whole board might need to be replaced.
II. Ensure that the serial-to-Bluetooth adapter is working correctly
Please note. this step requires a computer with a Bluetooth adapter. If your machine doesn’t have one you can either get a USB Bluetooth dongle or skip to the next section.
- Unplug the Arduino from the computer
- Reconnect the Bluetooth transceiver to the Arduino
- Power the board back upSince the USB connection uses the same UART port in can interfere with the communications. It’s best to not plug the board into a computer and use a USB phone charger, wall wart or a battery instead.
- Pair the device to the computer
- In the “Serial Port” sub-menu select the appropriate port
- Open the Serial Monitor and check the output
- Tip: when a serial connection to Linvor BT adapter is open the LED stops blinking and lights up red.
If there is no output or the output contains strange characters, the Baud rate between the Arduino and the BT adapter doesn’t match. The sketch provided on the Downloads page assumes that Linvor’s rate is set to factory default 9600 Baud. There is a chance that your transceiver has been reprogrammed to another rate. In that case you will either reset it back to factory defaults or try changing the Arduino code to match the Linvor.
III. Ensure that the Phone/Tablet can receive the data
|If the device doesn't appear in he dialog,|
click "Scan for device"
The final step is to make sure that the tablet can receive the data from the tablet. The easiest way to do so it to install one of the free Bluetooth terminal applications.
- Pair the transceiver to the phone/tablet as described in the first section of this post
- Go to Google Play Store and search for “Blue Term” and install it
- Open BlueTerm
- In the menu press “Connect Device”
- Select “Linvor” (or whatever your device name is) from the dialog
- After a brief delay the application should connect and start showing output similar to the screenshot below.
|If everything is working as expected|
BlueTerm will show similar output
At this point, if the tablet/phone doesn’t receive the output from the controller there might be a drive issue or the Bluetooth chip in the tablet. If possible, try a different phone or tablet. If you are using a “hacked” tablet or phone using a custom ROM, such as Cyanogenmod etc. try installing a different build. Otherwise you will need to contact the manufacturers technical support or seek help on the support forums, etc.
Although it’s highly unlikely, but if the above steps all check out but the DRO application still keeps loosing the connection please feel free to leave a comment or send me an email.