project: wireless control of Bolt 18F2550 system using a mobile phone with a bluetooth link.
With the emergence of smartphones, which already have their own operating system, it is now possible to develop applications using Bluetooth wireless links between mobile devices and microcontrollers.
In this project, a Samsung Galaxy Pocket mobile phone and a Bolt 18F2550 microcontroller board are used. Through a remote bluetooth link (up to a distance of 10 meters), the user may type commands in the mobile to activate or deactivate a lamp connected to the microcontroller board. Typing another command, the user may receive in his mobile screen, the decimal value (0...15) of the 4 dip switches on board.
For this purpose, a Bluetooth HC-06 module with serial port is inserted to the Bolt board. On the other hand, the Samsung Galaxie mobile should have available an application called 'BlueTerm', which is free and can be downloaded directly from the Google Play internet site.
The BlueTerm program:
The software called 'BlueTerm', compatible with the Android operating system, is a terminal emulator application which allows you to send or receive ASCII strings through the already built-in Bluetooth link of your mobile (this application is equivalent to the 'Hyperterminal' software for Windows). The user may manually type any of the commands shown in the table below, which are then transmitted to the HC-06 Bluetooth receiver already installed in the Bolt 18F2550 system or any other microcontroller board.
This application is free and can be downloaded directly from the Google Play internet site to the mobile phone.
The firmware in the 18F2550 Bolt system:
For the Bolt board to receive and respond to commands through its serial port, the following program was developed using the C18 compiler and MPLAB IDE development tool. The project is this:
The .hex file in this project should be loaded into the Bolt board for proper functioning.
After reset, the remote device called 'BlueBolt' (that is, the Bolt 18F2550 board), sends the promt 'OK>' to the mobile. The available commands are these (marked in blue):
Devices used in the project:
The devices used for testing of this project are shown below: a Samsung Galaxy Pocket mobile, a Bolt 18F2550 board powered by an external wall transformer, a Bluetooth Module HC-06 with serial port, which is inserted to the Bolt board, and a 40 watts lamp.
Photo below shows detail of the Samsung Galaxy mobile and the Bluetooth module with serial port inserted to the Bolt board. The remote bluetooth HC-06 device was configured with the name 'BlueBolt'. If you want to change this name, go to this link.
Configure the Bluetooth link on your mobile phone, and the BlueTerm app:
Video: how to detect and pair a Bluetooth HC-06 from a Samsung Galaxy mobile
Setting up the Bluetooth link on the phone: in the setup menu of your Bluetooth mobile phone, once it has detected the remote device (in this example called BlueBolt) the following pin must be typed: 1234 This pin is factory preconfigured on all devices HC-06. If you want to change this pin, go to this link.
In photo, after typing the pin, the remote Bluetooth HC-06 device called 'BlueBolt' is shown as paired with the mobile, that is, ready for communication.
Once the Bluetooth setting in the mobile have been configured, the user must open the BlueTerm app icon, as shown in the picture below. This program is free and may be downloaded from the Google Play site.
With the BlueTerm program open, you must select the general menu option, and then 'preferences'. Mark the selection as shown below: 'Allow insecure connections'.
Initially, the BlueTerm application marks the remote device as 'not connected' (see photo). To connect, user must select the main menu in BlueTerm and then select the 'connect to a device' option.
Finally, the program marks the remote device 'BlueBolt' (that is, the Bolt 18F2550 board) as connected as shown in the photo below. The user can now type commands to remotely operate the microcontroller. The link works up to a distance of 10 meters.