Saturday, April 9, 2016

Use Adafruit Feather Wings as MKR1000 Shields

The MKR1000 microcontroller board from arduino.cc is a very new, very powerful board. With the board coming out of beta and now available, the pinout of the board is fixed (compared to the "pinout might change" communicated in the beta).

It will take some time for MKR1000 compatible daughterboards ("shields").

Fortunately, Adafruit makes add-on boards for their new Feather line. Feather comes with several different microcontrollers: AVR 32u4, SAMD21 M0, ESP8266 and some also come integrated with nice radios. Peripheral daughterboards (Adafruit calls "Wings") now available include LEDs, a real-time clock, motor control, relay, servo, and OLED display.

In the absence of MKR1000 shields, you can look to use Feather Wing boards.


Wings are not directly pluggable into headers placed on the MKR1000.  The pinouts are different and the M0 processors on the Feather M0 and the MKR1000 are different (SAMD21 vs. SAMW25 respectfully).

To overcome the differences, a sandwich board can be used. This would best be a custom board (think a nice purple PCB with ma1e headers on the bottom, female on the top). with the pins from the bottom switched around to make the top pins fit the Feather Wing pin expectations.

For a proof of concept, I took two Adafruit Proto Feather Wings. They were used to make the wiring changes.

Above, the MKR1000 is the bottom board furthest from the display.  It has female headers (with extra long pins for breadboard use also) soldered in (shown below).


The second board, a proto, has two sets of male pins, ones to make with the MKR1000 and male headers pointed up towards the second proto.

The second proto has male headers pointing down to the first and female headers for the Feather Wing daughterboard.

The cross connection may be done with 22 gauge wire.  A more old fashioned connection method is to use fine wire wrap wire and connect with a wire wrap tool. See Wikipedia if you're unfamiliar with wire wrapping.

The OLED Feather wing communicates via the I2C bus. To make it work, we need to cross connect the following pins:

  • Ground
  • Power / 3.3 volts
  • I2C data line (SDA)
  • I2C clock line (SCL)
  • The reset line for the display is connected to Pin 5 on the MKR1000
The code to put test text on the display:


/*
 *  MKR1000 and Adafruit Feather Wing Code
 *  Mike Barela http://21stdigitalhome.blogspot.com/
 */
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 5
Adafruit_SSD1306 display(OLED_RESET);
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
  
  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
  
  // Show image buffer on the display hardware.
  // Since the buffer is intialized with an Adafruit splashscreen
  // internally, this will display the splashscreen.
  display.display();
  delay(2000);
  // Clear the buffer.
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.print("Connected to");
  display.setCursor(0,16);
  display.print("MKR1000!");
  display.display(); 
}
void loop() {
}
Have fun wiring additions to your MKR1000 board including using Adafruit Feather wings.