MicroMod Main Board Hookup Guide V2
2024-02-16 | By SparkFun Electronics
License: See Original Project MicroMod
Courtesy of SparkFun
Guide by BBOYHO, ELIAS THE SPARKIEST
Introduction
Note: This tutorial is for the MicroMod Main Board - Single V2.1 and Double V2.2. For users with the older versions of the Main Boards, make sure to check out the older tutorial.
The MicroMod Main Board - Single and Double are specialized carrier boards that allow you to interface a Processor Board with a Function Board(s). The modular system allows you to add an additional feature(s) to a Processor Board with the help of a Function Board(s).
Required Materials
To follow along with this tutorial, you will need the following materials at a minimum. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart, as necessary.
Minimum Wishlist with MicroMod Main Board - Single SparkFun Wish List
- Reversible USB A to C Cable - 2m
- SparkFun MicroMod Artemis Processor
- microSD Card - 1GB (Class 4)
- SparkFun MicroMod Environmental Function Board
- SparkFun MicroMod Main Board - Single
- SparkFun Mini Screwdriver
VIEW MINIMUM WISHLIST WITH MICROMOD MAIN BOARD - SINGLE ON SPARKFUN.COM
MicroMod Main Board
To hold the Processor and Function boards, you will need one Main Board. Depending on your application, you may choose to have either one or two Function Boards.
MicroMod Processor Board
There are a variety of MicroMod Processor Boards available to choose from. You will probably want to avoid having the same Processor and Function Board since there is an ESP32 on both types of boards.
- SparkFun MicroMod SAMD51 Processor
- SparkFun MicroMod STM32 Processor
- SparkFun MicroMod mikroBUS Starter Kit
- SparkFun Arduino IoT Weather Station
MicroMod Function Board
To add additional functionality to your Processor Board, you'll want to include one or two Function Boards when connecting them to the Main Board. Make sure to check out the catalog for other function boards.
- SparkFun MicroMod Single Pair Ethernet Function Board - ADIN1110
- SparkFun MicroMod GNSS Function Board - NEO-M9N
- SparkFun MicroMod Environmental Function Board
- SparkFun MicroMod WiFi Function Board - ESP32
Tools
You will need a screwdriver to secure the Processor and Function Boards. The MicroMod Screwdriver is an excellent option for those looking for a low-cost tool. The SparkFun Mini Screwdriver and Pocket Screwdriver Set can work as well. For users using a microSD card and want to easily read the contents of the memory card, you will need a microSD card adapter or USB reader.
Suggested Reading
If you aren't familiar with the MicroMod ecosystem, we recommend reading here for an overview. We recommend reading here for an overview if you decide to take advantage of the Qwiic connector.
MicroMod Ecosystem Qwiic Connect System
If you aren’t familiar with the following concepts, we also recommend checking out a few of these tutorials before continuing. Make sure to check the respective hookup guides for your Processor board and Function Board to ensure that you are installing the correct USB-to-serial converter. You may also need to follow additional instructions that are not outlined in this tutorial to install the appropriate software.
- What is an Arduino? What is this 'Arduino' thing anyway? This tutorial dives into what an Arduino is and along with Arduino projects and widgets.
- Installing Arduino IDE: A step-by-step guide to installing and testing the Arduino software on Windows, Mac, and Linux.
- How to Install CH340 Drivers: How to install CH340 drivers (if you need them) on Windows, Mac OS X, and Linux.
- Getting Started with MicroMod: Dive into the world of MicroMod - a compact interface to connect a microcontroller to various peripherals via the M.2 Connector!
Hardware Overview
The overall functionality of the Single and Double Main Boards are the same. We'll use the Single Main Board more in this section to highlight the features since this is also included in the Double Main Board. We'll switch to the Double Main Board when necessary to highlight the features that are only included in the Double Main Board.
The differences are that the Double Main Board includes:
- 3x switches
- two for the 3.3V power enable pins
- one for the secondary SPI CS pin
- ability to add a second MicroMod Function Board to the mix
- board's width
Main Board - Single V2.1
Main Board - Double V2.2
Revision Changes
The following changes to the Main Board Single V2.1 and Main Board Double V2.2 include:
- Rotate silkscreen for the connectors and a majority of the labels.
- Add TVS diodes for ESD protection on the USB pins.
- Add SHLD jumper to isolate the USB Type C connector's shield pin.
- Add a 5V MEAS PTH jumper as a measurement for 5V.
- Remove the 500mA/100mA selector for the LiPo charge circuit. The board now charges at a default rate of 500mA only.
- Add a DIVIDER jumper to remove the resistor divider that is connected to processor's "BATT_VIN/3" pin for low power applications.
- Add a dedicated 3.3V/500mA voltage regulator for the Qwiic port.
- Add GPIO control of 3.3V voltage regulator (I2C_SCL1-Processor.)
- Add a LED for the 3.3V Qwiic port with a QWIIC LED jumper to disable.
- Add a transistor to disable power to the microSD socket (can be controlled using I2C_SCL1-Processor.)
- Add multiplexed primary UART pins to send serial data to Function Board(s).
- Add PTH pins for multiplexed UART (Main Board Single v2.1 only.)
- Move PWR_EN0 from SDIO_Data2_Processor to PWM1 (Main Board - Single v2.1 only.)
- Add two 2.2kΩ I2C pull-ups to the primary I2C pins with jumpers (I2C) to disable.
- Replace male header pins and 2-pin shunt with SMD switches to adjust the Function Board Power enable pins (Main Board - Double v2.2 only.)
- Add option to adjust Function Board One's secondary SPI CS pin (i.e., "CS1-processor" and "A1-processor") with a SMD switch (Main Board - Double V2.2 only.)
Note: Outboard Device Firmware Updates only work with the STM32 Processor Board v20 and Cellular Function Board - Blues Wireless Notecarrier on either the SparkFun MicroMod Main Board - Single V2.1 or the SparkFun MicroMod Main Board - Double V2.2. Other Processors may be supported in the future but are beyond the scope of this tutorial.
Power
There are two ways to power the Main Boards, Processor Board, and Function Board(s).
- USB
- Single Cell LiPo Battery
It is fine to connect a power source to the USB connector and LiPo battery's JST connector at the same time. The MicroMod Main Board has power-control circuitry to automatically select the best power source.
Power USB
One option of powering the board is through the USB Type C connector. You will need a USB Type C cable to power the board with 5V. Power connected to the board's USB C connector will go through a resettable PTC fuse (rated at 2A max) and then the AP7361C 3.3V voltage regulator (rated at 1A max). The little green component close to the USB connector is the resettable PTC fuse while the square IC is the voltage regulator. The voltage regulator accepts voltages between ~2.2V to 6.0V. For Main Boards V2+, there are now ESD protection diodes (the 6-pin IC next to the fuse) on the USB data lines. There is also now an additional AP7347DQ 3.3V voltage regulator (rated at 500mA) for the Qwiic connectors. The voltage regulator accepts voltages between ~1.7V to 5.5V.
Power LiPo
The other option is to connect a single cell LiPo battery (i.e., nominal 3.7V, 4.2V fully charged) to the 2-pin JST connector as shown below. For users interested in soldering headers, wire, or measuring a LiPo battery, the VBAT and GND is broken out next to the connector. A MCP73831 charge IC is included on the boards to safely charge the LiPo batteries via USB Type C connector. A corresponding status LED (labeled as CHG, not highlighted in the image below) will indicate when the board is charging or is fully charged. More information on the LED status is highlighted in the LEDs section. For Main Boards V2+, the default charge rate is now set to 500mA only. We recommend that users only use a single cell LiPo battery with a capacity of 500mAh or higher to safely charge the battery. There is also a small cutout on the edge of the board allowing users to place a LiPo battery underneath the board if they decide to place the board in an enclosure.
The voltage from the LiPo battery is then regulated down to 3.3V as it goes through the AP7361C 3.3V voltage regulator (rated at 1A max) for the rest of the board. The voltage is regulated down to 3.3V as it goes through the Qwiic connector's AP7347DQ 3.3V voltage regulator (rated at 500mA max) as well.
Note: For more information on proper handling of LiPo batteries, check out the LilyPad Basics: Powering Your Project - LiPo Battery Safety Care.
MicroMod Processor Board
The MicroMod ecosystem allows you to easily swap out processors depending on your application. The location of the M.2 connector labeled as Processor is where you would connect and secure a MicroMod Processor Board.
MicroMod Function Board
Beside the MicroMod Processor's socket is another M.2 connector for MicroMod Function Boards, which allow you to add additional functionality to your Processor Board. The Single Main Board includes one M.2 connector for a single Function Board while the Double Main Board includes two M.2 connectors for up two Function Boards.
Main Board - Single Function Board Location
Main Board - Double Function Board Location
Reset and Boot Buttons
Each board includes one button for the RESET and another button for the BOOT. There is an additional reset and GND PTH pin next to the reset button. Hitting the reset button will restart your Processor Board. Hitting the boot button will put the Processor Board into a special boot mode. Depending on the Processor Board, this boot pin may not be connected.
SWD Pins
For advanced users, we broke out the 2x5 SWD programming pins. Note that this is not populated so you will need a compatible header and compatible JTAG programmer to connect.
MicroSD Card Socket
The board includes a microSD socket if your application requires you to log and save data to a memory card. The primary SPI pins (SDO, SDI, SCK) from your Processor and Function Board are connected to the microSD card socket. The pin for the microSD card socket is different on each board:
- The MicroMod Main Board - Single v2.1 is on Processor Board's pin D1.
- The MicroMod Main Board - Double v2.2 is on Processor Board's pin G4.
For Main Boards V2+, there is a transistor (the tiny three pin IC below the microSD card socket) to toggle power to the microSD card socket's VCC pin. This is connected the Processor Board's secondary I2C clock pin (i.e., "I2C_SCL1") and is active low. For users using the Main Boards in low power applications, you can define the pin and set it to a logic HIGH to disconnect power connected to the microSD card socket. Setting the pin to a logic LOW will power the microSD card socket. Just make sure to close the file to avoid any corrupt data.
LEDs
There are four LEDs on the board:
- VIN - The VIN LED lights up to indicate when power available from the USB connector.
- QWC - The QWC LED lights up to indicate when there is a 3.3V available to the Qwiic connector after power is regulated down from the USB connector or LiPo battery. This is a new feature that was added in Main Boards v2+.
- 3V3 - The 3V3 LED lights up to indicate when there is a 3.3V available for the MicroMod Processor Board and Function Boards after power is regulated down from the USB connector or LiPo battery.
- CHG - The on-board yellow CHG LED can be used to get an indication of the charge status of your battery. Below is a table of other status indicators depending on the state of the charge IC.
Jumpers
Note: If this is your first time working with jumpers, check out the How to Work with Jumper Pads and PCB Traces tutorial for more information.
The following ten jumpers are included on both the Single and Double Main Boards.
- SHLD - By default, the jumper is closed and located on the bottom side of the board. This jumper connects the USB Type C connector's shield pin to GND. Cut this to isolate the USB Type C connector's shield pin. This is a new feature that was added in Main Boards v2+.
- 5V5 MEAS - By default, the jumper is closed and located on the top side of the board. This jumper is used to measure your system's current consumption. You can cut this jumper's trace and connect the PTHs to a ammeter/multimeter to probe the input into the 3.3V voltage regulator. Check out our How to Use a Multimeter tutorial for more information on measuring current. This is a new feature that was added in Main Boards V2+.
- 3V3 MEAS - By default, the jumper is closed and located on the top side of the board. This jumper is used to measure your system's current consumption. You can cut this jumper's trace and connect the PTHs to a ammeter/multimeter to probe the output from the 3.3V voltage regulator.
- PTC - By default, the jumper is open and located on the bottom of the board. For advanced users, add a solder blob to the jumper to bypass the resettable PTC fuse to pull more than 2A from the USB source.
- 3V3 EN - By default, this jumper is open and located on the bottom of the board. Closing this jumper enables processor control of the 3.3V bus.
- VIN LED - By default, this jumper is closed and located on the bottom of the board. Cut this trace to disable the LED that is connected to the input of the USB.
- QWIIC LED - By default, this jumper is closed and located on the bottom of the board. Cut this trace to disable the LED that is connected to the output of the Qwiic connector's 3.3V voltage regulator. This is a new feature that was added in Main Boards V2+.
- 3V3 LED - By default, this jumper is closed and located on the bottom of the board. Cut this trace to disable the LED that is connected to the output of the 3.3V voltage regulator.
- DIVIDER - By default, this jumper is closed and located on the bottom of the board. This is connected to processor's "BATT_VIN/3" pin. This is for advanced users that want to remove the resistor divider in low power applications.
- I2C - By default, this 3-pad jumper is closed by default and located on the bottom of the board. The 2.2kΩ pull-up resistors are attached to the primary I2C bus; if multiple devices are connected to the bus with the pull-up resistors enabled, the parallel equivalent resistance will create too strong of a pull-up for the bus to operate correctly. As a general rule of thumb, disable all but one pair of pull-up resistors if multiple devices are connected to the bus. This is a new feature that was added in Main Boards V2+.
Main Board - Single Top View Jumpers
Main Board - Single Bottom View Jumpers
Switches
Certain processors have limited GPIO (e.g., SAMD51, ESP32, and STM32 to name a few) and so these alternative powers enable pins to have been provided. The previous version of the Main Board Double used male jumper pins and 2-pin shunts for each Function Board power enable pin. For the Main Board Double v2.2, these are now replaced with SMD switches. There is an additional switch for the CS pin for users that require the use of more than one SPI chip select pin. Simply move the switch toward the side that fits your project's needs. The list below explains where the pins are routed when the switch set to each side. Make sure to check the hookup guide for your Processor and Function Board for more information about the pin definitions.
- G6
- EN1_ALT - Setting the G5 switch toward the EN1_ALT position will route the Processor Board's G6 to SDIO_DATA1. As stated earlier, this is needed for Processor Boards that do not have a SDIO_DATA1 pin. Thus, a general-purpose pin was used as an alternative pin.
- G6 PROC - Setting the switch toward the G6 PROC position will route the Processor Board's G6 pin to the Function Board One's general-purpose pin (i.e., FC1's "F4" pin.)
- G5
- EN0_ALT - Setting the G5 switch toward the EN0_ALT position will route the Processor Board's G5 to SDIO_DATA2. As stated earlier, this is needed for Processor Boards that do not have a SDIO_DATA2 pin. Thus, a general-purpose pin was used as an alternative pin.
- G5 PROC - Setting the switch toward the G5 PROC position will route the Processor Board's G5 pin to the Function Board One's general-purpose pin (i.e., FC1's "F3" pin.)
- CS
- CS_ALT - Setting the CS switch toward the CS_ALT position will route the Processor Board's secondary SPI chip select pin pin to A1. As stated earlier, this is needed for Processor Boards that do not have a SDIO_DATA3 pin. In this case, an analog pin was used for the alternative pin.
- CS DEF - Setting the switch toward the CS DEF position will route the Processor Board's CS1 pin to the Function Board One's chip select pin (i.e., FC1's "F1/" pin.)
Multiplexed Primary UART
For Main Boards V2+, a multiplexer was added after the Processor Board's primary UART pins (i.e., TX1 and RX1). Most users will not need to worry about using the multiplexer, which should be connected to Function Card 0's default UART pins (i.e., FC0's "Rx" and "TX" pins.)
MicroMod Main Board - Single Mux and PTH Pins
MicroMod Main Board - Double Mux
For those that have certain Function Boards that require device firmware updates (DFU), users will need to configure the multiplexer's input pins "1IN" and "2IN" by pulling either pin low. Setting "1IN" to LOW will route primary UART lines to Function Card Zero's multiplexed pins (i.e., FC0's "DFU_FC_TX and "DFU_FC_RX" pins). Setting "2IN" to LOW will route primary UART lines to Function Card One's multiplexed pins (i.e., FC1's "DFU_FC_TX and "DFU_FC_RX" pins). The MicroMod Cellular Function Board - Blues Wireless Notecarrier is one board that takes advantage of this feature. Since the Main Board Single V2.1 only has one location for a Function Board, the second set of multiplexed pins are broken out to a row of PTH pins (i.e., GND, , RXI, TXO). Below is the truth table for the multiplexer. For more information, make sure to check out the respective schematics to view where the pins are connected.
Screenshot of the UART Multiplexer from the Main Board Single V2.1 Schematic
Screenshot of the UART Multiplexer from the Main Board Double V2.2 Schematic
Qwiic and I2C
The board includes a vertical and horizontal Qwiic connector. These are connected to the primary I2C bus on both the Processor and Function Board connectors allowing you to easily add a Qwiic-enabled device to your application. For Main Boards that are V2+, the 3.3V pin is connected to its own dedicated 3.3V voltage regulator as explained earlier. The I2C data and clock lines are also tied to 2.2kΩ pull-up resistors.
Note: Not highlighted are the Processor Board's secondary I2C pins. Note that the "I2C_SCL1" pin is also connected to the Qwiic connector's 3.3V voltage regulator (i.e., "QWIIC_EN"). Additionally, the I2C_SDA1 is connected to the microSD card socket's transistor to toggle power (i.e., ).
Note that there are two mounting holes for Qwiic-enabled boards that have a standard 1.0"x1.0" size board. The image below highlighted with a black square is where you would place the board.
MicroMod Pinout
Depending on your window size, you may need to use the horizontal scroll bar at the bottom of the table to view the additional pin functions. Note that the M.2 connector pins on opposing sides are offset from each other as indicated by the bottom pins where it says (Not Connected)*. There is no connection to pins that have a "-" under the primary function.
MICROMOD MAIN BOARD - SINGLE
MICROMOD MAIN BOARD - DOUBLE
MICROMOD GENERAL FUNCTION BOARD
MICROMOD GENERAL PROCESSOR BOARD
MICROMOD GENERAL PIN DESCRIPTIONS
Low Power Considerations
For users using the Main Board for low power applications, there are a few methods to reduce power for your system. It was briefly explained earlier but we will compile a short list as shown below. The first would be to disable the status LEDs by cutting the jumpers on the back of the board. Of course, you could also disable the LEDs on any Qwiic-enabled boards that are connected as well. Using a Processor Board's GPIO, you could also toggle the voltage regulator on the Qwiic port and Function Boards when not in use. For users with Main Boards V2+, you could toggle power on the microSD card socket by pulling the transistor low using a GPIO.
- Manually disable the LEDs by cutting the following jumpers
- VIN LED
- 3V3 LED
- Qwiic LED
- Manually disabling any LEDs on any Qwiic-enabled boards used with the Main Boards
- GPIO control of the following
- Qwiic"s voltage regulator
- Voltage Enable on the Function Board (EN0 and EN1)
- Transistor connected to the microSD card socket VCC pin
Dimensions
The board dimension of the MicroMod Main Board - Single V2.1 is 2.90" x 3.40" while the MicroMod Main Board - Double v2.2 is 2.90" x 4.90". Both boards include 5x mounting holes. Four are located on the edge of each board. The fifth mounting hole is located 0.80" away from another mounting hole to mount Qwiic-enabled boards that have the standard 1.0"x1.0" size board.
MicroMod Main Board - Single
MicroMod Main Board - Double
Note: You'll notice that the Main Boards have the USB C connector, microSD card socket, and Qwiic connector on one side of the board. This is part of the design for users that decide to place the MicroMod Main Board in an enclosure!
Hardware Hookup
If you have not already, make sure to check out the Getting Started with MicroMod: Hardware Hookup for information on inserting your Processor and Function Boards to the Main Board.
Dive into the world of MicroMod - a compact interface to connect a microcontroller to various peripherals via the M.2 Connector!
USB
To program and power the Main Board, you will need to insert the USB-C cable into the USB connector. We will leave the other end disconnected when connecting a Processor or Function board to the Main Board.
When the boards are secure, insert the other end to a computer. When you are finished programming the processor, you can use a USB battery via the USB connector or LiPo battery via the JST connector to power the board.
Processor Board
Align the Processor Board's key into its M.2 connector's socket. Insert the board at an angle (~25°), push down, and tighten the screw. In this case, we had the MicroMod Artemis Processor Board secured in the M.2 connector socket. Depending on your application, you may have a different Processor Board.
Function Boards
Align the Function Board's key into its M.2 connector's socket. Insert the board at an angle (~25°), push down, and tighten one of the screws to hold the board down. Attach the second screw on the other side of the board. Once the board is aligned, tighten both screws fully to secure the board.
In this case, we had the Environmental Function Board secured in the M.2 connector socket. Depending on your application, you may have a different Function Board.
If you decide to have two function boards attached to the Main Board - Double, we recommend tightening the screw between the two Function Boards first to hold them down before attaching the remaining screws on either side of the Function Boards. Again, once the boards are aligned, tighten all three screws fully to secure the board. In this case, we had the Single Pair Ethernet Function Board and the Environmental Function Board secured in the M.2 connector sockets. Depending on your application, you may have different function boards.
Once the Function Boards are secure, attach any remaining cables, antennas, or components that your application may need. In this case, we would have attached a Single Pair Ethernet cable to the SPE Function Board.
Attach Any Additional Cables and Antennas
Single Cell LiPo Battery
For mobile applications, attach a single cell LiPo battery to the 2-pin JST connector. Attach a USB cable to a USB port or charger when the battery is low to begin charging.
To remove the LiPo battery, you can pull the white JST connector away from the socket while also wiggling the connector side to side using your thumb and index finger.
Note: For more information on proper handling of LiPo batteries, check out the LilyPad Basics: Powering Your Project - LiPo Battery Safety Care.
Qwiic-Enabled Devices
To Qwiic-ly connect I2C devices, simply insert a Qwiic cable between one of the MicroMod Main Board's Qwiic ports and your Qwiic device. Of course, you can also daisy chain boards for applications that require more than one Qwiic-enabled device.
If you need to mount a Qwiic-enabled board to the MicroMod Main Board, you can grab some standoffs and mount a standard Qwiic 1.0"x1.0" sized board using the two mounting holes near the USB Type C connector. Place the standoff between the boards and tighten the screws to mount. The image below used standoffs with built-in threads.
MicroSD Card
With power removed from the board, insert a microSD card (with the pins facing toward the board) into the socket. You'll hear a nice click indicating that the microSD card is locked in place.
To remove, make sure power is off and press the microSD card into the socket to eject. You'll hear a nice click indicating that the card is ready to be removed from the socket.
Software Installation
Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first-time using Arduino, please review the following tutorials.
- Installing the Arduino IDE
- Installing Board Definitions in the Arduino IDE
- Installing an Arduino Library
Arduino Board Definitions and Driver
We'll assume that you installed the necessary board files and drivers for your Processor Board. In this case, we used the MicroMod Artemis Processor Board which uses the CH340 USB-to-serial converter. If you are using a different Processor Board, make sure to check out its hookup guide for your Processor Board.
Installing Board Definitions in the Arduino IDE
SEPTEMBER 9, 2020
How do I install a custom Arduino board/core? It's easy! This tutorial will go over how to install an Arduino board definition using the Arduino Board Manager. We will also go over manually installing third-party cores, such as the board definitions required for many of the SparkFun development boards.
MicroMod Artemis Processor Board Hookup Guide
Get started with the Artemis MicroMod Processor Board in this tutorial!
How to install CH340 drivers (if you need them) on Windows, Mac OS X, and Linux.
Arduino Examples
Let's go over a few basic examples to get started with the MicroMod Main Board Single and Double. We'll toggle the 3.3V voltage regulators and log data to a microSD card on both boards.
Example 1: MicroMod Main Board - Single Enable Function Board
If you have not already, select your Board (in this case the MicroMod Artemis), and associated COM port. Copy and paste the code below in your Arduino IDE. Hit the upload button.
/******************************************************************************
WRITTEN BY: Ho Yun "Bobby" Chan
@ SparkFun Electronics
UPDATED: 1/3/2023
DATE: 10/19/2021
GITHUB REPO: https://github.com/sparkfun/SparkFun_MicroMod_Main_Board_Single
DEVELOPMENT ENVIRONMENT SPECIFICS:
Firmware developed using Arduino IDE v1.8.12
========== DESCRIPTION==========
This example code toggles the Function Board's AP2112 3.3V voltage
regulator's enable pin. The Function Boards built-in power LED should blink.
This example is based on Arduino's built-in Blink Example:
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
Note that this example code uses the MicroMod Main Board - Single. The MicroMod
Main Board - Double routes the PWR_EN# pins slightly different for the
two function boards.
========== HARDWARE CONNECTIONS ==========
MicroMod Artemis Processor Board => MicroMod Main Board - Single => Function Board
Feel like supporting open source hardware?
Buy a board from SparkFun!
MicroMod Artemis Processor Board - https://www.sparkfun.com/products/16401
MicroMod Main Board - Single - https://www.sparkfun.com/products/20748
MicroMod Environmental Function Board - https://www.sparkfun.com/products/18632
LICENSE: This code is released under the MIT License (http://opensource.org/licenses/MIT)
******************************************************************************/
/*Define the power enable pins for the processor board with either SDIO_DATA2 or A1.
Depending on the processor board, the Arduino pin may be different.
Note: For MicroMod Main Board - Single v2.1, there is now only one GPIO available
to toggle the Power Enable 0 (PWR_EN0) pin. The previous defines for a few
Processor Boards are still available for those that have v1.1.
For MicroMod Main Board - Single v1.1, certain Processor Boards like the
Artemis have SDIO_DATA2 and A1 available to control the Function Board's
voltage regulator. SAMD51, ESP32, and STM32 Processor Board pins do not
have SDIO_DATA2, so users will need to reference the Processor Pin A1.
Below are a few examples.*/
//==========ARTEMIS==========
//Function Board 0's "PWR_EN0" pin <= MicroMod Main - Single v2.1 PWM1 => Artemis Processor Board (D45)
#define PWR_EN0 45
//Function Board 0's "PWR_EN0" pin <= MicroMod Main - Single v1.1 SDIO_DATA2 => Artemis Processor Board (D4)
//#define PWR_EN0 4
//Alternative option that does the same thing. Make sure to just choose one for PWR_EN0
//Function Board 0's "PWR_EN0" pin <= MicroMod Main - Single v1.1 A1 => Artemis Processor Board (A35)
//#define PWR_EN0 35
//==========TEENSY==========
//Function Board 0's "PWR_EN0" pin <= MicroMod Main- Single v2.1 PWM1 => Teensy Processor Board (2)
//#define PWR_EN0 2
//Function Board 0's "PWR_EN0" pin <= MicroMod Main - Single v1.1 SDIO_DATA2 => Teensy Processor Board (39)
//#define PWR_EN0 39
//Alternative option that does the same thing. Make sure to just choose one for PWR_EN0
//Function Board 0's "PWR_EN0" pin <= MicroMod Main - Single v1.1 A1 => Teensy Processor Board (A1)
//#define PWR_EN0 15
//Note: For those using Main - Single v1.1;
// SAMD51, ESP32, and STM32 Processor Board Pins
// do not have SDIO_DATA2 and SDIO_DATA1.
//==========SAMD51==========
//Function Board 0's "PWR_EN0" pin <= MicroMod Main - Single v2.1 PWM1 => SAMD51 Processor Board (20)
//#define PWR_EN0 20
//Function Board 0's "PWR_EN0" pin <= MicroMod Main - Single v1.1 A1 => SAMD51 Processor Board (18)
//#define PWR_EN0 18
//==========ESP32==========
//Function Board 0's "PWR_EN0" pin <= MicroMod Main - Single v2.1 PWM1 => ESP32 Processor Board (12)
//#define PWR_EN0 12
//Function Board 0's "PWR_EN0" pin <= MicroMod Main - Single v1.1 A1 => ESP32 Processor Board (35)
//#define PWR_EN0 35
void setup() {
// initialize the digital pin as an output.
pinMode(PWR_EN0, OUTPUT);
}
void loop() {
digitalWrite(PWR_EN0, HIGH); // turn the 3.3V regulator on (HIGH is the voltage level)
delay(5000); // wait for a few seconds to do something with the function boards
digitalWrite(PWR_EN0, LOW); // turn the 3.3V regulator off by making the voltage LOW
delay(5000); // wait for a few seconds before turning function boards back on
}
After uploading, take a look at your Function Board's PWR LED. The LED will be on for about 5 seconds and then turn off for another 5 seconds. It will continue to repeat until power is removed from the MicroMod Main Board - Single.
Example 2: MicroMod Main Board - Double Enable Function Boards
If you have not already, select your Board (in this case the MicroMod Artemis), and associated COM port. Copy and paste the code below in your Arduino IDE. Hit the upload button.
/******************************************************************************
WRITTEN BY: Ho Yun "Bobby" Chan
@ SparkFun Electronics
UPDATED: 1/3/2023
DATE: 10/19/2021
GITHUB REPO: https://github.com/sparkfun/SparkFun_MicroMod_Main_Board_Double
DEVELOPMENT ENVIRONMENT SPECIFICS:
Firmware developed using Arduino IDE v1.8.12
========== DESCRIPTION==========
This example code toggles the Function Board's AP2112 3.3V voltage
regulator's enable pin. The Function Boards built-in power LED should blink.
This example is based on Arduino's built-in Blink Example:
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
Note that this example code uses the MicroMod Main Board - Double. The MicroMod
Main Board - Single routes the PWR_EN0 pin slightly different for the
function board.
========== HARDWARE CONNECTIONS ==========
MicroMod Artemis Processor Board => MicroMod Main Board - Double => Function Boards
Feel like supporting open source hardware?
Buy a board from SparkFun!
MicroMod Artemis Processor Board - https://www.sparkfun.com/products/16401
MicroMod Main Board - Double - https://www.sparkfun.com/products/20595
MicroMod Environmental Function Board - https://www.sparkfun.com/products/18632
LICENSE: This code is released under the MIT License (http://opensource.org/licenses/MIT)
******************************************************************************/
/*Define the power enable pins for the processor board with SDIO_DATA2 and SDIO_DATA1.
Depending on the processor board, the Arduino pin may be different.
Note: Certain Processor Boards like the Artemis have more than one pin available
to control the Function Board's voltage regulator (e.g. SDIO_DATA2 and G5).
SAMD51, ESP32, and STM32 Processor Board pins do not have SDIO_DATA2, so
users will need to reference the Processor Pin G5. Below are a few examples. */
//==========ARTEMIS==========
// We suggest flipping the switch to the G5 PROC and G6 PROC. The volrage regulators will work reguardless
// since SDIO_DATA2 and SDIO_DATA1 are connected regardless of what side the switch is on.
// Function Board 0's "PWR_EN0" pin <= MicroMod Main - Double SDIO_DATA2 => Artemis Processor Board (D4)
#define PWR_EN0 4
// Function Board 1's "PWR_EN1" pin <= MicroMod Main - Double SDIO_DATA1 => Artemis Processor Board (D26)
#define PWR_EN1 26
// Make sure switch is flipped over to the EN0 ALT and & EN1 ALT.
// Alternative option that does the same thing. Make sure to just choose one for PWR_EN0 and PWR_EN1.
// Function Board 0's "PWR_EN0" pin <= MicroMod Main - Double G5 => Artemis Processor Board (A29)
//#define PWR_EN0 29
// Function Board 1's "PWR_EN0" pin <= MicroMod Main - Double G6 => Artemis Processor Board (D14)
//#define PWR_EN1 14
//==========TEENSY==========
// We suggest flipping the switch to the G5 PROC and G6 PROC. The volrage regulators will work reguardless
// since SDIO_DATA2 and SDIO_DATA1 are connected regardless of what side the switch is on.
// Function Board 0's "PWR_EN0" pin <= MicroMod Main - Double SDIO_DATA2 => Teensy Processor Board (D39)
//#define PWR_EN0 39
// Function Board 1's "PWR_EN1" pin <= MicroMod Main - Double SDIO_DATA1 => Teensy Processor Board (D34)
//#define PWR_EN1 34
// Make sure switch is flipped over to the EN0 ALT and & EN1 ALT.
// Alternative option that does the same thing. Make sure to just choose one for PWR_EN0 and PWR_EN1
// Function Board 0's "PWR_EN0" pin <= MicroMod Main - Double G5 => Teensy Processor Board (45)
//#define PWR_EN0 45
// Function Board 1's "PWR_EN1" pin <= MicroMod Main - Double G6 => Teensy Processor Board (6)
//#define PWR_EN1 6
//Note: The SAMD51, ESP32, and STM32 Processor Board Pins do not have SDIO_DATA2 and SDIO_DATA1.
//==========SAMD51==========
// Make sure switch is flipped over to the EN0 ALT and & EN1 ALT.
// Function Board 0's "PWR_EN0" pin <= MicroMod Main - Double G5 => SAMD51 Processor Board (D7)
//#define PWR_EN0 7
//Function Board 1's"PWR_EN1" pin <= MicroMod Main - Double G6 => SAMD51 Processor Board (D8)
//#define PWR_EN1 8
//==========ESP32==========
// Make sure switch is flipped over to the EN0 ALT and & EN1 ALT.
// Function Board 0's "PWR_EN0" pin <= MicroMod Main - Double G5 => ESP32 Processor Board (32)
//#define PWR_EN0 32
// Function Board 1's"PWR_EN1" pin <= MicroMod Main - Double G6 => ESP32 Processor Board (33)
//#define PWR_EN1 33
void setup() {
// initialize the digital pins as an output.
pinMode(PWR_EN0, OUTPUT);
pinMode(PWR_EN1, OUTPUT);
}
void loop() {
digitalWrite(PWR_EN0, HIGH); // turn the 3.3V regulator on (HIGH is the voltage level)
digitalWrite(PWR_EN1, HIGH); // turn the 3.3V regulator on (HIGH is the voltage level)
delay(5000); // wait for a few seconds to do something with the function boards
digitalWrite(PWR_EN0, LOW); // turn the 3.3V regulator off by making the voltage LOW
digitalWrite(PWR_EN1, LOW); // turn the 3.3V regulator off by making the voltage LOW
delay(5000); // wait for a few seconds before turning function boards back on
}
After uploading, take a look at the PWR LEDs on the Function Boards. The LEDs will be on for about 5 seconds and then turn off for another 5 seconds. It will continue to repeat until power is removed from the MicroMod Main Board - Double.
Example 3: Reading and Writing to a MicroSD Card
Note: For the MicroMod Teensy, make sure to check out the SdFat library included with the Teensyduino add-on. Once the board is selected, head to the menu to open the examples (File > Examples > SD). You'll need to modify the defined pin from:
const int chipSelect = 10;
To one of the following values.
//==========TEENSY==========
// default value used in Teensy SD Example Code
//const int chipSelect = 10;
// The microSD Card CS pin is D1 for the MicroMod Main Board - Single and Teensy Processor (5). Adjust for your processor if necessary.
const int chipSelect 5;
// The microSD Card's CS pin is G4 for the MicroMod Main Board - Double and Teensy Processor (44). Adjust for your processor if necessary.
//const int chipSelect 44;
The example below uses the built-in SD Arduino library. The only difference in the code is the CS pin for the microSD card, which you will need to adjust for your processor board (in this case we use the Artemis Processor Board). Make sure to reference your Processor Board's CS pin for either the Main Board - Single (D1) or Main Board - Double (G4).
Note: The SPI pins will be defined as macros with your processor's board definitions, so we won't need to define PICO, POCI, or CLK pins. Sweet!
If you have not already, select your Board (in this case the MicroMod Artemis), and associated COM port. Copy and paste the code below in your Arduino IDE. Hit the upload button.
/*
SD Card Read/Write
This example shows how to read and write data to and from an SD card file
The circuit:
SD card attached to SPI bus as follows:
SD Card <=> MicroMod Main Board <=> Artemis Processor Board
-----------------------------------------------------------------
SD ENABLE <=> I2C_SDA1-PROCESSOR <=> pin 9
PICO/SDO <=> SPI_PROCESSOR_SDO <=> pin 38
POCI/SDI <=> SPI_PROCESSOR_SDI <=> pin 43
CLK <=> SPI_PROCESSOR_CLK <=> pin 42
CS <=> D1_PROCESSOR <=> pin 1 (Main Board - Single)
or ...
CS <=> G4_PROCESSOR <=> pin 28 (Main Board - Double)
created Nov 2010
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
*/
#include <SPI.h>
#include <SD.h>
//==========ARTEMIS==========
// The microSD Card CS pin is D1 for the MicroMod Main Board - Single and Artemis Processor (D1). Adjust for your processor if necessary.
const int SD_CS_PIN = 1;
// The microSD Card's CS pin is G4 for the MicroMod Main Board - Double and Artemis Processor (D28). Adjust for your processor if necessary.
//const int SD_CS_PIN = 28;
File myFile;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(SD_CS_PIN)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
myFile = SD.open("test.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to test.txt...");
myFile.println("testing 1, 2, 3.");
// close the file:
myFile.close();
Serial.println("done.");
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
// re-open the file for reading:
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");
// read from the file until there's nothing else in it:
while (myFile.available()) {
Serial.write(myFile.read());
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
void loop() {
// nothing happens after setup
}
Open the Arduino Serial Monitor at 9600 baud. If all goes well, you should see the following output if this is the first time writing to the card! Note that you may see "testing 1, 2, 3." written a few times if you hit the reset button.
Initializing SD card...initialization done.
Writing to test.txt...done.
test.txt:
testing 1, 2, 3.
If you are looking to go the extra mile to see if data was saved, close the Serial Monitor and remove power from the MicroMod Main Board. Eject your microSD card from the socket and insert into a microSD card adapter. Then insert the microSD card into your computer's card reader or USB port. Open the test.txt file in a text editor. You should see an output similar to what you saw in the Serial Monitor after the file was opened as shown below. If you let the program run a few times by hitting the reset button or opening the Serial Monitor, you may see it written a few times.
testing 1, 2, 3.
Besides verifying the data in the file, this step is also useful if you adjust the code to continuously log data in a CSV format. After logging data, you could the open text document in a spreadsheet and graph the values!
Example 4: Reading and Writing to a MicroSD Card (Low Power)
The example below uses the built-in SD Arduino library like the previous example. However, it toggles the power for the microSD card socket with SD_ENABLE. The pin is active low so by setting the pin HIGH, power will be disconnected. Make sure to close the file before removing power.
If you have not already, select your Board (in this case the MicroMod Artemis), and associated COM port. Copy and paste the code below in your Arduino IDE. Hit the upload button.
/*
SD Card Read/Write
This example shows how to read and write data to and from an SD card file
The circuit:
SD card attached to SPI bus as follows:
SD Card <=> MicroMod Main Board <=> Artemis Processor Board
-----------------------------------------------------------------
SD ENABLE <=> I2C_SDA1-PROCESSOR <=> pin 9
PICO/SDO <=> SPI_PROCESSOR_SDO <=> pin 38
POCI/SDI <=> SPI_PROCESSOR_SDI <=> pin 43
CLK <=> SPI_PROCESSOR_SCK <=> pin 42
CS <=> D1_PROCESSOR <=> pin 1 (Main Board - Single)
or ...
CS <=> G4_PROCESSOR <=> pin 28 (Main Board - Double)
created Nov 2010
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
*/
#include <SPI.h>
#include <SD.h>
//==========ARTEMIS==========
// The microSD Card CS pin is D1 for the MicroMod Main Board - Single and Artemis Processor (D1). Adjust for your processor if necessary.
const int SD_CS_PIN = 1;
// The microSD Card's CS pin is G4 for the MicroMod Main Board - Double and Artemis Processor (D28). Adjust for your processor if necessary.
//const int SD_CS_PIN = 28;
// The microSD Card CS pin is SDA1 for the MicroMod Main Board - Single and Artemis Processor (D9). Adjust for your processor if necessary.
const int SD_ENABLE = 9;
File myFile;
void setup() {
pinMode(SD_ENABLE, OUTPUT); //sets the digital pin as output
digitalWrite(SD_ENABLE, LOW); //Power MicroSD card socket, pin is active low
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(SD_CS_PIN)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
myFile = SD.open("test.txt", FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to test.txt...");
myFile.println("testing 1, 2, 3.");
// close the file:
myFile.close();
Serial.println("done.");
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
// re-open the file for reading:
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");
// read from the file until there's nothing else in it:
while (myFile.available()) {
Serial.write(myFile.read());
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
digitalWrite(SD_ENABLE, HIGH); //remove power from MicroSD card socket for low power applications
}// end setup()
void loop() {
// nothing happens after setup
}//end loop()
Open the Arduino Serial Monitor at 9600 baud. If all goes well, you should see the same output in the Serial Monitor and data written to the microSD card.
Example 5: MicroMod Main Enable Qwiic Boards
If you have not already, select your Board (in this case the MicroMod Artemis), and associated COM port. Copy and paste the code below in your Arduino IDE. Hit the upload button.
/******************************************************************************
WRITTEN BY: Ho Yun "Bobby" Chan
@ SparkFun Electronics
DATE: 1/3/2023
GITHUB REPO: https://github.com/sparkfun/SparkFun_MicroMod_Main_Board_Single
DEVELOPMENT ENVIRONMENT SPECIFICS:
Firmware developed using Arduino IDE v1.8.12
========== DESCRIPTION==========
This example code toggles the Qwiic Port's AP7347DQ 3.3V voltage
regulator's enable pin. The Qwiic-enabled boards with built-in
power LED should blink. The Main Board's QWC LED will also blink
as well. This example is based on Arduino's built-in Blink Example:
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
Note that this example code works for both the MicroMod Main Board - Single v2.1
and Double v2.2.
========== HARDWARE CONNECTIONS ==========
MicroMod Artemis Processor Board => MicroMod Main Board - Single => Qwiic Board
Feel like supporting open source hardware?
Buy a board from SparkFun!
MicroMod Artemis Processor Board - https://www.sparkfun.com/products/16401
MicroMod Main Board - Single - https://www.sparkfun.com/products/20748
MicroMod Environmental Function Board - https://www.sparkfun.com/products/18632
SparkFun GPS Breakout - Chip Antenna, SAM-M8Q - https://www.sparkfun.com/products/15210
LICENSE: This code is released under the MIT License (http://opensource.org/licenses/MIT)
******************************************************************************/
/*Define the power enable pin for the processor board for I2C_SCL1-PROCESSOR.
Depending on the processor board, the Arduino pin may be different.*/
//==========ARTEMIS==========
// Qwiic Port's "Qwiic EN" pin <= MicroMod Main Board I2C_SCL1-PROCESSOR => Artemis Processor Board (D8)
#define QWIIC_EN 8
//==========TEENSY==========
// Qwiic Port's "QWIIC_EN" pin <= MicroMod Main Board I2C_SCL1-PROCESSOR => Teensy Processor Board (24)
//#define QWIIC_EN 24
//==========SAMD51==========
// Qwiic Port's "QWIIC_EN" pin <= MicroMod Main Board I2C_SCL1-PROCESSOR => SAMD51 Processor Board (36)
//#define QWIIC_EN 36
//==========ESP32==========
// Qwiic Port's "QWIIC_EN" pin <= MicroMod Main Board I2C_SCL1-PROCESSOR => ESP32 Processor Board (?25??)
//#define QWIIC_EN 25
void setup() {
// initialize the digital pin as an output.
pinMode(QWIIC_EN, OUTPUT);
}
void loop() {
digitalWrite(QWIIC_EN, HIGH); // turn the 3.3V regulator on (HIGH is the voltage level)
delay(5000); // wait for a few seconds to do something with the Qwiic-enabled board(s)
digitalWrite(QWIIC_EN, LOW); // turn the 3.3V regulator off by making the voltage LOW
delay(5000); // wait for a few seconds before turning Qwiic-enabled board(s) back on
}
Once uploaded, check out your Qwiic-enabled board to see if the power LED turns on/off every 5 seconds. Not all boards have an LED populated for power. In that case, you can also check your Main Board's built-in LED labeled as QWC. The LED will also turn on and off.
More Examples!
Sweet! Now that we know that we can read and write to the microSD card, try exploring the other examples in either the SD or SdFat Arduino libraries. Or check out the following MicroMod tutorials that have a built-in microSD card socket for ideas on data logging. Better yet, try adding a sensor and write some code to log some data!
MicroMod Weather Carrier Board Hookup Guide: A quick guide to help to create your own MicroMod weather station using the MicroMod Weather Carrier Board and Processor of your choice.
MicroMod Data Logging Carrier Board Hookup Guide: Get started with some customizable MicroMod data logging with the Data Logging Carrier Board.
MicroMod Asset Tracker Carrier Board Hookup Guide: Get started with the SparkFun MicroMod Asset Tracker Carrier Board following this Hookup Guide. The Asset Tracker uses the u-blox SARA-R510M8S LTE-M / NB-IoT module to provide a host of data communication options.
Looking for more examples with a Function Board? Below are a few Function Board examples from our tutorials that are tagged with MicroMod.
1W LoRa MicroMod Function Board Hookup Guide: Everything you need to get started with the 1W LoRa MicroMod function board; a MicroMod function board that provides LoRa capabilities for your MicroMod project. Must be used in conjunction with a MicroMod main board and processor.
MicroMod WiFi Function Board - ESP32 Hookup Guide: The MicroMod ESP32 Function Board adds additional wireless options to MicroMod Processor Boards that do not have that capability. This special function board acts as a coprocessor that takes advantage of Espressif's ESP32 WROOM to add WiFi and Bluetooth® to your applications.
MicroMod Environmental Function Board Hookup Guide: The SparkFun MicroMod Environmental Function Board adds additional sensing options to the MicroMod Processor Boards. This function board includes three sensors to monitor air quality (SGP40), humidity & temperature (SHTC3), and CO2 concentrations (STC31) in your indoor environment. To make it even easier to use, all communication is over the MicroMod's I2C bus! In this tutorial, we will go over how to connect the board and read the sensors.
MicroMod WiFi Function Board - DA16200 Hookup Guide: Add IoT functionality to any MicroMod project with the MicroMod WiFi function Board - DA16200!
Better yet, try connecting a Qwiic-enabled device to the Main Board's Qwiic connector. Below are a few examples from our tutorials that are tagged with Qwiic.
Capacitive Touch Slider (CAP1203) Hookup Guide: An easy and Qwiic way to add capacitive touch to any of your projects using the CAP1203! In this guide, we go over how to connect and set up your Capacitive Touch Slider so you can start playing with it right away.
SparkFun Top pHAT Hookup Guide: The pHAT to sit above your other HATs. Does that make it the "king" of the pHATs? This guide will help you get started using the Top pHAT with the Raspberry Pi.
Qwiic ToF Imager - VL53L5CX Hookup Guide: Hookup Guide for the Qwiic ToF Imager - VL53L5CX
SparkFun Arduino UNO R4 WiFi Qwiic Kit Hookup Guide: The SparkFun Arduino UNO R4 WiFi Qwiic Kit is a great way to get started with Arduino and the Qwiic-connect system - use this guide to get started!
Troubleshooting
Not working as expected and need help?
If you need technical assistance and more information on a product that is not working as you expected, we recommend heading on over to the SparkFun Technical Assistance page for some initial troubleshooting.
SPARKFUN TECHNICAL ASSISTANCE PAGE
If you don't find what you need there, the SparkFun Forums: MicroMod are a great place to find and ask for help. If this is your first visit, you'll need to create a Forum Account to search product forums and post questions.
Resources and Going Further
Now that you've successfully got your MicroMod Main Board with a Processor Board, it's time to incorporate it into your own project! For more information, check out the resources below:
- MicroMod Main Board - Single V2.1
- MicroMod Main Board - Double V2.2
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum