for review, and I was grateful for the opportunity to add one to my collection.
Among the more difficult consequences of the tiny size of the Micro is that the pin labels can be fairly hard to read for aging eyes like mine, and since they are between
the pins, it’s easy to forget which pin they apply to. Several of the first experiments I built had at least one connection made to the wrong pin, though I expect I’ll get used to the labels after a while.
The top of the board also features the USB Micro B connector. While USB Micro connectors are not uncommon, USB Mini is still a bit more prevalent among Arduinos, and the only Micro cable I had around happened to be Micro A. It pays to check in advance and order either the regular USB Micro
cable or the Sparkfun Cerberus
cable along with the Arduino Micro — otherwise, your friendly neighborhood retailer will be happy to charge you the price of an Arduino Micro for a connector cable!
A look at the bottom of the Micro shows that the board has components on both sides; the 34 pins are implemented as fairy sturdy male header pins that work great on breadboards. From the dimensions, I had expected that the Micro would also fit into a DIP-40 socket (e.g. so it could be easily inserted and removed from larger projects), but it appears that the pins are a bit too thick to make this possible without employing excessive force.
High Level Features
From the point of view of the Arduino API (digitalRead, digitalWrite, analogRead, analogWrite), the Arduino Micro is straightforward to use and powerful.
At first glance, one might think that an Arduino Micro offers exactly as many digital pins as an Arduino Uno. However, the reality is quite a bit better than that:
- The standard serial port of the Micro runs over USB. A hardware port is available on pins 0 (TX) and 1 (RX), but it is possible to use these pins for other purposes while still maintaining a full serial connection to a computer.
- SPI is run through a separate set of pins (MOSI/MO, MISO/MI, SS, and SCK), which are available as digital pins if not used for SPI.
So while an Arduino Uno has a maximum of 20 pins available, and only 18 if the serial port is used, an Arduino Micro has 24 pins available. This is, in fact, better even than the Arduino Leonardo, which is largely pin compatible with the Micro, because the Leonardo only makes the SPI pins available through the ICSP header, and does not make the SS pin available at all.
A few extra pins may not seem like much, but as I’m currently working on a problem requiring 19 pins (see below), having 20 pins readily available was just perfect.
The Arduino Micro has a generous 12 analog inputs (6 of which are on “analog” pins, and 6 on “digital” pins).
There seems to be a bit of confusion surrounding the number of PWM outputs an Arduino Micro has. While the text on boxtec’s site correctly gives the number as 7, the accompanying diagram has 8 pins labelled as “PWM”. Two of those, 4 and 12, are not usable as Arduino analog pins, and pin 3, which is usable, is not labelled “PWM”. So, for the record, the usable PWM pins are 3, 5, 6, 9, 10, 11, and 13.
Low Level Features
If you like to dig a bit deeper into the mysteries of AVR programming, here are some lower level considerations.
While digitalRead/digitalWrite are very useful abstractions, it sometimes is helpful to access the underlying port registers directly. In particular, it is sometimes possible to change or read up to 8 pins simultaneously. The precondition for this is, of course, that those pins are part of the same port, and it often helps if the physical sequence of the pins is the same as their bit order in the port.
The standard Arduino layout
is pretty good at this, with the 20 pins arranged as one 8 bit sequence and two 6 bit sequences. Unfortunately, the Arduino Micro layout
(and the Leonardo layout, on which it is based), is a different story altogether: The 24 pins of the ATmega32u4 are spread across 5 8-bit ports, and due to layout considerations, the Arduino boards rearrange pins and pick the occasional bit in the middle for LEDs. As a result, the longest contiguous sequences available are two 4-bit sequences.
Another difference between the ATmega328 and the ATmega32u4 is that the former has a pin change interrupt available for any input pin, while in the latter (and thus the Micro), only 8 of the pins have pin change interrupts, 4 of which are assigned to the SPI interface. In practice, this should rarely be a limitation, but if you expect to be able to get a pin change interrupt on every conceivable I/O pin, that’s not going to work on a Micro.
On a happier note, the ATmega32u4 has a very impressive collection of timers:
- Timer 0 (8 bit) and 1 (16 bit) appear to have fairly similar features across the entire ATmega line.
- Timer 3 is virtually identical to Timer 1.
- Timer 2 (8 bit on ATmega328) does not exist on the ATmega32u4.
But it is Timer 4, a 10 bit timer, that is particularly intriguing. It features no fewer than 6 PWM outputs, arranged in 3 pairs: For each PWM output, its complement can also be made available on another pin. A dead time generator
can be set to slightly offset the two signals to introduce times when both signals are 0 (or 1), which appears to be useful for some power switching applications. A fault protection input
can turn off the PWM outputs quickly. And finally, the timer can be clocked at an internal PLL frequency of up to 64MHz.
Using the Arduino Micro
The Arduino IDE ships with support for the Arduino Micro in the “Board” menu. The upload procedure is a bit different from the Arduino UNO, and in practice, I’ve often found it necessary to manually press the reset button on the board in order for an upload to succeed.
One of the attractions of the Micro is obviously its hardware USB support. The Arduino software supports emulation of a Serial port, a Keyboard, and a Mouse. All three of these seem to work very reliably, and performance can be downright scary: It’s easy to send so much text to the Keyboard emulation that your computer keeps typing for several minutes after you’ve unplugged the Micro.
Nevertheless, I found that the Arduino libraries make rather conservative use of the USB hardware capabilities available. For instance, I would find it very useful to open a second USB serial port, and the hardware seems to be capable of doing it, but the libraries don’t support it. There also is no built-in support for other USB protocols, e.g. MIDI over USB. One of my future projects will be exploring third party projects like LUFA
, which are supposed to be considerably more powerful.
High Voltage Parallel Programming
One of my current obsessions (and the origin of my infamous 19 pin problem) is the implementation of the various programming protocols available for AVR processors. I’m in the final testing stages of a new programming sketch named ScratchMonkey
, and was eager to play with the Arduino Micro as an alternative to the Uno for a programmer.
I’m pleased to report that the Micro performed perfectly in this role. The extra pins allowed me to use a simpler breadboard setup (with the Uno, I had to use an auxiliary shift register for the control signals), and after a few minutes of cabling, I was able to successfully reprogram an ATtiny4313:
Shown here, left to right: A Maxim MAX662ACPA+ charge pump IC to generate the 12V high voltage signal from the 5V input; the ATtiny4313 target MCU, an ATtiny85 left on the board from a previous experiment, and the Arduino Micro.
An Arduino Micro probably should not be the first Arduino to give to a beginner: The small labeling, the finicky upload procedure, and the limited compatibility with Arduino shields are all drawbacks to a certain extent. However, the Micro excels with its breadboard friendliness, its USB capabilities, and a pin count and feature set exceeding most regular size Arduino boards. I highly recommend it as a second Arduino board for owners of a standard Arduino, or as a board for users with previous microcontroller experience.