What is the Exen Mini?

The Exen Mini is billed as “The World’s Smallest 32-bit Arduino Compatible Microcontroller” and at just 14.9mm square, it’s hard to disagree.

We’ve slowly been reducing the size (and power consumption) of our prototype IoT devices for some time now. We’ve used the Arduino Uno and the Arduino Nano, finally settling on the Arduino Pro Mini, but the Exen Mini takes us down even further in size.

For the geeks amongst you, the full specs are here, but the highlights are these:

  • Arduino Compatible
  • 8 Digital Pins (all of which allow for PWM outputs to control motors/LEDs etc)
  • 6 Analog (ADC) pins
  • Dedicated Hardware Serial Support on top of the built in USB->Serial adaptor
  • I2C support

Is there anything I should know before I use it?

Addressing Pins on the Exen Mini


The Exen Mini doubles up on port use, so addressing pins can be a challenge.

Let’s assume that we want to change the brightness of LEDs that are attached to each of the digital pins to give us a pattern show here.

If we were using a standard Arduino, we’d tell the Arduino to set the values using analogWrite(pin, speed) where pin is an integer between 0 and 8, and speed is a value between 0 and 255.

The Exen Mini uses a slightly different form of addressing, so we need to change our code slightly.

Instead of referencing the digital pins by number, we reference them by name. This means that our new code would be analogWrite(SDA, speed). Note that there aren’t any quotation marks around the name of the pin, this is because under the hood, the analogWrite() function is converting it to the correct pin number.

If you want to pass the pin name via the Serial port, the following function may be of use:

int translate_led_pins(String led_pin){
  if (led_pin == "SDA"){
    translated_pin = SDA;
  } else if (led_pin == "SCL"){
    translated_pin = SCL;
  }
  else if (led_pin == "SCL"){
    translated_pin = SCL;
  }
  else if (led_pin == "A1"){
    translated_pin = A1;
  }
  else if (led_pin == "A2"){
    translated_pin = A2;
  } else if (led_pin == "A3"){
    translated_pin = A3;
  }else if (led_pin == "A4"){
    translated_pin = A4;
  }
  return translated_pin;
}

This function converts the value passed as a String to the Integer equivalent like this: analogWrite(translate_led_pins("SCL"), 255).

Reading and Writing from the Exen Mini’s serial ports

The Exen Mini is based on the SAMD21 Micro-Controller and therefore has more than one Serial (TX/RX) port available.

As outlined in the excellent setup guide, you access the serial port attached to the USB socket via SerialUSB instead of the usual Serial. We then got confused as to how you would read/write from the Serial connections on ports 0 and 1, before realising that the SAMD21 has *three* serial ports available.

The first is connected to the FTDI converter and provides SerialUSB. The second is usually connected to a debugging port and is available on Serial. On the Exen Mini, pins 0 and 1 are connected to Serial1.

Here’s a quick example of how to read data from a UBLOX-GPS device and echo the results to the Arduino Serial Monitor.


#include <TinyGPS.h>
// Create our GPS Object
TinyGPS tracker;
// Hold the speed somewhere
float mph;
// How many satelites do we have in view?
int satelites;

void setup() {
  SerialUSB.begin(9600);
  Serial.begin(9600);
  SerialUSB.println("Starting up...");
}

void loop() {
  // Read the Values from the GPS unit
  if (Serial1.available() > 0) {
    SerialUSB.println("Reading Serial");
    int c = Serial1.read();
    if (tracker.encode(c))
    {
      satelites = tracker.satellites();

      // Process what we've just found
      mph = tracker.f_speed_mph();
      SerialUSB.print("Current speed in MPH is ");
      SerialUSB.println(mph);
      SerialUSB.print("Current number of visible satelites is ");
      SerialUSB.println(tracker.satellites());
    } else {
      SerialUSB.println("Could not encode message");
    }
  }
}

Is it worth it?


The Exen Mini retails at £10 each. This is significantly more than most Arduino Clones including the ESP8266-based devices however, it packs far more of a punch for its size.

The number of available PWM pins vs. the size of the device makes it a leader in the field when it comes to small form factor IoT devices, and it’s definitely going to shrink the size of our IoT Weather stations.

All things considered, we’ll be sticking with these for quite a long time to come!

If you’re interested in learning more about how we approach the Internet of Things, why not sign up to our newsletter?


Mockingbird Consulting