in Development

.NET Gadgeteer Series: Setting up the work environment and hello world

This is the first article about .NET Gadgeter and .NET MicroFramework. Here we will see how to set up the work environment and how to code a “hello world”.

For those who do not know .NET MicroFramework, it is an open source project with Apache 2.0 license that allow us developing for embedded devices using C#, a subset of .NET and Visual Studio.

.NET Gadeteer is another open source project that allow us assembling electronic devices without having to be a welder expert. Thanks to it we can prototype gadgets using different hardware modules and using the .NET MicroFramework.

Placa_Cerbuino_BeeDuring this serie of articles we will base our work on the board Cerbuino Bee.

This board is a good starting point, it costs roughly 38€ and it is very handful because it is compatible with Gadgeteer and Arduino. This means we will be able to use sensors and modules designed for either platform. In addition, it counts with USB ports and a microSD card reader that will allow us to start experimenting without having to buy other modules for now. It is worthy to mention that the board is OSHW (open source hardware).

To start we will need to set up our work environment and install the next:

Visual Studio 2012

.NET MicroFramework 4.3. It is important to stand up that the Cerbuino Bee board, supports only the .NET Microframework 4.2. Therefore, we will have to target that version when we build our projects.

.NET Gadgeteer Core

Manufacturer SDK. The manufacturer has created an installer that includes: SDK for the hardware, .NET Microframework and .NET Gadgeteer Core, so if you install this SDK you will only need to install Visual Studio in addition to it.

Checking the connection with the Cerbuino Bee and Firmware updates

Just with the previous products installed we could create our first project, but as good geeks we will check first that our Cerbuino Bee has the latest version of the Firmware installed. To do it we will use a tool included in the manufacturer SDK.

  • Connect your board Cerbuino Bee to your Windows PC through the USB cable, when you do it you will see how a red led that is just behind the USB connector turns on and how the drive is automatically installed on your PC.
  • If you are using Windows 8 or above, press the Windows key to go to the start page, write “Fez Config” and run the app, if your using any other version of Windows go to the file explorer and look for the app.
  • Now you can check you can reach your Cerbuino Bee board clicking the button “Ping”.


As you can see in the screenshot above, if all goes properly you will see the ping answer from TinyCLR”, this means all is working properly and that we can reach our board. Now, click the button “Check device for update”, in my case the board was not updated with the latest version of the firmware neither the loader, so in the next steps we will see how to update them before we start coding. If your board is already updated you can skip the next steps.


Updating Boot loader

The Loader, called TinyBooter, is the first to run when you turn on the board and is in charge of loading the firmware called TinyCLR. To update it, you can use MFDeploy, a generic tool that is included with the .NET MicroFramework SDK, but in order to ease the process we will use the manufacturer SDK. Follow the next steps:

  • Unzip the file, you can find it at the next location“C:\Program Files (x86)\GHI Electronics\GHI OSHW NETMF v4.2 SDK\FEZ Cerb Family\Firmware”
  • Run the installer “DfuSe_Demo_V3.0.2_Setup_amd64.exe” if you have 64 bits Windows PC or “DfuSe_Demo_V3.0.2_Setup.exe” in case you have a 32 bits Windows PC.
  • Install the USB drivers located at the folder ”C:\Program Files (x86)\STMicroelectronics\Software\DfuSe\Driver”

Next we will have to configure our board in “Boot mode”, to do it unplug your board, add a “header” and use a “jumper” in the pins marked as LDR, you can find them just at the left of the board processor. I didn’t have headers neither jumpers available, and I didn’t want to wait to buy and receive the shipment, so I just closed the circuit making use of the small cable that is used to close the bread bags as you can see in the image below.


Once you have set up your Cerbuino Bee board in “boot mode”, you can connect it again to your Windows PC and you will see that the red led switches on again. Once the board is on, do not turn it off, and remove the connector we just used to enter “boot mode”.

Now we will use another tool created by the board manufacturer, if you use Windows 8 go to the start screen and write “STDFU Tester”, if you use another version of Windows just open the file explorer and search for it. If you followed the previous steps correctly once you open the app, it will show you a combobox called “Devices” with the next item: “STM Device DFU Mode” as you can see in the image below:


The next we are going to do is to delete the contents of the board, so pay attention to avoid following the steps wrongly. Go to the tab “Protocol”:

  • Click the button “Create from Map”.
  • Select “Erase” using the radio button that you can find on the left.
  • Click the button “Go”.
  • Click the button “Load DFU File”, open the folder “C:\Program Files (x86)\GHI Electronics\GHI OSHW NETMF v4.2 SDK\FEZ Cerb Family\” Select the file “TinyBooter_4_2_6_1.dfu” (the numbers are related to the version of the file, so they might be different than yours).
  • Click the button “Download”
  • Click the button “Go”.

Once we have reached this point the “Loader” will be updated, you can check it opening again the app “FEZ Config” and clicking “Check for Device Updates”.

Updating the Firmware

Once we have updated the “Loader” we are going to update the firmware. Don’t worry because the procedure to do it is much simpler. During this process we are going to delete the firmware of the board so make sure you do not disconnect the board neither you reset it. Open again the app FEZ Config, select the tab “Firmware Updater”, you will see something similar to:


In the next articles we will use an Ethernet module, so tick the checkbox “Ethernet Firmware”, if you are not going to use it just leave it unchecked. Now click “Next” and wait the process completes, meanwhile you will see a progress screen similar to the screenshot below


We have already finished updating the board and setting up the work environment.

Programming a Hello World

Now we are ready to build and deploy our first app on our Cerbuino Bee, to do it we will create a project with Visual Studio using the template “.NET Gadgeteer Application”. After selecting the template it will open a new window where we will select our board as you can see in the next screenshots.


Usually reached this point we will code a simple “Hello world”, but we do not have a screen and writing to the Visual Studio console doesn’t allow us to feel we are running the code from the board. Therefore to interact with the board we will make use of the debug led with the command:


To do our “hello world” I thought it would be much more interesting to develop a Morse translator that makes use of the debug led.


You can download the Morse translator, the idea is pretty simple, we pass a plain text and the translator converts it to an int array encoded as International Morse, where 0 means turn off the led and 1 turn it on.

When the board boots we will translate “hello world” to Morse, we will create a timer, every time the time elapses we will turn on or off the led and finally we will turn off definitively the led. To do it we have written the next code:

int[] morseCode = null;
int index = 0;

private void SayHelloWorld()
    MorseCodeTranslator translator = new MorseCodeTranslator();

    morseCode = translator.Translate("hello world");

    GT.Timer timer = new GT.Timer(300);
    timer.Tick += timer_Tick;

void timer_Tick(GT.Timer timer)
    if (morseCode == null)

    if (index < morseCode.Length)
        Mainboard.SetDebugLED(morseCode[index] == 1);


You can download the sample code to continue playing with the Microframework and your board.

I hope this first article helps you to start working on your .NET Gadgeteer projects.