Introduction: Custom BLE – No Programming Required

Picture of Custom BLE – No Programming Required

Update 15th November – 2017 Some BLE boards / software stacks deliver the same cmd twice in quick succession. Update to pfodApp V3.322+ and pfodParser V3.17+ to solve this. pfodApp V3.322+ adds a cmd sequence number and pfodParser V3.17+ filters out duplicate cmds

Update 1st November 2017 -- Added fix for Adafruit BLE UART and long msgs

Update 16th August 2017 -- Updated example sketches to use new Dwg Primitives

Update 18th July 2017 Intel has announced End-Of-Life for Arduino101

Update: 19th May 2017 – Downgrade Arduino101 firmware to V1.0.7
The latest Curie Firmware V2.0.2 looses connections. Arduino V1.8.2 and Curie V1.0.7 work, but not Curie V2.0.2

To downgrade from Curie V2.0.2 to V1.0.7
i) goto board manager and remove Curie V2.0.2
ii) stop IDE V1.8.2
iii) unplugged the Arduino101 board
iv) start IDE V1.8.2 and installed Curie V1.0.7 from board manager
v) plugged the Arduino101 board in and waited for the USB drivers to install
vi) select Board Arduino101, select Programmer Arduino101 and reburn the boot loader on the Arduino101
vii) unplug the board.
viii) plugged the board back in
ix) reloaded the sketch

Fixing the EEPROM errors: Curie V1.0.7 was sloppy in its definition of the EEPROM support and included source code in the header file. This results in multiple function definition errors when compiling. To fix this go to the Curie package directory
C:\Users\...\AppData\Local\Arduino15\packages\Intel\hardware\arc32\1.0.7\libraries\EEPROM\src
where … is your Windows username
and replace existing EEPROM.h with these two files (from V2.0.2) EEPROM.h and EEPROM.cpp

