Skip to main content

Remote Flying Fish Project Part 4: Bluetooth Testing

Before starting, please have a look at the mechanism of the communication of this DIY gadget.


Bluetooth is a communication medium between the mobile APP (controller) and Arduino board (motors). And this time, we need to make sure that the Bluetooth module, acts as a messenger and can serve this well.

Bluetooth is a wireless communication technology standard for sending or receiving data over short distances. It uses short wavelength Ultra High Frequency(UHF) radio waves in the Industrial Scientific Medical(ISM) band from 2.4 GHz to 2.485GHz. It can perform in both fixed and mobile devices, and building Personal Area Networks (PANs). Invented by telecom vendor Ericsson in 1994. It was originally conceived as a wireless alternative to RS-232 data cables.

Bluetooth Low Energy

Bluetooth Low Energy, BLE has dominated the electronic applications market due to the Internet of Things (IoT). Internet of things can be understood as an inter-networking of physical devices (i.e. Sensors). It is normally a bunch of small devices that require long-lasting performance. In this case, a small battery will be good enough. An example of IoT could be a device with a sensor that monitors the human heart rate via a smartphone app. So, BLE is an excellent technology to improve energy saving and increase the operating time of devices.

In this course, we will use BLE [HM-10] as well since it can help to reduce power consumption and it is a trend in reality. bluetooth2_e81902ab5457eab6f180244856b5e2407ed62a98.jpg

Implement BLE via Arduino

After knowing the basic concepts of BLE, we can try to implement BLE with the Arduino board. We will first use the Serial Monitor inside the Arduino IDE to simulate the Android Application. You can open the Serial Monitor by clicking the button on the top right-hand side within the Arduino IDE. With the Serial Monitor, you can send and read different signals (i.e. number, alphabet).%25E6%2593%25B7%25E5%258F%25968_df130c165fe76acc7ab81b455dcb0a8c7c818957.png

Testing AT Command

Take the BLE 4.0 Bluetooth chip, the simplest way is to bridge the Bluetooth module with a USB TTL tool.


Connection of ports between TTL and Bluetooth:

'DTR' : none

'RXD' : 'TX' of Bluetooth

'TXD' : 'RX' of Bluetooth

'VCC' : '5V' of Bluetooth

'CTS' : none

'GND' : 'GND' of Bluetooth

You can use the Arduino IDE to test it. Firstly, open a new file, select the port that represents the USB TTL, and open the serial monitor.

Be careful: The pin position varies from one module to another, even though they all are named "hm-10"

An alternative method to test AT command

If you do not have a USB TTL, you can test the Bluetooth by the Arduino board. Firstly, let's see how the code works, it may also be useful in the future part when you design your own Arduino program.


Inside the loop(), using 'if condition' to check whether the serial monitor of Arduino or Bluetooth received any message. If they received any message, 'available()' will return '1', otherwise, it will return '0'. Then, use 'readString()' to save the received messages into a variable and print it to each other.

Also, be reminded that the return type of 'readString()' is 'String', if you want to return it by 'Character', change the type of ‘req’ to 'char' and use 'read()' instead of 'readString()'.

AT commands

Then send AT commands via the Arduino Serial Monitor to do the setup. In the following example, it shows you the response after sending some AT commands.

The commands being sent in the demo in ascending order are:








Check module connectivity

Check module baud rate setting

Check module display name

Set module display name to ABCDE





Check out other AT commands here.

There are a bunch of other AT commands at Ch.3.

Checking the connection between Arduino and Bluetooth

One of the easiest ways to check the connection is to type “AT” in your serial monitor, the Bluetooth should receive and return “OK” to Arduino. Make sure you selected a correct baud rate and 'Both NL & CR' on the bottom.


However, if you want to test sending other words or sentences instead of only AT command, you may download a mobile application called HM10 Bluetooth Serial Lite. After connecting it to your BLE, your phone can open a terminal as the monitor of Bluetooth. When you input some texts, the Arduino monitor should receive and print it out, and vice versa. [Please make sure you selected the right port for the TTL]

1. A similar interface will be shown when you open the mobile application.


2. Press the 'Connect' button on the left upper side. [This button will only be enabled when your mobile device turns on Bluetooth function.] Then your Bluetooth should be shown.


3. Press the 'Connect' button of the Bluetooth. When the 'Connect' button on the left upper side turns into 'Disconnect', the Bluetooth is successfully connected.


4. Type 'Hi' on your mobile device, you should receive the same message 'Hi' from the serial monitor.


5. Same as step 4, type 'Hi too' on the serial monitor, you should receive the same message 'Hi too' from your mobile device.


Now your Bluetooth is ready, let's move on to the next chapter, Motor Testing with Remote XY coming soon.

You can download the pdf version of this chapter in the Download section below.

 Parts in this series

lokit has not written a bio yet…