For Arduino users, ANNHUB does not require any external API at all. In fact, ANNHUB can export a trained neural network model to Arduino format that can be compiled in Arduino IDE.

Export a trained model to Arduino format.

Choose location for trained Arduino neural network

Compile and upload a trained neural network model in Arduino IDE.


1. Define an Neural Network object

  ANN nnObj;

2. Perform prediction based on the neural network input

  For example, in XOR parity classification, there are two inputs and 1 output

  Truth table:

  0 XOR 0 --> 0

  0 XOR 1 --> 1

  1 XOR 0 --> 1

  1 XOR 1 --> 0


  //Define Input variable

  float Input[2];

  float Output[1];

  // Define Output variable



  // Perform prediction


  // The output should be around 1

Arduino STM32 Blue Pill

The STM32 Blue Pill is 32 bit ARM Cortex M3 micro-controller (STM32F103C8) which is  low cost and compact Arduino device.

STM32 Blue Pill Arduino device

STM32 Blue Pill Arduino pinouts

Key features:

  • ARM Cortex M3
  • 72 MHz
  • 64 KB/128 KB Flash
  • 20 KB RAM
  • Reset button
  • LED on PIN PC13
  • 32 kHz Real time clock crystal
  • Jump links on Boot0 and Boot1
  • Micro USB connector for power and data
  • ST-Link header on the top of the board.

Before STM32 Blue Pill can be used in Arduino IDE, following steps are needed to be done.

Step 1: Flashing the boot-loader

The binary of the STM32 Blue Pill boot-loader can be download in

For Blue Pill, the "generic_boot20_pc13.bin" located in binaries folder will be used.

There are several ways to flash the STM32 Blue Pill device, in this tutorial ST-LINK V2 will be used for flashing purpose.

Step 2: Install  STM32 Blue Pill Driver

The Arduino STM32 system files can be downloaded in here. After downloading, the Arduino STM32-master can be extracted into  Arduino hardware folder

The STM32 driver can be installed by running "install_drivers.bat"

The Device Manager will displace STM32 device port (COM8)

Step 3: Install  STM32 Blue in Arduino IDE

The Arduino IDE can be obtained from Arduino Home page.

In Arduino IDE, select Preferences (File->Preferences)

In the Additional Boards Manager URLs, add ""

Go to Tools-> Board-> Boards Manager, search for "STM32F1" and install STM32 Cores that will support STM32 Blue Pill device

Select "Generic STM32F103C series" as Board; Variant: 20k RAM, 64 k Flash, and Upload method is "STM32duino bootloader"

Step 4: Test STM32 Blue in Arduino IDE

Load, compile and upload IRIS_Classification example. Successful process can be seen as below.

The STM32 Blue Pill now can classify three different IRIS flowers.