Update 15th January 2017: Lancaster Uni is changing the micro:bit UART service (issue #259).
pfodApp supports both the old and new style services so this change will not effect pfodApp users.

Update 16th August 2016: added Adafruit Feather LE SPI board support.
Update 30th June 2016: pfodApp V2.0.213+ needs pfodParser library V2.35+. Small change to image dwg BLE examples.
Update 2nd June 2016: Revised All code for latest board libraries and for pfodApp V2, using pfodDesignerV2. The result is improved connection reliability and speed.

This tutorial covers six (6) common Bluetooth Low Energy (BLE) modules and for each one shows you how to control them via custom menus from your Android mobile without doing any programming.

The free pfodDesigner Android app lets you create custom menus and then generates all the code for your particular BLE module. pfodApp is then used to display your custom menu on your Android mobile and let you control your module.
No Android or Arduino coding is required.

The modules covered are:-

  • Arduino 101 / Genuino 101
  • RFduino
  • RedBearLab BLE Shield
  • Adafruit Bluefruit LE UART Friend
  • Adafruit Bluefruit LE SPI (i.e. Bluefruit LE Shield, Bluefruit LE Micro, Feather 32u4 Bluefruit LE, Feather M0 Bluefruit LE or Bluefruit LE SPI Friend)
  • Itead BLE shield and other HM-10 modules
  • BBC micro:bit -- the micro:bit uses C++ and the Netbeans IDE and is covered in another tutorial

Support for more modules will be added as requested.

For each of these modules the hardware and software set up is covered and code for your custom menu is generated. Also a more extensive sample sketch is supplied for each module. That sample sketch covers more features of pfodApp such as:- sub-menus, plotting and data logging, text input, sliders and multi- and single- selection lists. BLE is designed for short packets so design your menus accordingly and optimize the responses to only send the changes not the whole menu. For simplicity the Sample Screens sketches do not do this optimization.

Finally there are a few BLE trouble shooting tips.

This tutorial is also available at http://www.forward.com.au/pfod/BLE/index.html

Step 1: How PfodApp Is Optimized for Short BLE Style Messages

Bluetooth Low Energy (BLE) or Blutooth V4 is a completely different version of Bluetooth. BLE has been optimized for very low power consumption. pfodApp is a general purpose Android app whose screens, menus, buttons, sliders and plots are completely defined by the device you connect to.

BLE only sends 20 bytes in each message. Fortunately the pfod Specification was designed around very small messages. Almost all of pfod's command are less then 20 bytes. The usual exception is the initial main menu message which specifies what text, menus, buttons, etc pfodApp should display to the user, but the size of this message is completely controlled by you and you can use sub-menus to reduce the size of the main menu.

The pfod specification also has a number of features to reduce the message size. While the BLE device must respond to every command the pfodApp sends, the response can be as simple as {} (an empty response). If you need to update the menu the user is viewing in response to a command or due to a re-request, you need only send back the changes in the existing menu, rather then resending the entire menu. These features keep the almost all messages to less than 20 bytes.

pfodApp V2 menus have been re-designed to further reduce the message sizes. pfodApp V2 caches menus across re-connections so that the whole menu only needs to be sent once. Thereafter short menu updates can be sent.

Step 2: Creating the Custom Android Menus and Generating the Code

Picture of Creating the Custom Android Menus and Generating the Code

Before looking at each of these BLE modules, pfodDesigner will first be used to create a custom menu to turn a Led on and off. pfodDesignerV2 can then generate code tailored to the particular hardware you select.

You can skip over this step and come back to it later if you like. The section on each module, below, includes the completed code sketch for this example menu generated for that module.

The free pfodDesigner is used to create the menu and show you an accurate preview of how the menu will look on your mobile. The pfodDesignerV2 allows you to create menus and sub-menus with buttons and sliders optionally connected to I/O pins and generate the sketch code for you (see the pfodDesigner example tutorials) But the pfodDesignerV2 does not cover all the features pfodApp supports. See the pfodSpecification.pdf for a complete list including data logging and plotting, multi- and single- selections screens, sliders, text input, etc. Each BLE device below has a sample screens sketch illustrating some of these other features.

Create the Custom menu to turn the Arduino LED on and off

The tutorial Design a Custom menu to turn the Arduino Led on and off has step by step instructions for creating this menu using pfodDesignerV2.

If you don't like the colours of font sizes or the text, you can easily edit them in pfodDesignerV2 to whatever you want and see a WYSIWYG (What You See Is What You Get) display of the designed menu.

The rest of this tutorial will use that menu design to control the LED via various BLE modules. pfodDesignerV2 lets you generate the Arduino code for this menu for each of these BLE modules as well as WiFi, Ethernet ESP8266, SMS and Bluetooth shields.

Step 3: Using the Itead BLE Shield (and Other HM-10 Devices)

Picture of Using the Itead BLE Shield (and Other HM-10 Devices)

The Itead BLE shield is the simplest BLE shield to use. It provides AT commands to configure it and then just runs as a Serial to BLE bridge.

Setting up the Itead BLE shield.

In this tutorial we are using an Arduino UNO as the base board. Only two things need to be done to the Itead BLE shield to configure its hardware for use. No AT commands are need.
i) set the TX RX links as shown above, D0 linked to the TX side and D1 linked to the RX side
ii) set the 5V / 3V switch to 5V, since the UNO is a 5V board

That's all! Now remove the BLE shield from the UNO to program.

In the pfodDesignerV2 choose the Generate Code button for the menu you have designed (see Design a Custom menu to turn the Arduino Led on and off has step by step instructions). To generate the code, choose from the Bluetooth Low Energy sub-menu, the Itead BLE Shield.

For the Itead BLE shield, a Serial connection at 9600 baud is set since the Itead BLE shield, as set up above, just connects to the Tx/Rx of Uno's Serial connection. Click on “Write Code to file” to generate the code and write it to the pfodDesignerV2.txt file.

