~/contents
I reached the point in my Arduboy tinkering where I needed to invest in a few ATmega32u4 boards for software purposes. Arduino’s official Micro board is different from the Sparkfun Pro Micro and the many clones available on the market, as the Micro has 36 pins and the Pro Micro has 24 pins. (And neither of these boards should be confused with the Mini/Pro Mini series, which uses the ATmega328.)
These board are tiny, just between the ATTiny45 and the Nanos. One interesting thing I discovered, having not investigated the pinout prior, is that the pinout on the USB side is close enough to the inverse of the Nano I can still actually use my Arduboy and Nano devboards. That’s nice. Thanks Sparkfun!
This board is a little different from other Arduino boards I’ve used in that the VCC pin is 5V, and the RAW pin is what I normally see marked as VIN. According to the product description this one runs at 16MHz and 5V, has 5 PWM pins and 12 data pins and should be treated as the “Arduino Leonardo” in the IDE. It also has an acceptable voltage range of 5-9V.
Pro Micro Pinout
It appears pighixxx’s site is down, or gone, or…? And that’s a shame, but thankfully copies are available on their Flickr account.
Source: pighixxx’s Pro Micro Pinout
Blink Sketch
I like to test boards with a blink sketch before I do anything else. I was initially confused because the butterfly bootloader appeared to be working, but the blink sketch had no effect. Reading through Sparkfun’s Pro Micro & Fio V3 Hookup Guide I discovered the standard blink sketch has no visible effect on the Pro Micro because there’s no LED on pin 13. They provide an alternate blink sketch for testing, preserved here:
/* Pro Micro Test Code
by: Nathan Seidle
modified by: Jim Lindblom
SparkFun Electronics
date: September 16, 2013
license: Public Domain - please use this code however you'd like.
It's provided as a learning tool.
This code is provided to show how to control the SparkFun
ProMicro's TX and RX LEDs within a sketch. It also serves
to explain the difference between Serial.print() and
Serial1.print().
*/
int RXLED = 17; // The RX LED has a defined Arduino pin
// Note: The TX LED was not so lucky, we'll need to use pre-defined
// macros (TXLED1, TXLED0) to control that.
// (We could use the same macros for the RX LED too – RXLED1,
// and RXLED0.)
void setup()
{
pinMode(RXLED, OUTPUT); // Set RX LED as an output
// TX LED is set as an output behind the scenes
Serial.begin(9600); //This pipes to the serial monitor
Serial.println("Initialize Serial Monitor");
Serial1.begin(9600); //This is the UART, pipes to sensors attached to board
Serial1.println("Initialize Serial Hardware UART Pins");
}
void loop()
{
Serial.println("Hello world!"); // Print "Hello World" to the Serial Monitor
Serial1.println("Hello! Can anybody hear me?"); // Print "Hello!" over hardware UART
digitalWrite(RXLED, LOW); // set the RX LED ON
TXLED0; //TX LED is not tied to a normally controlled pin so a macro is needed, turn LED OFF
delay(1000); // wait for a second
digitalWrite(RXLED, HIGH); // set the RX LED OFF
TXLED1; //TX LED macro to turn LED ON
delay(1000); // wait for a second
}
Bricked Pro Micro
If you assign the wrong board you will brick your board. You will be unable to select a COMM in the Arduino IDE and in come cases all the LEDs will be lit up.
Redditor drashna helpfully explains there are a couple of ways this happens. A soft brick must be reflashed with ISP, but if the board is not in bootloader mode you can simply reset the board, granting an 8-second window in which you can locate the COMM port and upload a blank sketch. Unlike the Nano, the Pro Micro does not have an onboard reset button, but you can easily wire one yourself between RST and GND. You may need to hit the button twice. (More on the reset method here.)
Burning Pro Micro Bootloader with Uno as ISP
Within about an hour of tinkering with these boards I’d encountered both types and had to set up an ISP programmer to reflash my Pro Micros. Hans Schou’s Arduino UNO as ISP - burn bootloader on Arduino Pro Micro walks us through it.
Uno | Pro Micro GND | GND 5V | VCC D10 (SS) | RST D11 (MOSI) | 16 (MOSI) D12 (MISO) | 14 (MISO) D13 (SCK) | 15 (SCK)
The ArduinoISP sketch must be loaded to the Uno. Then:
Arduino IDE: Tools -> Select Board -> Arduino Micro Tools -> Programmetor -> Arduino as ISP Click: Tools -> Burn bootloader
At times like these, it’s handy to have a devboard. I bricked several Micros so I was able to put em all in and burn the bootloaders one after another. I’m glad I have a Uno board for stuff like this.
Pro Micro Board Voltage
This is a 5V board, but I only measure 4.7V from VCC. I read this has to do with the open J1 jumper, and closing it should allow the pin to supply closer to 5V.
Connecting the HiLetGo 1.3″ SH1106 SPI OLED
This is a basic wiring example for a HiLetGo 1.3" SH1106 SPI OLED, using olikraus’s U8G2 library.
The board selection is:
U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
The wiring pins are:
OLED | Arduino GND | GND VCC | VCC CLK/D0/SCL/SCK | SCK (pin 15) MOSI/SDA/D1 | MOSI (pin 16) RES | RST (pin 8) DC/A0 | DC (pin 9) CS | CS (pin 10)