IoT Sensor with STM32F4Discovery

Please see also: Citairo Citairo Logo


IoT Sensor with STM32F4Discovery and BG BLE113

  • Main project is: Citairo Citairo Logo
  • A mobile IoT sensor with BLE (Bluetooth Low Energy)
  • Yes, use STM32F4Discovery and BlueGiga BLE113 to create a mobile IoT Sensor
  • Use the tools provided here in order to talk to the BLE113 module or to flash the firmware on BLE113
  • The STMF4Discovery runs Pico-C, a C-language like shell (command and script interpreter)
  • A Qt Windows PC application acts as host and can also flash the FW in BLE113.
  • No need to purchase a debugger such as TI CC Debugger - the Qt App can debug and flash the module.
  • Connect your sensors on BLE113 directly or use the STMF4Discovery interfaces, e.g. I2C, SPI, GPIO
  • We are working on Android and iOS Apps to provide a
    mobile enviromental and air quality measurement and city maps application.

How does it work?

The STM32F4Discovery board acts as host for the BlueGiga BLE113 module (no need for BG Eval Board, just BLE113 module itself on a STMF4Discovery board).

In order to develop BLE IoT Sensor Apps - you need just a STMF4Discovery (USD 15.00) and the BLE113 module, much cheaper as original eval board.

The STM board runs inside as FW a Pico-C virtual COM (UART) shell so that we have access to all features via a regular UART terminal program, e.g. TeraTerm.

The Pico-C command line interpreter allows to write scripts which are C-language like.

In combination with the Qt UARTloader we can talk to STM board and BLE113 via a UART command line shell, including to use the debug signal, to read/write registers or to flash the BLE113 firmware (FW).

The Qt UARTloader can also act as:

  • bridge the UART from BLE113 so that the BlueGiga GUI can see and talk to the BLE113 (using BGAPI), from a Windows PC
  • the UART is forwarded to computer as virtual COM port to that BlueGiga tools can find and use it as COM port to BLE113
  • The debug signals, DC and CC, are used in order to read/write BLE113 registers and memory, including to erase or program flash pages inside BLE113.
  • There is no need to purchase the BG Eval board or a TI CC Debugger: the STM32F4Discovery acts as Eval Board, Debugger and Flash Tool.
  • The BLE113 module FW can be flashed with the Qt UARTloader.

The BLE113 module is soldered via jumper wires and connected to the STMF4Discovery GPIO pins (mainly the BLE UART and Debug signals, but also SPI or I2C available).

The BLE113 module is fliped (up-side-down) in order to have access to the solder pads (see also Schematics).


Wiring BLE113

UARTloader Windows App

UARTloader Windows App

The UARTloader can talk to the the STM32F4Discovery board as regular UART terminal (no need to use TeraTerm).

It provides functions to read and write BLE113 registers or memory.

The UART command line is like a C-language Shell: you can program scripts which are C-language-like.

UARTloader provides also commands to flash the (entire or part of) flash memory inside the BLE113.

You can erase and program dedicated flash pages or the entire BLE113 flash.


The STM32F4Discovery Firmware project for BLE113 as Cooxox project is here:

You have to flash the STM32F4Discovery with it so that the UARTloader can talk to it (STM32F4Discovery FW has to be in sync with the UARTloader App).

Download picoc_Discovery_BLE113 project (1.606 MB)

The Nokia Qt UARTloader project for Windows is here (Qt version 5.3.1):

Download UARTloader_Qtproject (11 KB)

Or download the ZIP archive with the final executable (for Windows PC, it needs the STMF4Discovery flashed with the Pico-C firmware):

Download UARTloader (19 MB)

Flashing the BLE113

The UARTloader can also be used in order to flash the FW of the BLE113.

The debug signals DC and DD are used in order to access the BLE113 and to manage the flash programming procedure.

The STMF4Discovery FW provides the functions to access the BLE113 via the debug signals. A separate CC Debugger is not needed (save your money).


If you run the BGAPI inside the BLE113, a UART interface can access the BLE113.