Then transfer the /pfodAppRawData/pfodDesignerV2.txt file from your mobile to your computer as described in Design a Custom menu to turn the Arduino Led on and off. Copy and paste the code into the Arduino IDE and program the UNO board. Here is the completed sketch,Itead_BLE_led_control.ino

Remember to remove the Itead BLE shield before programming the UNO, as the Itead BLE shield is connected the the same pins (D0 and D1) as the USB.

Plug the Itead BLE shield back in and open pfodApp and create a BLE connection for it as described in pfodAppForAndroidGettingStarted.pdf. Then connect, and pfodApp will display the menu you have designed and allow you to control the LED on the Arduino Uno board.

Sample Screens

The pfodDesignerV2 only supports a sub-set of the screens that pfodApp supports. For a complete list see the pfodSpecification.pdf. The sketch SampleScreensSerial.ino provides examples of various screens, plotting and data logging. Most of the screens have no formatting to keep the messages clear and simple. The color selector under Sliders is an exception. You can add your own colours and font styles, using the pfodDesignerV2 as a guide. Also see the pfodDemo app for other examples.

The SampleScreensSerial.ino sketch needs the pfodParser.zip and pfodDwgControls.zip libraries to be installed first.

Step 4: Using the Adafruit Bluefruit LE UART Friend

Picture of Using the Adafruit Bluefruit LE UART Friend

The Adafruit Bluefruit LE UART Friend is the next simplest BLE to use, although you would not guess that from reading Adafruit's introduction to this board. It also provides AT commands to configure it, but as it comes is will run as a Serial to BLE bridge at 9600 baud (fixed). However unlike Itead's BLE offering, you need to do some soldering to get Adafruit's board connected.

Setting up the Adafruit Bluefruit LE UART Friend.

Solder in the header provided with the board and set the UART / CMD switch to UART.

Then connect the board to an Arduino UNO using the following connections :-

  • TXO to Arduino RX (Pin 0) (Green lead in photo)
  • RXI to Arduino TX (Pin 1) (Brown lead in photo)
  • VIN to 5V (Red lead in photo)
  • CTS to GND (Yellow lead in photo)
  • GND to GND (Black lead in photo)

That's it set up done.

In the pfodDesignerV2 choose the Generate Code button for the menu you have designed (see Design a Custom menu to turn the Arduino Led on and off has step by step instructions). To generate the code, choose from the Bluetooth Low Energy sub-menu, the Adafruit's Bluefruit LE UART. Go back and click on “Write Code to file” to generate the code and write it to the pfodDesignerV2.txt file.

Then transfer the /pfodAppRawData/pfodDesignerV2.txt file from your mobile to your computer as described in Design a Custom menu to turn the Arduino Led on and off. Copy and paste the code into the Arduino IDE and program the UNO board. Here is the completed sketch, Adafruit_BLE_UART_led_control.ino

Remember to remove the TX and RX leads to the Bluefruit LE UART before programming the UNO, as the Bluefruit LE UART is connected the the same pins (D0 and D1) as the USB.

Plug the TX and RX leads back in and open pfodApp and create a BLE connection for it as described in pfodAppForAndroidGettingStarted.pdf. Then connect and pfodApp will display the menu you have designed and allow you to control the LED on the Arduino Uno board.

Sample Screens

The pfodDesignerV2 only supports a sub-set of the screens that pfodApp supports. For a complete list see the pfodSpecification.pdf. The sketch SampleScreensSerial.ino provides examples of various screens, plotting and data logging. Most of the screens have no formatting to keep the messages clear and simple. The color selector under Sliders is an exception. You can add your own colours and font styles, using the pfodDesignerV2 as a guide. Also see the pfodDemo app for other examples. See Itead section, above, for some screen shots from the SampleScreensSerial.ino

The SampleScreensSerial.ino sketch need the pfodParser.zip and pfodDwgControls.zip libraries to be installed first.

