Make your own $1 Sigfox IoT device

Previously in my blog post “I held the first $1 Sigfox device“, I’ve explained how the Sigfox network will soon accept some really low cost Radio MCU chip on its network. One of them is the cmostek CMT2189C MCU. It has a cost around $0.25 and has it own integrated radio compatible to Sigfox. This device has initially been made to support garage door remote and it has a lot of limitation. However, you can imagine many application. This post details the first steps to get a development environment ready. And this should save some of your time by going directly to the right way.

Install your tool chain


The CTM2189 toolchain is really old and if you expect to use you MAC environment to build your project, it’s going to be complicated, even if not impossible (I’ll work on it later, based on open-source software). To quickly make you first code you need to use a Windows machine, even on a VM.

Until I found a solution to program the CMT2189C on my own, you need to have a devkit (CMT6002 IDE) to be able to download your hex file into the chip. That’s boring but not too expensive. You just need to deal with the Chinese distributor. This distributor is efficient so you get it within 2 weeks. Paypal payment accepted.


You first need to have a compiler installed. I firstly started with HI-Tech compiler for PICC as this version was the one released with the IDE. Unfortunately this old compiler where generated buggy binary files making the device going to the hell of infinite loops. The solution is to use the Microchip XC8 compiler. Coming from the past, this compiler can be use free with code de-optimization or on PRO version with code optimization. The good point is you can try the PRO version for free for 60 days and then buy monthly licenses of the compiler. For my test I’ve chosen the free version and even if the code is not optimized it is working correctly.

So, once you downloaded the compiler installer, install it following the standard process.


The IDE can be found in the hoperf’s Tool part under the name IDE2.0.6_CMT_Release. The IDE is also simple to install, basically you just need to unzip it. Later, when you will create your first project, you will be able to select the compiler toolchain going into Project >> Select Language ToolSuite. The path to the XC8 compiler is:

C:\Program Files (x86)\Microchip\xc8\v2.10\pic\bin\picc.exe

Create your first program

We are going to create a first project to make our first CMT2189 Blink code. For this, we need to open the IDE and go to Project >> New Project.

Select CMT60F02X device and create your project directory. The IDE will create a code skeleton for you.

Now we can add a simple code like the following. This one is switch the LED status on every wake-up. The device is setup to have a watchdog waking-up the device on about 1 second.

#include	"SYSCFG.h";
#include 	"CMT60F02X.h";
//Variable definition
#define LED			PORTCbits.RC4

void interrupt ISR(void)

   CMCON0   = 0b00001111; 	//Disable Comparator for low power
   TRISC	= 0b00000000; 	//PC2:CLK & PC4:DATA OUTPUT2 / LED
   PORTC	= 0b00000000;	//PORC output initial values
   INTCON 	= 0b10000000; 	 // Interrupt configuration
                             //   GIE => Global Interrupt ON
                             //   PEIE => Peripheral Interrupt OFF
                             //   TOIE => Timer 0 OFF
                             //   INTE => PA2 Interrupt OFF
                             //   PAEI => PortA change Interrupt OFF
                             // Others bits are flags ( T0IF, INTF(PA2),PAIF (PORTA) )
    OPTION = 0b00111000;     // PullUp are enable (0)
                             // Interrupt edge is falling edge (0)
                             // Timer0 Clk source select bit is PA2/T0CLK (1) vs internale FOSC/2
                             // Timer0 Source Edge is Increment 1->0 on PA2 (1) vs 0->1
                             // Prescaler assigned to WDT (1) vs assigned to Timer0
                             // Prescaler is 1:1 on WDT (001)

                             // Configure WatchDog
    WDTCON = 0b00010111;     //   000
                             //   1011 -> Period is 1:65536 => 0.5Hz
                             //   1 -> Enable WatchDog Timer
                             // With OPTION_REG Prescaler 1:1 => the WDT Exp Time is about 1s
    while(1) {
       LED ^= 1;

Before compiling we need to import the SYSCFG.h and CMT60F02X.h as these files sounds to not really be compliant on XC8 compiler. The files can be downloaded from the following archive. You can extract them in your project directory.

Now you can compile the demo project and program the chip with it. During the programming phase and popup will be displayed for the chip Options:

To make it simple, use the values above. This is corresponding to

  • CPB – Flash is protected when disabled
  • MCLRE – PA5 can be a GPIO (PA5) or Reset Pin (MCLR)
  • PWRTEB – Start a 68ms timer on power-up to ensure voltage stability
  • WDTE – Enable Watch Dog timer, soft will not be able to disable it
  • FOSC – Oscillator frequency 32KHz, 20MHz, External on PA6…
  • TSEL – Instruction period 2T or 4T
  • FCMEN – Clock Fault Memory Enable
  • IESO – Two speed clock Enable (for frequent wake-up acceleration)
  • RD_CTRL – Read PAD or LATCH from GPIO
  • LVEN – Low Voltage Reset Enable with given limit 1.8 to 2.8V

One thought on “Make your own $1 Sigfox IoT device

  1. Pingback: All about the Sigfox Connect button - - technology – technology blog

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.