The BG GUI can access the BGAPI inside the BLE113 via a UART connection.

The UARTloader has a command to bridge the UART: the UART of the BLE113 is forwarded to the PC, as virtual COM port.

So, the BG GUI can talk to the BLE113 via the STMF4Discovery board, e.g. using the BGAPI commands.

The STM32F4Discovery board acts as a host similar to the BG Eval Board.

Android App

Android App

Mobile App Development

I am thinking about: Which tool and language to use so that I can support several platforms, such as Android and iOS?

I want to code just once but run it on different target and OS platforms.

I am a big fan of Nokia Qt [5] as well as Embarcadero RADStudio [6], coming from Delphi, Pascal backgrounds. Deplhi 7 was a great language and tool.

Therefore I am looking for a way to avoid programming in native Android SDK and Android Studio [7], to avoid Java and just supporting at the end one mobile application platform (just Android).

Therefore, I am evaluating potential languages, tools and IDEs which can be used in order to write the mobile app independent of any HW platform.

Potential candiates are:

  • Android SDK and Android Studio [7]:
    But it supports only Android and I had to deal with Java. Benefit: it would be most up-to-date related to supported BLE API functions. The native but hard way.
  • Nokia Qt [5]:
    It does not support yet BLE, just in next release 5.4 it is announced (current is 5.3 and not yet direct BLE support). I could start with Qt but had to use Android SDK in Qt (possible but not a seamless coding style).
    The benefit, why I actually like Qt: it supports also Linux as platform, just the iOS might be an issue using Qt. I will check Qt for BLE asap when version 5.4 is out.
  • Embarcadero RADStudio XE7 [6]:
    It does support BLE in XE7 (based on marketing statements). I tried with XE7 eval version and it seems to have small issues (Help and API documentation is not really complete or helpful for BLE, indicate in Characteristics does not seem to be supported or working). Fast progress with it, as expected.
    Nice, my favorite to go with.
  • Xamarin [8] seems to be promising as well. Not bad, Android and iOS, based on C# and Mono (.NET). Just Linux is missing.
    The only problem: all the demo projects have issues, complicated to get it compiled. And it needs a Visual Studio license. Just on MacOS there is Xamarin Studio, why not on Windows? (it is but not to find under Programs via the regular way) Still working on it to get a first demo working with it (harder then expected, very Microsoft oriented, too much components involved).
    I give up here: I could not generate any demo project, very complicated to setup, to configure (which Mono version?, It does not generate an Android APK, registry keys (UUIDs) in project file wrong. And it needs a Visual Studio 2012 license (at least). It will end up with additional license fees and hard to know which prerequisites are needed. I will not use.

Demo Project

The demo project used to evaluate RADStudio XE7 is based on the BLE113 Thermometer (factory setting in BLE Samples) firmware.

RADStudio XE7 looks really great and is my favorite to go with. I have spent this huge amount of money for the license.

I tried also Xamarin, but too difficult, at the end nothing works (even other demo projects I cannot build). I think it is quite hard to get all requisites together, e.g. VisualStudio 2012 (or never) is needed, the license cost will be higher as mentioned at the end.

I tried also Android Studio. I was able to create the BG Android Demo project in Android Studio and it works. I have fixed also an issue - the indicate was never working because one code line was missing in all projects I have found. Now it works nice.

Please find here the modified and fixed Android Studio BG Demo project and the related Android APK.

Download AndroidStudio BG Demo project (1.4GB)

Download BG Demo Android APK - working inidcate (305KB)

Please find here as well the BLE113 Thermometer Android App as APK and the related RADStudio XE7 project.

Download XE7 BLE Thermometer project (81MB !!)

Download Android BLE113 Temperature APK (6.5MB)


Discovery BLE Temperature Sensor Discovery BLE Discovery BLE Android App



[1] BlueGiga BLE113

[2] Order at Digikey

[3] other STMF4 Discovery stuff

[4] Coocox ARM compiler IDE

[5] Nokia Qt

[6] RADStudio XE7

[7] Android SDK and Studio

[8] Xamarin C# Mobile Apps