Sending large messages without using hardware flow control.

Adafruit BLE UART has hardware flow control. However the Arduino Uno and Mega and most other Arduino boards do not support hardware flow control on the Serial TX/RX. So to make the BLE UART work the CTS lead is earthed as shown above and the RTS (which stops the Arduino from sending) is ignored.

This is fine for sending a few 10's of bytes, but when sending dwgs, which typically contain 100's of bytes for the initial load, the Adafruit BLE UART looses parts of the message and the pfodApp does not get a complete response.

If no version string is specified in the arduino code, the complete dwg is reloaded each time which makes the problem more likely to occur. The correct way to fix this would be to use the hardware flow control line provided by the Adafruit BLE UART, however Arduino Uno and Mega and most other boards do not support hardware flow control.

The solution in this case is to buffer the serial output and send 20 bytes (a BLE message size) at a time with a delay between blocks to allow the Adafruit BLE UART to transmit them to pfodApp.

pfodParser V3.12+ includes a pfodBLEBufferedSerial class which does this buffering. pfodParser library V3.13+ includes a complete example sketch, pfodBLEBufferedSerialExample.ino

To use the buffer add its include
#include <pfodBLEBufferedSerial.h>

create an instance
pfodBLEBufferedSerial bufferedSerial;

and modify the parser.connect statement to
parser.connect(bufferedSerial.connect(&Serial)); // connect the parser to the i/o stream via buffer

This sets up a 1024 byte buffer which is the maximum bytes for a single response. If your responses are shorter you can create a smaller buffer. Particularly for Uno which has limited stack available. It this particular case the whole dwg was 370 bytes and that was the longest msg response being sent so a 400 byte buffer is appropriate. pfodBLEBufferedSerial bufferedSerial(400); // create a 400 byte buffer instance

Step 5: Using the Adafruit Bluefruit LE SPI Boards

Picture of Using the Adafruit Bluefruit LE SPI Boards

The Adafruit Bluefruit LE SPI boards include:- Bluefruit LE Shield, Bluefruit LE Micro, Feather 32u4 Bluefruit LE, Feather M0 Bluefruit LE or Bluefruit LE SPI Friend. The board shown here is the Feather 32u4 Bluefruit LE.

Setting up the Adafruit Bluefruit LE SPI Boards

No hardware set up is needed but you need to install an extra board configuration and an extra support library (in addition to the pfodParser Library)

Open Arduino V1.6.8's File->Preferences and add this url to the “Additional Boards Manager URLs'” (comma separated)

<p><a href="https://adafruit.github.io/arduino-board-index/package_adafruit_index.json">https://adafruit.github.io/arduino-board-index/pac...</a></p>

You also need to download the Adafruit_BluefruitLE_nRF51-master.zip from

https://github.com/adafruit/Adafruit_BluefruitLE_n...
(click the Clone or Download button and choose Download Zip)

If you are on Windows, you may also need to download and install some drivers from https://github.com/adafruit/Adafruit_Windows_Drive...

Adafruit has detailed instructions on setting up your Arduino IDE to program these boards.

A cached copy V1.9.4 of Adafruit_BluefruitLE_nRF51-master.zip is here in case a later version breaks something.

Sample Screens

The pfodDesignerV2 only supports a sub-set of the screens that pfodApp supports. For a complete list see the pfodSpecification.pdf. The sketch Bluefruit_SPI.ino provides a simple example of turning the LED on and off, setting PWM output and charting the ADC A0 voltage reading.

This Android interface was completely designed by pfodDesignerV2, which then generated the complete Arduino sketch, Bluefruit_SPI.ino You can use pfodDesignerV2 to create your own interface for these boards.

Step 6: Using the RFduino BLE Board

Picture of Using the RFduino BLE Board

The RFduino is my next favourite board. It is small and simple and has commands to go into low power mode and has neat battery shield you can just plug-in, shown above with the optional Led, push button shield on top. There is also a relay shields, a servo shield, etc, available.

