Showing posts with label Arduino MKR1000. Show all posts
Showing posts with label Arduino MKR1000. Show all posts

Friday, January 13, 2017

Arduino as a Microcontroller Reference Platform

The Arduino line of microcontrollers has, arguably, been the spark that brought programmable hardware to Makers worldwide. This article takes a look at how Arduino furthered the use of microcontrollers and how it is important defining standards today.

Arduino dates back to Hernando Barragán's design of the Wiring platform in 2004. In 2005, Massimo Banzi, with David Mellis forked the Wiring source code and started running it as a separate project. Arduino use grew through successive product releases including the Arduino Diecimila, Arduino Duemilanove, and the baseline Arduino Uno board series (in its third revision). The evolution set the Atmel ATmega328P microcontroller in the Uno to become the microcontroller standard of its time.
The Arduino Uno R3 (photo via Adafruit)
The ecosphere of Arduino, consisting of the circuit board and Arduino Integrated Development Environment (IDE) became very compelling for developers. Many software libraries were created to extend Arduino software capability and hardware connectivity. This growing capability launched the ATmega328 into many project designs. The success of the Uno board design led to other companies and makers to make Uno compatible boards based on the '328. The price of the Uno was set at the time at $35 and it did not go on sale often, requiring an investment on the purchase of each board.

In expanding the Arduino product line, the Arduino team introduced other boards based on newer microcontrollers. Some have been more widely adapted into maker designs than others. Many software libraries required changes to support different microcontroller architectures.

The development of the Atmel ATmega328P has evolved from the ATmega168 and smaller ATmega8, which all use the Atmel's AVR architecture. The '328 chip runs at a nominal 16 MHz (on the Uno) with 32 kilobytes of flash memory. This is modest by computer standards, but this chip equalled much of the industry when it was introduced.

The Arduino team, in looking for better designs, introduced the Arduino Leonardo. Leonardo was based on the Atmel ATmega32U4 microcontroller with the same 32kB of flash at 16 MHz. The chip was mostly compatible with the '328 but also had the feature of native USB controller onboard, eliminating the need for a separate USB chip on boards such as Uno. The Leonardo was less popular than the Uno but found some interesting uses due to features not found in other microcontroller boards. The native USB was very popular with other company/Maker board designers who, to this day, use the ATmega32U4 and the Leonardo software to make compelling microcontroller boards at a low cost.
Arduino Leonardo (photo via arduino.cc)
Sadly the Leonardo has been discontinued by the Arduino team but the use of the ATmega32U4 lives on in many new designs.

The Arduino Due was the Arduino team's first commercial step into the Atmel SAM architecture chips. SAM features an ARM processor, capable of speeds much higher than the Uno/Leonardo 16 MHz and also capable of more flash and other compelling features. The Due, being the first Arduino SAM board did (has) not find (found) a wide following in products or maker projects but it did (has) start software migration of the Arduino software base to use non-AVR chips. (Note: While announced as discontinued, they are still available via arduino.cc).

Note: Yes, I am skipping some Arduino releases here and there which are also AVR based designs.

The Arduino Zero, beta tested in 2014 with release in 2015, has become the new tier for microcontroller designers. Based on the newer Atmel/Microchip SAMD series, the board provides the SAM higher clock rates, ARM core, and a much smaller size.

Microchip recently bought Atmel, hence the processor provider name change.

The Zero has not supplanted the venerable Arduino Uno, yet, but the day draws closer where there are no arguments for selecting the more modern chip. Variants are smaller and much easier for manufacturers to incorporate. The Arduino Zero software is defining a new generation of compatible boards, especially from Adafruit.com which is revising a number of their microcontroller boards to use the SAMD chips. The third party boards are often less expensive than the Zero as the Zero design uses an additional debug hardware chip not used by most hobbyists.

It is conceivable that Microchip may look to discontinue AVR production through price hikes, leaving the SAMD and possibly their own PIC lines more widely available.
Arduino Zero (photo via Adafruit)
Where does the flood of Arduino compatibles leave the Arduino team?  Actually in a fairly good spot. The team are the Research and Development group foremost, providing both the low level chip firmware and the ever more powerful IDE to tap into new chips. The Arduino team continues to bring forward very compelling boards in different form factors: the Arduino Zero, MKR1000, and MKRZero boards have a great amount of capability at a cost lower than the Arduino Uno of old.

