Program your robot using Arduino

From Edubot Wiki
Jump to: navigation, search

Using Arduino

Until recently you needed to install the STM32 toolchain and libraries to write your own programs for the BennyBot Controller. Now it is possible to use Arduino (tm) for easy programming.

Note: While our testing shows that it is reliable to use, please take note that this is still in beta. Please report any issues here.


If you are using Linux/Mac then you need to install the dfu-util app first.

If you are using Windows then you need to install the DFU drivers

Windows Prerequisites

The following drivers are required to flash new programs to your BennyBot Controller:

DfuSe USB Software Package

You can download it directly from the ST site here or from our local mirror here (Recommended)

  1. Install downloaded package
  2. Plug in BennyBot controller
  3. Put in Programming mode, by holding down the USER Button while pressing and releasing RESET

Linux Prerequisites

You need to install the dfu-util from your software manager.

For example, for Ubuntu based systems you would do the following:

sudo apt-get update
sudo apt-get install dfu-utils

Mac Prerequisites

Mac OS X users can get dfu-util from either Homebrew:

brew install dfu-util

or from MacPorts:

port install dfu-util

Software Installation


You need to download the latest version of the Arduino IDE and install it. You can find it on the Arduino website.

Board Files

To install the STM32 core and the Bennybot Board Files you need to let the Arduino IDE know about them. Start by navigating to File->Preferences


Click on the icon next to the Additional Boards Manager URLs


Enter the following 2 URLs:

Click on OK and then also OK on the preferences window.

Next step is to install the files, open Tools->Board->Boards Manager


Select the STM32 Cores by ST-Microelectronics package and click on install


It will download all the required tools and install it. This step can take a few minutes.

Once it is done, do the same for Edubot Package


You know it is correctly installed when it shows INSTALLED next to the package name



All the required files for creating programs and uploading them to your BennyBot controller is now installed. Lets test it out!

Post Install - Linux/Mac


Note. Only for Linux/Mac

You need to give execute permissions to the upload tools that you just installed.

For example, if you installed version 1.0.3 then perform the following 2 commands:


sudo chmod +x ~/.arduino15/packages/edubot/hardware/stm32/1.0.3/dfutools/linux/dfucmd
sudo chmod +x ~/.arduino15/packages/edubot/hardware/stm32/1.0.3/dfutools/linux/dfu_upload


sudo chmod +x ~/Library/Arduino15/packages/edubot/hardware/stm32/1.0.3/dfutools/macoscx/dfucmd
sudo chmod +x ~/Library/Arduino15/packages/edubot/hardware/stm32/1.0.3/dfutools/macoscx/dfu_upload

udev Rules

Note. Only for Linux

To use arduino and be able to upload with using the sudo command copy the 50-bennybot.rules file to /etc/udev/rules.d/50-bennybot.rules

sudo cp ~/.arduino15/packages/edubot/hardware/stm32/1.0.3/dfutools/linux/50-bennybot.rules /etc/udev/rules.d/50-bennybot.rules

If your Bennybot controller is plugged in then you need to unplug and plug in again before using

First Program

Now that the Board files are installed we can test it by loading the blink example and to upload it to the BennyBot Controller.

Start by selecting the board we are going to use. Navigate to Tools->Board and select BennyBot


Select the Blink example code by navigating to Examples->01. Basics->Blink. This will load the blink example.


You can now press on the Compile icon to compile the program.


To upload your program to the BennyBot Controller you need to put your BennyBot in programming mode. To this hold down the User Button while pressing the Reset button. For more information on the programming mode, read this.

You can now click on the Upload button in the Arduino IDE to load your program on the BennyBot Controller.


Press only the Reset button to exit programming mode and your LED on the BennyBot controller should start blinking. Congratulations! You just loaded your first code onto your shiny new robot controller :)