To program it you need to add the USB shield shown above (under the main board). While the USB shield is designed to plug directly into your USB port, I found that very inconvenient on my laptop so I add a USB extension cable.

Setting up the RFduino

No hardware set up is needed but you need to install an extra board configuration. Open Arduino V1.6.8's
File->Preferences and add this url to the “Additional Boards Manager URLs'” (comma separated)
http://rfduino.com/package_rfduino_index.json Then open the Tools->Board->Board Manager and type RFduino into the search bar. Then install the RFduino board support. (V2.3.1 was used for these examples)

You will get an error message Invalid library found in
...\AppData\Local\Arduino15\packages\RFduino\hardware\RFduino\2.3.1\libraries\RFduinoNonBLE:
because that 'library' has no library code, just examples. Just ignore this error.

When you compile you will also get a warning
Warning: platform.txt from core 'RFduino Boards' contains deprecated recipe
but the compile and load seems to work just fine.

The RFduino board does not have an LED on D13, but instead as tri-colour leds on its Led push button shield driven by D2,D3 and D4. So go back into the pfodDesignerV2 and edit your Led Control menu you have designed (see Design a Custom menu to turn the Arduino Led on and off has step by step instructions) to change the output connected to the LED On/Off slider from D13 to D3 (say) for the Green led

Then in the Generate Code menu, choose from the Bluetooth Low Energy sub-menu, the RFduino setting. Go back and click on “Write Code to file” to generate the code and write it to the pfodDesignerV2.txt file.

Then transfer the /pfodAppRawData/pfodDesignerV2.txt file from your mobile to your computer as described in Design a Custom menu to turn the Arduino Led on and off. Copy and paste the code into the Arduino IDE and program the RFduino board. Here is the completed sketch, RFduino_led_control.ino

Open pfodApp and create a BLE connection for it as described in pfodAppForAndroidGettingStarted.pdf. Then connect and pfodApp will display the menu you have designed and allow you to control the Green LED on the RFduino Led shield. You can use the pfodDesignerV2 to add two other controls for the Red and Blue leds also.

Sample Screens

The pfodDesignerV2 only supports a sub-set of the screens that pfodApp supports. For a complete list see the pfodSpecification.pdf. The sketch SampleScreensRFduino.ino provides examples of various screens, plotting and data logging. Most of the screens have no formatting to keep the messages clear and simple. The color selector under Sliders is an exception. You can add your own colours and font styles, using the pfodDesignerV2 as a guide. Also see the pfodDemo app for other examples.

The SampleScreensRFduino.ino has been customized to the RFduino. Instead of plotting A0 against time, it plots the internal temperature in deg C. Also the Colour Selector Example actually changes the colour of the RGB led on the optional Led push button shield. You need to reflect the led output off a white card to mix the colour output of the three leds.

The SampleScreensRFduino.ino sketch needs the pfodParser.zip and pfodDwgControls.zip libraries to be installed first.

Step 7: Using Arduino/Genuino 101 BLE Board

Picture of Using Arduino/Genuino 101 BLE Board

Arduino has recently released Arduino 101 / (Genuino 101 outside USA) which has an Intel Curie processor, accelerometer and clock as well as BLE connectivity in an UNO form factor.

Intel has announced End-Of-Life for Arduino101 so it is not recommended for new projects.

The built in accelerometer and clock are a plus, but the size is not as convenient for a wearable application, however the standard UNO form factor means you can easily add a wide variety of other shields. This board can be coded to appear as any of the 'standard' BLE services. The pfodDesignerV2 generated code configures the Arduino/Genuino 101 as a Nordic BLE UART service.

Setting up the Arduino 101 / Genuino 101 (Note: In the Arduino IDE, do NOT select Arduino Industrial 101 board, scroll to the bottom of the list for Arduino/Genuino 101 board)