The Arduino team also has been collaborating on non-Microchip boards, including Arduino Yun, Arduino 101, and others. They also are important in expanding both the capabilities of the Arduino ecosphere and in partnering with companies other than Microchip to include Intel. The ability to easily use new, powerful microcontrollers and Linux based processors only benefits the ability of both companies and Makers to use the newer processors.

We all can look forward to the growth of the Arduino family tree, which has grown from a seedling over ten years ago. The innovation of the Arduino team has enabled people worldwide to harness some incredible hardware in making incredible products.

Sunday, June 19, 2016

Arduinos, New Arduinos, and Pin Header

With a new crop of Arduino compatible boards in "non-traditional" form factors, you may need to consider what type of header pins you want to use on the boards.

Pin header is typically used for:
  • Easier connection to a breadboard or to connect wires (electrical)
  • Connecting other boards via stacking (mechanical)
Below is the classic Arduino stacking header shield (for prototyping) and that board stacked on an Arduino R3 (right). The shields for the classic Uno R3 are an 8 pin + 10 pin header on top (half-pin space between), and a six pin and 8 pin header opposite (one pin space between, some boards put a nonfunctional header pin between like on the new Arduino Uno WiFi). Boards made since the Arduino Zero have an additional ATN pin on the side closest to the power jack.
Arduino Stacking Shield with female header with long pins (via adafruit.com)
A shield will need long male pins beneath and the Arduino typically has female pins on top to make the connection.  Note the shield above has female pins on top so another shield may be stacked on top of that.  If a shield does not need to have another shield stacked on top, you can use plain male header.
Arduino compatible Feather with long female pins for Breadboard, display "shield" on top with male non-stacking pins (via adafruit.com)
The pictures above demonstrate several things: The Adafruit Feather arduino-compatible board on the left has female header with long male pins to be able to be pressed into a breadboard.  The display on top has regular male pins soldered on.  The picture on the right shows the two types of header.

Mail order companies (Adafruit, Sparkfun, Farnell, eBay, etc.) sell a lot of different types of header for your making use. Male, female short, female long, single row, double row, and header with 90 degree bends. Male header even comes in extra long for certain applications. Header can come in many widths, the most common when buying header alone is in 40 pin pieces/sticks, although vendors will often sell shorter lengths for specific purposes.

A few different types of header (yes there are many more types)
Most header is built with a tenth of an inch spacing between pins (0.1" or 2.54 millimeters metric). For some items like XBee radio and some ESP8266 breakouts, they use 2 mm spacing, and some boards may use other spacings. Be careful on guessing the spacing for certain components, boards, displays, etc. Always measure or count twice.

Now on to some of these new Arduino compatible boards coming out. The header pins in the Arduino R3 pictures are nice but they are usually made for 14 on the short side and 18 on the other side. These will not work on some other boards.  Here are the header pin counts for some modern boards:

Adafruit Feather has 12 pins on one side, 20 on the other

Arduino.cc MKR1000 has 14 pins on both sides

The Adafruit Huzzah ESP8266 Board has 10 pins on either side (they give you a few extra pins in the header strips)

The NodeMCU ESP8266 board has 15 pins on either side

Making Custom Header Widths


If you have header that is longer than the board you need it for, you can usually cut the header pieces to fit. This may also save money, buying 40 pin sticks and cutting to fit your project.

You should wear eye protection and use caution when preparing to cut header, pieces will fly off!!

Use a good pair of diagonal cutters.  Some header, like the male ones, have a groove between pins, making it easy to make a clean cut (often called "breakaway header").  Female header is trickier. Center the cut about in the middle of the next pin after counting out the number you need.  Make a straight cut.  Be careful as the gold pin will fly out

Cutting male header (left) and female header (right).  Via learn.adafruit.com
This will leave that side with a bit of a U shape. You can use good cutters to do further trimming. Then use a file to get a nice smooth edge.

Soldering Header


The secret: Use a breadboard or another board with header pins to hold the board to be soldered in place. Have a hot soldering iron and heat each pad+pin and solder.

learn_arduino_solder5.jpg
Using one board to hold pins for another (via learn.adafruit.com)

With a breadboard, put the pin header in, then the board, then solder.  You can also put a piece of male header in a breadboard to secure a female header to solder onto a board (a good use for the extra-long male header). Be sure the board you are soldering is level, once the solder cools, it is hard to level out.

What are your tips for using header in your projects?

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.

Wednesday, March 2, 2016

Getting Started with the Beta Arduino MKR1000

Note: No, I cannot share the pinout of the MKR1000 beta board (printed on the back of the board) per an email sent to the Hackaday.io contest winners, sorry.  The reason is the pinout might change so making shields right now would lead to heartache.

One thousand Arduino.cc MKR1000 beta boards are now being received by Makers worldwide thanks to a contest sponsored with Hackster.io and Microsoft.  Round Two of their competition is to make some great things.  Here is documentation on how to get started after the box comes in the mail.

1) Go to the e-mail you got days ago stating that you shouldn't release info (doh!).  Sign up for the MKR1000 closed forum on arduino.cc and wait up to 48 hours for the link (doh!).

2) Go to the arduino.cc download site and get the nightly build of the Arduino IDE software.  Copy it into a directory to use out of the zip file.

2a) For Windows users only: go into the drivers directory and run program dpinst-x86.exe for 32 bit Windows or more likely for modern installs dpinst-amd64.exe for 64 bit Windows (Intel or AMD, not just for AMD processors).  This will install the device drivers for the latest Arduino boards including MKR1000.

3) Run the beta Arduino IDE by running arduino.exe.

4) Go to Tools -> Board -> Boards Manager and install the Arduino SAMD Boards package version 1.6.3.  This gives you the MKR1000 as a board choice.  1.6.4 apparently dropped MKR1000.  If the closed MKR1000 forum says differently use what they say.

5) Go to Sketch -> Include Library and do a search for "101".  Install the WiFi 101 library package which supports the MKR1000 wi-fi support. Use version 0.8.0 or higher.

6) Plug in a USB cable A to Mini B from your PC to the board.  For Windows, the appropriate driver should load if you got the beta IDE driver installed ok - if the driver fails, try again to install the driver.

7) You can load the Blink sketch:

void setup() { 
  pinMode(6, OUTPUT);     // Pin 6 is onboard LED on beta MKR1000 

void loop() { 
  digitalWrite(6, HIGH);  // turn the LED on (HIGH is voltage level) 
  delay(500);             // wait for 500ms 
  digitalWrite(6, LOW);   // turn the LED off by making voltage LOW 
  delay(500);             // wait for 500ms 
}

Note the LED on the beta boards is on Digital Pin 6, not the usual Arduino Pin 13.  If all goes well the Green LED marked "L" blinks!

There are more sample programs for advanced use including web client and server under File -> Examples -> WiFi 101. Note the Wifi 101 has its LED on Pin 9 which has to be changed to Pin 6 for MKR1000.  Try the SimpleWebServerWiFi sketch with the LED ad Pin 6, very fun!  You'll need the output from the serial monitor to know the web address for the web page to change the LED state.

Resources on the Internet



Wednesday, December 16, 2015

The Retired Arduinos

Arduino.cc has announced the retirement of some of their products.  This includes some mainstays as well as some specialty products.
Some of the retired Arduino products, more here.
Some of these are expected.  The Mega ADK was a specialty product.  The Arduino WiFi Shield was ill-placed - just over three years ago I called it out as way expensive at $85.  The Leonardo was always more of a concept for using the 32U4 chip.  The design sparked many successful clones but the board itself was not featured in many designs as I tried to find in October 2012.  The Arduino Robot was in a niche - it was a commercialization of support to a European robotics team.  It was very expensive and did not receive much focus from hobbyists.

One product closer to my work is the Arduino Esplora.  Many folks had praised the design, but not many projects came out.  I published some of the first projects including the work on pin outs and compatible displays.  Two things hampered the platform: the insistence of using the Tinkerkit inputs and outputs (which no one used in published projects), and the power requirement via a USB connection (when a battery power option would have been the way to go).  The Tinkerkit issue has also plagued other retired projects including the Robot and the USB Host Shield.


Lessons Learned


If you look at new Arduino.cc offerings, you can see the evolution of Arduino products.  New Arduinos consider LiPo battery use and using more affordable components like ESP8266 based wi-fi modules. Certainly the new MKR1000 board is a welcome addition.  We are in for exciting times ahead.  What are your thoughts?