Adafruit Feather M0 Adalogger Created by lady ada Last updated on 2017-09-08 03:56:21 PM UTC
Guide Contents Guide Contents Overview Pinouts Power Pins Logic pins Micro SD Card + Green LED Other Pins! Assembly Header Options! Soldering in Plain Headers Prepare the header strip: Add the breakout board: And Solder! Soldering on Female Header Tape In Place Flip & Tack Solder And Solder! 14 15 15 17 17 18 19 Power Management Battery + USB Power Power supplies Measuring Battery Average Power Draw w/SD Card ENable pin Arduino IDE Setup https://adafruit.github.
Manually bootloading Ubuntu & Linux Issue Fix Feather HELP! Using the SD Card Example logging sketch Next steps! Adapting Sketches to M0 Analog References Pin Outputs & Pullups Serial vs SerialUSB AnalogWrite / PWM on Feather/Metro M0 analogWrite() PWM range Missing header files Bootloader Launching Aligned Memory Access Floating Point Conversion How Much RAM Available? Storing data in FLASH Downloads Datasheets Schematic Fabrication Print © Adafruit Industries https://learn.adafruit.
Overview Feather is the new development board from Adafruit, and like it's namesake it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores. This is the Adafruit Feather M0 Adalogger - our take on an 'all-in-one' Cortex M0 datalogger (or data-reader) with built in USB and battery charging. Its an Adafruit Feather M0 with a microSD holder ready to rock! We have other boards in the Feather family, check'em out here (http://adafru.
At the Feather M0's heart is an ATSAMD21G18 ARM Cortex M0 processor, clocked at 48 MHz and at 3.3V logic, the same one used in the new Arduino Zero (http://adafru.it/2843). This chip has a whopping 256K of FLASH (8x more than the Atmega328 or 32u4) and 32K of RAM (16x as much)! This chip comes with built in USB so it has USB-to-Serial program & debug capability built in with no need for an FTDI-like chip. © Adafruit Industries https://learn.adafruit.
To make it easy to use for portable projects, we added a connector for any of our 3.7V Lithium polymer batteries and built in battery charging. You don't need a battery, it will run just fine straight from the micro USB connector. But, if you do have a battery, you can take it on the go, then plug in the USB to recharge. The Feather will automatically switch over to USB power when its available.
Comes fully assembled and tested, with a USB bootloader that lets you quickly use it with the Arduino IDE. We also toss in some header so you can solder it in and plug into a solderless breadboard. Lipoly battery, MicroSD card and USB cable not included (but we do have lots of options in the shop if you'd like!) Check out our tutorial for all sorts of details, including schematics, files, IDE instructions, and more! © Adafruit Industries https://learn.adafruit.
Pinouts The Feather M0 Adalogger is chock-full of microcontroller goodness. There's also a lot of pins and ports. We'll take you a tour of them now! © Adafruit Industries https://learn.adafruit.
Power Pins GND - this is the common ground for all power and logic BAT - this is the positive voltage to/from the JST jack for the optional Lipoly battery USB - this is the positive voltage to/from the micro USB jack if connected EN - this is the 3.3V regulator's enable pin. It's pulled up, so connect to ground to disable the 3.3V regulator 3V - this is the output from the 3.3V regulator, it can supply 500mA peak Logic pins This is the general purpose I/O pin set for the microcontroller. All logic is 3.
#20 / SDA - GPIO #20, also the I2C (Wire) data pin. There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup. #21 / SCL - GPIO #21, also the I2C (Wire) clock pin. There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup. #5 - GPIO #5 #6 - GPIO #6 #9 - GPIO #9, also analog input A7.
ARef - the analog reference pin. Normally the reference voltage is the same as the chip logic voltage (3.3V) but if you need an alternative analog reference, connect it to this pin and select the external AREF in your firmware. Can't go higher than 3.3V! SWCLK & SWDIO - These pads on the bottom are used to program the chip. They can also be connected to an SWD debugger. © Adafruit Industries https://learn.adafruit.
Assembly We ship Feathers fully tested but without headers attached - this gives you the most flexibility on choosing how to use and configure your Feather Header Options! Before you go gung-ho on soldering, there's a few options to consider! The first option is soldering in plain male headers, this lets you plug in the Feather into a solderless breadboard © Adafruit Industries https://learn.adafruit.
Another option is to go with socket female headers. This won't let you plug the Feather into a breadboard but it will let you attach featherwings very easily We also have 'slim' versions of the female headers, that are a little shorter and give a more compact shape © Adafruit Industries https://learn.adafruit.
Finally, there's the "Stacking Header" option. This one is sort of the best-of-both-worlds. You get the ability to plug into a solderless breadboard and plug a featherwing on top. But its a little bulky Soldering in Plain Headers Prepare the header strip: Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard - long pins down © Adafruit Industries https://learn.adafruit.
Add the breakout board: Place the breakout board over the pins so that the short pins poke through the breakout pads And Solder! Be sure to solder all pins for reliable electrical contact. (For tips on soldering, be sure to check out ourGuide to Excellent Soldering (http://adafru.it/aTk)). © Adafruit Industries https://learn.adafruit.
Solder the other strip as well. You're done! Check your solder joints visually and continue onto the next steps © Adafruit Industries https://learn.adafruit.
Soldering on Female Header Tape In Place For sockets you'll want to tape them in place so when you flip over the board they don't fall out © Adafruit Industries https://learn.adafruit.
Flip & Tack Solder After flipping over, solder one or two points on each strip, to 'tack' the header in place © Adafruit Industries https://learn.adafruit.
And Solder! Be sure to solder all pins for reliable electrical contact. (For tips on soldering, be sure to check out ourGuide to Excellent Soldering (http://adafru.it/aTk)). You're done! Check your solder joints visually and continue onto the next steps © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
Power Management Battery + USB Power We wanted to make the Feather easy to power both when connected to a computer as well as via battery. There's two ways to power a Feather. You can connect with a MicroUSB cable (just plug into the jack) and the Feather will regulate the 5V USB down to 3.3V. You can also connect a 4.2/3.7V Lithium Polymer (Lipo/Lipoly) or Lithium Ion (LiIon) battery to the JST jack. This will let the Feather run on a rechargable battery.
The above shows the Micro USB jack (left), Lipoly JST jack (top left), as well as the 3.3V regulator and changeover diode (just to the right of the JST jack) and the Lipoly charging circuitry (to the right of the Reset button). There's also a CHG LED, which will light up while the battery is charging. This LED might also flicker if the battery is not connected.
the battery needs recharging. Lipoly batteries are 'maxed out' at 4.2V and stick around 3.7V for much of the battery life, then slowly sink down to 3.2V or so before the protection circuitry cuts it off. By measuring the voltage you can quickly tell when you're heading below 3.7V To make this easy we stuck a double-100K resistor divider on theBAT pin, and connected it to D9 (a.k.a analog #7 A7). You can read this pin's voltage, then double it, to get the battery voltage.
for (i=0; i
pinMode(8, OUTPUT); Serial.println("Ready!"); } uint8_t i=0; void loop() { digitalWrite(8, HIGH); logfile.print("A0 = "); logfile.println(analogRead(0)); Serial.print("A0 = "); Serial.println(analogRead(0)); digitalWrite(8, LOW); delay(100); } adalogger.ino hosted with ❤ by GitHub view raw You'll draw 11mA or so for 100ms during the delay(100) line. Since we blink the pin #8 LED, we'll also get a 11mA blip for about 10ms.
If you'd like to turn off the 3.3V regulator, you can do that with theEN(able) pin. Simply tie this pin to Ground and it will disable the 3V regulator. The BAT and USB pins will still be powered © Adafruit Industries https://learn.adafruit.
Arduino IDE Setup The first thing you will need to do is to download the latest release of the Arduino IDE. You will need to be using version 1.8 or higher for this guide Arduino IDE Download http://adafru.it/f1P After you have downloaded and installed the latest version of Arduino IDE, you will need to start the IDE and navigate to the Preferences menu. You can access it from theFile menu in Windows or Linux, or the Arduino menu on OS X. A dialog will pop up just like the one shown below.
We will be adding a URL to the newAdditional Boards Manager URLs option. The list of URLs is comma separated, and you will only have to add each URL once. New Adafruit boards and updates to existing boards will automatically be picked up by the Board Manager each time it is opened. The URLs point to index files that the Board Manager uses to build the list of available & installed boards.
Here's a short description of each of the Adafruit supplied packages that will be available in the Board Manager when you add the URL: Adafruit AVR Boards - Includes support for Flora, Gemma, Feather 32u4, Trinket, & Trinket Pro. Adafruit SAMD Boards - Includes support for Feather M0, Metro M0, Circuit Playground Express, Gemma M0 and Trinket M0 Arduino Leonardo & Micro MIDI-USB - This adds MIDI over USB support for the Flora, Feather 32u4, Micro and Leonardo using the arcore project (http://adafru.it/eSI).
Using with Arduino IDE Since the Feather/Metro/Gemma/Trinket M0 use an ATSAMD21 chip running at 48 MHz, you can pretty easily get it working with the Arduino IDE. Most libraries (including the popular ones like NeoPixels and display) will work with the M0, especially devices & sensors that use i2c or SPI. Now that you have added the appropriate URLs to the Arduino IDE preferences in the previous page, you can open the Boards Manager by navigating to the Tools->Board menu.
Install Adafruit SAMD Next you can install the Adafruit SAMD package to add the board file definitions You can type Adafruit SAMD in the top search bar, then when you see the entry, clickInstall Even though in theory you don't need to - I recommend rebooting the IDE Quit and reopen the Arduino IDE to ensure that all of the boards are properly installed. You should now be able to select and upload to the new boards listed in the Tools->Board menu.
When you plug in the board, you'll need to possibly install a driver Click below to download our Driver Installer Download Adafruit Driver Installer v1.5 http://adafru.it/yDr Download and run the installer Run the installer! Since we bundle the SiLabs and FTDI drivers as well, you'll need to click through the license Select which drivers you want to install, the defaults will set you up with just about every Adafruit board! © Adafruit Industries https://learn.adafruit.
Click Install to do the installin' Blink Now you can upload your first blink sketch! Plug in the Gemma M0, Trinket M0, Metro M0 or Feather M0 and wait for it to be recognized by the OS (just takes a few seconds). It will create a serial/COM port, you can now select it from the dropdown, it'll even be 'indicated' as Trinket/Gemma/Metro/Feather M0! Now load up the Blink example // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output.
If you are having issues, make sure you selected the matching Board in the menu that matches the hardware you have in your hand. Sucessful Upload If you have a successful upload, you'll get a bunch of red text that tells you that the device was found and it was programmed, verified & reset Compilation Issues If you get an alert that looks like Cannot run program "{runtime.tools.arm-none-eabi-gcc.path}\bin\arm-non-eabi-g++" Make sure you have installed the Arduino SAMD boards package, you need both Arduino
Manually bootloading If you ever get in a 'weird' spot with the bootloader, or you have uploaded code that crashes and doesn't auto-reboot into the bootloader, click the RST button twice (like a double-click)to get back into the bootloader. The red LED will pulse, so you know that its in bootloader mode. Once it is in bootloader mode, you can select the newly created COM/Serial port and re-try uploading.
Feather HELP! My Feather stopped working when I unplugged the USB! A lot of our example sketches have a while (!Serial); line in setup(), to keep the board waiting until the USB is opened. This makes it a lot easier to debug a program because you get to see all the USB data output.
I can't get the Feather USB device to show up - I get "USB Device Malfunctioning" errors! This seems to happen when people select the wrong board from the Arduino Boards menu. If you have a Feather 32u4 (look on the board to read what it is you have) Make sure you selectFeather 32u4 for ATMega32u4 based boards! Do not use anything else, do not use the 32u4 breakout board line.
When the user COM port disappears, Arduino will not be able to automatically start the bootloader and upload new software.
Using the SD Card Once you have your Feather working, you probably want to rock out with some SD card reading and writing! Luckily, the Arduino IDE has an SD card library that works great, and it even comes with the IDE! You can start with CardInfo which is very detailed Luckily many of the default examples already havechipSelect = 4 For other sketches, do check to make sure that CS is set to 4! The SD card uses hardware SPI for the remaining pins. Make sure you have Adafruit SAMD board package version 1.
SD card) and Dumpfile example (reading back data from an SD card) Example logging sketch If you want to try saving data to the SD card in the simplest sketch, try this example. You can adjust thedelay() to set how often analog data is read from pin A0 and saved to the SD card. The red LED will blink if there's an error, and the green LED will blink when data is written to the SD card.
char filename[15]; strcpy(filename, "ANALOG00.TXT"); for (uint8_t i = 0; i < 100; i++) { filename[6] = '0' + i/10; filename[7] = '0' + i%10; // create if does not exist, do not open existing, write, sync after write if (! SD.exists(filename)) { break; } } logfile = SD.open(filename, FILE_WRITE); if( ! logfile ) { Serial.print("Couldnt create "); Serial.println(filename); error(3); } Serial.print("Writing to "); Serial.println(filename); pinMode(13, OUTPUT); pinMode(8, OUTPUT); Serial.
Adapting Sketches to M0 The ATSAMD21 is a very nice little chip but its fairly new as Arduino-compatible cores go.Most sketches & libraries will work but here's a few things we noticed! The below note are for all M0 boards, but not all may apply (e.g. Trinket and Gemma M0 do not have ARef so you can skip the Analog References note!) Analog References If you'd like to use the ARef pin for a non-3.
AnalogWrite / PWM on Feather/Metro M0 After looking through the SAMD21 datasheet, we've found that some of the options listed in the multiplexer table don't exist on the specific chip used in the Feather M0. For all SAMD21 chips, there are two peripherals that can generate PWM signals: The Timer/Counter (TC) and Timer/Counter for Control Applications (TCC). Each SAMD21 has multiple copies of each, called 'instances'. Each TC instance has one count register, one control register, and two output channels.
analogWrite() PWM range On AVR, if you set a pin's PWM withanalogWrite(pin, 255) it will turn the pin fully HIGH. On the ARM cortex, it will set it to be 255/256 so there will be very slim but still-existing pulses-to-0V. If you need the pin to be fully on, add test code that checks if you are trying to analogWrite(pin, 255) and, instead, does a digitalWrite(pin, HIGH) Missing header files there might be code that uses libraries that are not supported by the M0 core.
Floating Point Conversion Like the AVR Arduinos, the M0 library does not have full support for converting floating point numbers to ASCII strings. Functions like sprintf will not convert floating point. Fortunately, the standard AVR-LIBC library includes the dtostrf function which can handle the conversion for you. Unfortunately, the M0 run-time library does not have dtostrf. You may see some references to using#include to get dtostrf in your code. And while it will compile, it doesnot work.
Downloads Datasheets ATSAMD21 Datasheet (http://adafru.it/kUf) (the main chip on the Feather M0) Pinout note: The RX and TX pins are known asSerial1 PCB Files on GitHub (http://adafru.it/obn) Fritzing object in the Adafruit Fritzing Library (http://adafru.it/aP3) Feather M0 Adalogger Pinout Diagram http://adafru.it/z3e Schematic Click to enlarge Fabrication Print Dimensions in inches © Adafruit Industries https://learn.adafruit.
© Adafruit Industries Last Updated: 2017-09-08 03:56:20 PM UTC Page 47 of 47