You need to install the Arduino V1.6.8 IDE and then from the Board Manager add the Curie board support (V1.0.7). This adds and installs USB virtual COM drivers as well. There is also some hardware set up to be done on the board itself. See the notes at the top of this instructable on how to install Curie V1.0.7 instead of V2.0.2. V2.0.2 looses connections.

In the pfodDesignerV2 choose the Generate Code button for the menu you have designed (see Design a Custom menu to turn the Arduino Led on and off has step by step instructions). To generate the code, choose from the Bluetooth Low Energy sub-menu, Arduino/Genuino 101. Go back and click on “Write Code to file” to generate the code and write it to the pfodDesignerV2.txt file.

Then transfer the /pfodAppRawData/pfodDesignerV2.txt file from your mobile to your computer as described in Design a Custom menu to turn the Arduino Led on and off. Copy and paste the code into the Arduino IDE and program the 101 board. Here is the completed sketch, Arduino101_led_control.ino Note: It takes a few seconds for the 101's serial port to come up after programming. Just keep clicking on Tools in the IDE until the port shows up.

Open pfodApp and create a BLE connection for it as described in pfodAppForAndroidGettingStarted.pdf. Then connect and pfodApp will display the menu you have designed and allow you to turn the Arduino/Genuino 101's led on and off.

Sample Screens

The pfodDesignerV2 only supports a sub-set of the screens that pfodApp supports. For a complete list see the pfodSpecification.pdf. The sketch SampleScreensArduino101.ino provides examples of various screens, plotting and data logging. Most of the screens have no formatting to keep the messages clear and simple. The color selector under Sliders is an exception. You can add your own colours and font styles, using the pfodDesignerV2 as a guide. Also see the pfodDemo app for other examples.

The SampleScreensArduino101.ino has been customized to the Arduino/Genuino 101. Instead of plotting A0 against time, it plots the 3 axis accelerometer outputs scaled so that 1024 is about 1G.

The SampleScreensArduino101.ino sketch needs the pfodParser.zip and pfodDwgControls.zip libraries to be installed first.

Step 8: Using the RedBearLab's BLE Shield

Picture of Using the RedBearLab's BLE Shield

The RedBearLab's Bluetooth Low Energy Shield V2.1 is one of a number of RedBearLab modules that uses a Nordic nRF8001 chip.

The picture above shows this shield plugged in on top of an Arduino UNO, but the larger memory of a Arduino Mega 256 is needed for the latest library and pfodDesignerV2 generated code.

RedBearLab provides a library to program the shield, but here I have used the BLEPeripheral library V0.2.0 instead because it is almost exactly the same as code used for the Arduino 101 / Genuino 101 board.

Setting up the RedBearLab Bluetooth Low Energy Shield V2.1

You need to install the BLEPeripheral library. Open the Library Manager in the IDE and type BLEPeripheral in the search bar. Select BLEPeripheral by Sandeep Mistry V0.4.0 and install it.

You can try later versions of the BLEPeripherial library, but V0.4.0 is that one that has been tested here. A copy of that V0.4.0 arduino-BLEPeripheral-master.zip file is here in case later versions break something.

Configure the boards jumpers as shown below. Pins 13,12,11 SPI to ICSP side. Pin 9 to REQN side and Pin 8 to RDYN side.

That's it, configuration complete. Plug the shield into the Arduino UNO board.

In the pfodDesignerV2 choose the Generate Code button for the menu you have designed (see Design a Custom menu to turn the Arduino Led on and off has step by step instructions). To generate the code, choose from the Bluetooth Low Energy sub-menu, the RedBearLab BLE Shield. Go back and click on “Write Code to file” to generate the code and write it to the pfodDesignerV2.txt file.

Then transfer the /pfodAppRawData/pfodDesignerV2.txt file from your mobile to your computer as described in Design a Custom menu to turn the Arduino Led on and off. Copy and paste the code into the Arduino IDE and program the UNO board. Here is the completed sketch, RedBearLab_led_control.ino

Open pfodApp and create a BLE connection for it as described in pfodAppForAndroidGettingStarted.pdf. Then connect and pfodApp will display the menu you have designed and allow you to control the LED on the Arduino Uno board.

Sample Screens

The pfodDesignerV2 only supports a sub-set of the screens that pfodApp supports. For a complete list see the pfodSpecification.pdf. The sketch SampleScreensRedBearLab.ino provides examples of various screens, plotting and data logging. Most of the screens have no formatting to keep the messages clear and simple. The color selector under Sliders is an exception. You can add your own colours and font styles, using the pfodDesignerV2 as a guide. Also see the pfodDemo app for other examples.

The SampleScreensRedBearLab.ino sketch need the pfodParser.zip and pfodDwgControls.zip libraries to be installed first.

Step 9: Trouble Shooting BLE on Android

Note: not all Android mobiles support BLE. You can check if your mobile supports BLE with the free Nordic nRF Master Control Panel (BLE) android app . If your mobile does not support BLE, then pfodApp will not display the +BLE button in the add/edit connections screen.

The BLE hardware is still being ironed out. On the Android side, BLE support was introduced in V4.2 but that version and V4.3 was very buggy. V4.4 improved the BLE support and these modules were tested on an ASUS Zen Phone 5 running V4.4.2. Other phones may vary. Android V5 is reported to be better, but has not been tested yet.

ASUS Zen Phone 5 running V4.4.2 worked fine with few interruptions when using the latest board libraries and code sketches. If there is an interruption, pfodApp automatically reconnects within a few seconds and the data logging is appended to the existing log file so it is still very usable. If the menu initial display is corrupted due to bad data, you will need to clear the menu cache for this connection using the menu option on this connection's the Add/Edit connection screen.

On the module side, there are various chip sets that board manufactures use to provide BLE support. Some are better then others, some scan better, some have less drop outs etc.

If the Bluetooth connection seems to get stuck or will not connect, try exiting pfodApp and turning the mobile's Bluetooth off and on and turning the Arduino BLE module off and on. If that does now work try turning the mobile's Bluetooth off and restarting the phone and then turning the Bluetooth back on to completely clear the Android BLE stack.

Why is BLE so hard to use?

Bluetooth used to be easy to use, every Android and iPhone and most computers supported Bluetooth V2. The Bluetooth Serial Port Profile (SPP) was the standard way to get a general data connection via Bluetooth and all Arduino Bluetooth V2.0 shields supported it.

When Bluetooth SIG introduced Bluetooth Low Energy everything changed. For some unknown reason Bluetooth SIG did not define a standard general purpose serial service for Bluetooth V4. This means that each board manufacture defines their own connection service and your app has to recognize each one. pfodApp overcomes this by pre-configuring the connection details for a variety of common boards. If you have a board that is not supported, contact pfod.com.au at support to get its connection details added to pfodApp.

Bluetooth V4 does define a number of 'standard' connections, like heat rate and battery monitoring, etc. pfodApp does not connect to any of these. If you want to log and plot that data with pfodApp, send the data to pfodApp in CSV format.

On the Arduino side there is no standard BLE library, each BLE board manufacture has their own library, each with its own particularities, to access their particular BLE chipset. pfodDesignerV2 helps out here by generating a complete sketch for each of the supported boards to get you up and running quickly.

Given the issues outlined above why should you use BLE? BLE was designed for low energy use so if you are building a device that needs to run on a couple of coin cells for 6 months then BLE is ideal. On the other hand if you just want a shield to communicate with your Arduino then a Bluetooth V2 shield like this one or a cheap WiFi shield like this one may be better.

Of course the other reason for using BLE is because you bought one (perhaps by mistake). In any case pfodApp and pfodDesignerV2 will get you up and running with a custom control quickly and easily.

Conclusion

