Wireless Bluetooth control and programming for your next Arduino project

July 13, 2018 Jeremy Cook, Engineering Consultant

When working with Arduino and other similar development boards, the standard procedure is to send your program to your MCU via its USB connector. This normally works well, and even allows you to monitor what your MCU is doing via the serial interface built into the Arduino IDE.

This is all well and good, but what if you want to accomplish serial control and feedback wirelessly, or even program it without a physical connection? The good news is that inexpensive Bluetooth serial modules are more than capable of either task, and modules can be set up to communicate over software serial so there is no interfere with programming over USB. There are even a number of programs already written for this task.

Bluetooth communication

First of all, how do you connect to your device via Bluetooth for control? The most basic method is to use a module like the HC-05 or HC-06, reversing the RX and TX lines so that the TX (transit) on one device is talking to the RX (receive) pin on the other and vice versa. You may need to implement a resistor in order to feed it the proper voltages, but once connected, your module will simply relay whatever command is received from the board or wirelessly from your device. There is nothing else to set up on the Arduino’s end.

You will need to pair the module with your smart device, and if you’re using a smartphone for control, you’ll need to install a program to send and receive serial signals. There are many such programs available, but my current favorite is the aptly named “Arduino Bluetooth controller” from Giumig Apps. This device can communicate via a serial terminal program, and features other applications including controller, switch, and dimmer modes. The app is free, and doesn’t show ads as with many other apps of this type.

Software serial

[Disconnecting a Bluetooth module isn’t always easy or practical. This one is part of the rocket launcher Strandbeest project featured here.]

Bluetooth control through the Arduino’s RX and TX pins is simple and effective, but if you want to reprogram your board via USB, you’ll first need to disconnect the module. A minor inconvenience in some cases, but in others, getting access to these pins can be quite difficult. The good news is that some boards, such as the Arduino Mega and DUE feature extra serial ports, but others can add extra connections via software serial.

Example code for this technique is found on arduino.cc, using pins 10 and 11 for the RX and TX. This allows you to communicate over Bluetooth serial, then reprogram your board without disconnecting your device. This also allows for serial diagnostics and reprogramming without any physical wire changes. It’s slight more work to set up if, but can be worth it if you have the pins to spare.

Bluetooth programming

Since you can transfer data over Bluetooth, programming via this wireless protocol is also possible. Instructions on how to do this can be found on this Arduino Project Hub page, using the Bluino Loader for Android. Once implemented, this capability opens up the possibilities for what you can do with this tech, changing your device’s programming over-the-air using only your Android phone.

Jeremy S. Cook is a freelance tech journalist and engineering consultant with over 10 years of factory automation experience. An avid maker and experimenter, you can see some his electromechanical exploits on the Jeremy Cook’s Projects YouTube Channel!

Previous Article
Python for physical computing applications
Python for physical computing applications

Interestingly, the basics of router “G-code” isn’t that complicated, simply telling your cutting head to mo...

Next Article
Rocket launcher Strandbeest
Rocket launcher Strandbeest

As I write this, the Fourth of July is coming up, a time when Americans are encouraged to light and observe...