This tutorial has shown how you can easily communicate and control Arduino style boards and modules via Bluetooth Low Energy (Bluetooth LE or BLE).

No Android programming is required. pfodApp handles all of that.
No Arduino coding is required. The (free) pfodDesignerV2 generates complete sketches for each of these modules as well as for ESP8266 and WiFi, Bluetooth and SMS shields.

The Sample Screens sketches provided for each board show how to code of some of the other screens available with pfodApp.

Although there is no standard for a general purpose UART connection to a BLE device, pfodApp has pre-configured a number of the common BLE boards connection parameters so you can use the same pfodApp for all of them.

Step 10:

Comments

drmpf (author)2017-11-14

Update 15thNovember – 2017 Some BLE boards / software stacks deliver the same cmd twice in quick succession. Update to pfodApp V3.322+ and pfodParserV3.17+ to solve this. pfodApp V3.322+ adds a cmd sequence number and pfodParser V3.17+ filters out duplicate cmds

drmpf (author)2017-11-01

Update 1st November 2017 -- Added fix for Adafruit BLE UART and long msgs

drmpf (author)2017-08-15

Update 16th August 2017 -- Revised sketches to new Dwg Primitives

drmpf (author)2017-07-25

Update 18th July 2017 Intel has announced End-Of-Life for Arduino101

drmpf (author)2017-05-18

Update: 19th May 2017 – Added note about Curie V2.0.2 loosing connection and how to downgrade Arduino101 firmware to V1.0.7

drmpf (author)2017-01-14

Update 15th January 2017: Lancaster Uni is changing the micro:bit UART service (issue #259).

pfodApp supports both the old and new style services so this change will not effect pfodApp users.

drmpf (author)2016-11-23

Added link to BBC micro:bit support.

https://www.instructables.com/id/Android-Controlled...

drmpf (author)2016-08-16

Update 16th August 2016: A user requested Adafruit Feather LE SPI support which has now been added to pfodDesignerV2. pfodApp already supported it. The Adafruit LE SPI support covers a number of boards, Bluefruit LE Shield, Bluefruit LE Micro, Feather 32u4 Bluefruit LE, Feather M0 Bluefruit LE or Bluefruit LE SPI Friend.

drmpf (author)2016-07-01

Update 30th June 2016: pfodApp V2.0.213+ needs pfodParser library V2.35+. Small change to image dwg BLE examples.

drmpf (author)2016-06-02

Update 2nd June 2016, Revised All code for latest board libraries and for pfodApp V2, using pfodDesignerV2. The result is improved connection reliability and speed.

drmpf (author)2016-05-30

Update 30th May 2016: Revised Arduino 101/Genuino 101 code for pfodApp V2 and Intel Curie Board V1.0.5, using pfodDesignerV2

akellyirl (author)2016-02-13

Arduino 101 makes BLE readily accessible but the difficulty of interfacing to Android is a problem. This is the only source I've found that solves that in a way that is not a prescriptively "canned" solution.

I've no problem that the pfodApp (for the phone), must be paid for, but you can't even do the demo here (as far as I can figure it out), without paying. There is a demo pfodApp but that's only really an ad for the features of the paid-for-app.

Developers, please make it so you can run through at least the LED example on the free app.

drmpf (author)akellyirl2016-02-13

It is difficult to restrict pfodApp so that it only runs the LED example.

The entire menu system displayed on pfodApp is completely driven by the remote device. That is why the one pfodApp will work with all your remote pfodDevices.

You only need to buy pfodApp once and then use it over and over again on all your projects, regardless of whether they are connecting via Bluetooth, Wifi, SMS or BLE.

About This Instructable

7,398views

34favorites

License:

More by drmpf:Adafruit Feather NRF52 Custom Controls, No Coding RequiredRemote Controlled Light Switch -- Retrofit. Light Switch Still Works, No Extra Writing.Redbear BLE Nano V2 Custom Controls With PfodApp -- No Coding Required
Add instructable to: