Maker.io main logo

Qwiic Carrier Board Hookup Guide

2024-09-24 | By SparkFun Electronics

License: See Original Project Arduino MicroMod Qwiic

https://youtu.be/9snKiVXC5Vc?si=X3megRUwrmDEuuSO

 

Courtesy of SparkFun

Guide by santaimpersonator, MAKIN-STUFF

Introduction

The MicroMod Qwiic Carrier Board can be used to rapidly prototype with other Qwiic devices; it is ‎available in either a single or double mounting configuration. Just like other MicroMod Carrier ‎Boards, users are free to develop with MicroMod Processor Board of their choice.‎

For a quick overview, check out our product video showcasing the MicroMod Qwiic carrier boards:‎

Required Materials

To get started, users will need a few of items listed below. (You may already have a some of these ‎items; read through the guide and modify your cart accordingly.)‎

MicroMod Processor Board

Like other MicroMod Carrier Boards, a Processor Board is required for the product to operate. ‎Users will need a Processor Board (of their choice) to attach to the MicroMod M.2 connector; since, ‎one is not included with this product. Below, are few options:‎

Required Hardware

A Phillips screwdriver is necessary to attach the Processor board to the Carrier Board. Additionally, ‎a USB-C cable is needed to connect the Carrier Board to a computer.‎

Optional Hardware

To connect Qwiic breakout boards for your MicroMod project, Qwiic cables are required. Users can ‎also attach the Qwiic devices with 4-40 screws or stacked them with standoffs.‎

A single-cell Lithium-ion battery can be connected to the Qwiic Carrier Board for portability.‎

To modify the jumpers, users will need soldering equipment and/or a knife.‎

Suggested Reading

The MicroMod ecosystem is a unique way to allow users to customize their project to their needs. ‎The Qwiic connect system is a simple method for interfacing with I2C devices. Click on the banners ‎below for more information on each system.

micro_1

https://youtu.be/4QUJWeSrzD0?si=7_2__8sdZGSZ8EEV

qwiic_2

https://youtu.be/x0RDEHqFIF8?si=32SW23mDR1zil4_T‎ 

For users who aren't familiar with the following concepts, we also recommend reading the following ‎tutorials before continuing.‎

  • Serial Communication: Asynchronous serial communication concepts: packets, signal levels, ‎baud rates, UARTs and more!‎
  • I2C: An introduction to I2C, one of the main embedded communications protocols in use today.‎
  • 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!‎
  • Designing with MicroMod: This tutorial will walk you through the specs of the MicroMod ‎processor and carrier board as well as the basics of incorporating the MicroMod form factor into ‎your own PCB designs!‎
  • Installing an Arduino Library: How do I install a custom Arduino library? It's easy! This ‎tutorial will go over how to install an Arduino library using the Arduino Library Manager. For libraries ‎not linked with the Arduino IDE, we will also go over manually installing an Arduino library.‎
  • Installing Arduino IDE: A step-by-step guide to installing and testing the Arduino software on ‎Windows, Mac, and Linux.‎
  • Installing Board Definitions in the Arduino IDE: 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.‎

Hardware Overview

This section will cover the various hardware components and solder jumpers on the MicroMod ‎Qwiic Carrier Board. It will also review the connections of the M.2 connector and how it interfaces ‎with a MicroMod Processor.‎

Board Dimensions

The Qwiic Carrier Board dimensions are:‎

  • Single: 3.15" x 1.40" (80.00mm x 35.56mm)
  • Double: 4.10" x 1.40" (109.22mm x 35.56mm)‎

dimensions_1

dimensions_2

Dimensions of the MicroMod Qwiic Carrier Board.‎

The boards also include mounting holes and inserts for a standard 4-40 screw. The inserts are ‎arranged to mount, attach, and/or stack compatible (1" x 1") Qwiic boards.‎

mounting_3

mounting_4

Mounting areas on the MicroMod Qwiic Carrier Board to attach Qwiic devices.‎

Common Components

Most SparkFun MicroMod Carrier Boards will have some common components and all MicroMod ‎Carrier Boards will have the keyed M.2 MicroMod connector for a Processor board. The photo and ‎list below outline the common components between the Qwiic carrier board and other MicroMod ‎Carrier Boards.‎

  • M.2 MicroMod Connector - This special keyed M.2 connector lets you install your MicroMod ‎Processor of choice to the Qwiic Carrier Board.‎
  • USB-C Connector - Connect to your computer to program your processor and provide power ‎to the board.
  • 3.3V Regulator - Provides a regulated 3.3V and sources up to 1A.‎
  • Qwiic Connectors - The standard Qwiic connectors to connect other Qwiic devices for your ‎MicroMod project.
  • Boot/Reset Buttons - Push buttons to enter boot mode on processors and to reset your ‎MicroMod circuit.‎

components_5

Common MicroMod components featured on the MicroMod Qwiic Carrier Board.

Battery Charger

The board also has a MCP73831 Single-Cell Lithium-Ion/Lithium-Polymer Charge IC so you can ‎charge an attached single-cell LiPo battery. The charge IC receives power from the USB ‎connection and can source up to 450mA to charge an attached battery.‎

battery_6

Battery charger for the MicroMod Qwiic Carrier Board.‎

Status LEDs

The carrier board has two status LEDs:‎

  • PWR - This LED indicates when 3.3V power is available top the board.
  • CHG - This LED indicates the status of the charging circuit operation.‎

status_7

Status LEDs on the MicroMod Qwiic Carrier Board.‎

Solder Jumpers

Users who have never worked with soldering jumpers and cutting PCB traces before (or for a quick ‎refresher), check out our How to Work with Solder Jumpers and PCB Traces tutorial for detailed ‎instructions and tips.‎

There are four adjustable solder jumpers on the MicroMod Qwiic Carrier Board ‎labeled MEAS, BYP, 3.3V_VE and 3.3V. The table below briefly outlines their functionalities:‎

table_8

How to Use a Multimeter

jumpers_9

Jumpers on the MicroMod Qwiic carrier board.

MicroMod Pinout

Since this Carrier Board is designed to work with all of the MicroMod Processors we've included ‎the table below to outline which pins are used so, if you would like, you can compare them to the ‎pinout tables in their respective Hookup Guides.‎

QWIIC CARRIER BOARD PINOUT TABLE

table_10

MICROMOD GENERAL PINOUT TABLE

table_11

MICROMOD GENERAL PIN DESCRIPTIONS

table_12

 

Breakout Pins

The Qwiic Carrier Board features a 3.3V, a ground, seven I/O breakout pins. The functionality of ‎these pins are detailed in the table above.‎

breakout_13

Breakout pins on the MicroMod Qwiic Carrier Board.‎

Hardware Assembly

For those unfamiliar with the MicroMod ecosystem, be sure to review the Getting Started with ‎MicroMod guide.‎

file_Loop_4

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!‎

Processor Board

To get started with the Qwiic Carrier Board, users will need a compatible Processor. Insert the ‎MicroMod Processor board into the M.2 socket at an angle, with its edge connector aligned to the ‎matching slots.‎

Note: The dimensions of the Processor board's edge connector prevent it from mating with the ‎slots of the M.2 socket in reverse. As an extra safeguard, the screw insert is spaced to only match ‎the screw key of MicroMod Processor boards.‎

When inserted properly, the Processor board will rest at an angle:‎

insert_14

Inserting a processor board into the M.2 socket on the MicroMod Qwiic Carrier Board.

To secure the processor board, gently hold down on the board and attach the M.2 screw with a ‎Phillip's head (PH0 or PH1) screwdriver. Below, is an example of an assembled MicroMod system:‎

processor_15

A processor board attached to the MicroMod Qwiic Carrier Board.

Qwiic Devices

Screw inserts are available in either a single or double configuration to attach/mount 1" x 1" Qwiic ‎devices to the Qwiic carrier board. The inserts are compatible with 4-40 screws; additionally, 4-40 ‎‎3/8" standoffs can also be used to stack boards vertically.‎

To electronically connect the Qwiic devices to the Carrier Board, users will need Qwiic cables. For ‎more information, check out our Qwiic ecosystem page.‎

devices_16

devices_17

Mounting and connecting Qwiic devices to the MicroMod Qwiic Carrier Board.‎

Programming

To program the processor board utilized on the Qwiic Carrier Board; connect the board to a ‎computer with a USB-C cable. Depending on the Processor board, user may need to install ‎drivers (if they have not done so already).‎

Note: Make sure that the correct board definitions are installed in the Arduino IDE, for the selected ‎Processor board. For help installing board definitions, use the MicroMod processor boards landing ‎page and review the associated hookup guide for that hardware.‎

install_18

Installing Board Definitions in the Arduino IDE

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.‎

usb_19

USB connection to the MicroMod Qwiic carrier board for programming the attached processor ‎board.

Example

Below is a simple demonstration of using the MicroMod Qwiic Carrier Board to create a bubble level, ‎using an accelerometer and OLED display. Users will also need other parts and accessories; all ‎parts besides the Qwiic carrier board are listed below:‎

Note: We have chosen the MicroMod ESP32 for the processor board for this demonstration; ‎however, users are free to utilize the processor board of their choice.‎

Please note, that the sample code below is intended to program processor boards that are ‎compatible with the Arduino IDE. Therefore, processor boards like the RP2040 are going to need ‎extra effort to adapt the code (technical assistance for which, is not available).‎

Assembly

The assemble process is relatively straight forward. The primary thing that users need to pay ‎attention to is the orientation of the OLED display relative to the axes of the accelerometer. The x-‎axis should point to the right of the OLED display and the y-axis should point to the top of the ‎display (see images below).‎

assembly_20

assembly_21

Mounting and connecting the Qwiic devices to the MicroMod Qwiic Carrier Board.‎

Some users may find it the movement of the bubble in the example code to be more intuitive if the ‎OLED display is stacked above the accelerometer.‎

boards22

Don't forget to daisy-chain the boards together with Qwiic cables.‎

Example Code

Users can download the example code here or by clicking the button below. Besides the RP2040 ‎processor board, users only need to select the proper port and board from the board manager in ‎the Arduino IDE before uploading the code.‎

DOWNLOAD EXAMPLE CODE

The following sections break down the example code execution for users who might want to modify ‎the code. Please note, as defined in our terms of service, that we do not provide technical ‎assistance for any code modifications.‎

Dependencies

Below are the dependencies for the code including the libraries, pin definitions, and variable ‎instantiations. The example code requires both the Micro OLED and LIS2DH12 Arduino libraries to ‎be installed in the Arduino IDE.‎

Tip: While in the Arduino IDE, users can click the links in the code (i.e., //Click here to get the ‎library: http://librarymanager/All#SparkFun_LIS2DH12) to pull up the required library in the ‎library manager.‎ ‎

library_small

Clicking the link to pull up the required library in the Arduino IDE.

installing_23

Installing an Arduino Library

JANUARY 11, 2013‎

How do I install a custom Arduino library? It's easy! This tutorial will go over how to install an ‎Arduino library using the Arduino Library Manager. For libraries not linked with the Arduino IDE, we ‎will also go over manually installing an Arduino library.‎

Libraries and Pin Definitions

This section of the code contains the required libraries and pin definitions for the code.‎

Copy Code
#include <Wire.h>

// Accelerometer
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "SparkFun_LIS2DH12.h" //Click here to get the library: http://librarymanager/All#SparkFun_LIS2DH12
SPARKFUN_LIS2DH12 accel;
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

// External Display
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include <SFE_MicroOLED.h> //Click here to get the library: http://librarymanager/All#SparkFun_Micro_OLED
//#include "icons.h"

#define PIN_RESET 7
#define DC_JUMPER 1
MicroOLED oled(PIN_RESET, DC_JUMPER);
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Variables

This section of the code instantiates most of the variables used in the code.‎

Copy Code
// Set target and dot size
int radiusLarge = 10; // Target area 2
int radiusSmall = 4; // Target area 1
int radiusBubble = 2; // Bubble size

// Set initial roll and pitch measurement
double averagedRoll = 0.0;
double averagedPitch = 0.0;

Setup Loop

This section of the code runs the setup loop, which initializes the serial output, I2C connection, the ‎OLED display operation, and the accelerometer operation and configuration.‎

Copy Code
void setup()
{
// Initialize Output for Print Statements
Serial.begin(115200);
Serial.println("SparkFun Accel Example");

// Initialize I2C Connection
Wire.begin();
//Wire.setClock(400000);

beginDisplay(); //Check if an external Qwiic OLED is attached and display splash screen

// Check for accelerometer
if (accel.begin() == false)
{
Serial.println("Accelerometer not detected. Check address jumper and wiring. Freezing...");
while (1)
;
}

// Set sample/data rate for accelerometer
// The larger the avgAmount the faster we should read the sensor
//accel.setDataRate(LIS2DH12_ODR_100Hz); //6 measurements a second
accel.setDataRate(LIS2DH12_ODR_400Hz); //25 measurements a second
}

Setup Functions

These functions are executed in the setup loop, to initialize the OLED display I2C connection and ‎display the splash screen.‎

Copy Code
// Ping an I2C address and see if it responds
bool isConnected(uint8_t deviceAddress)
{
Wire.beginTransmission(deviceAddress);
if (Wire.endTransmission() == 0)
return true;
return false;
}


void beginDisplay()
{
// Connect to address display is on by pinging addresses
// 0x3D is default on Qwiic board
if (isConnected(0x3D) == true || isConnected(0x3C) == true)
{
//Init and display splash
oled.begin(); // Initialize the OLED
oled.display(); // Display splash screen
delay(1200);
oled.clear(PAGE); // Clear the display's internal memory

oled.setCursor(15, 7); //x, y
oled.setFontType(0); //Set font to smallest
oled.print(F("Bubble"));
oled.setCursor(19, 20); //x, y
oled.print(F("Level"));

oled.display();
delay(1200);
}
}

Main loop

This section of the code runs the main loop. The code retrieves roll and pitch calculation, clears the ‎display buffer, displays the bubble and target circles or areas. If the position of the bubble is within ‎the target are, the roll and pitch angles are displayed as X and Y coordinates on the screen.‎

Copy Code
void loop()
{
getAngles(); // Calculate roll and pitch angles based on the acceleromter readings
oled.clear(PAGE); // Clear the display's internal memory

// Set dot position
double bubbleX = LCDWIDTH / 2 - averagedPitch; // Bubble location on x-axis
double bubbleY = LCDHEIGHT / 2 - averagedRoll; // Bubble location on y-axis

// Limit bubble position to edge of screen
if (bubbleX < radiusBubble) { bubbleX = radiusBubble; }
else if (bubbleX > LCDWIDTH - radiusBubble) { bubbleX = LCDWIDTH - radiusBubble - 1; }
if (bubbleY < radiusBubble) { bubbleY = radiusBubble; }
else if (bubbleY > LCDHEIGHT - radiusBubble) { bubbleY = LCDHEIGHT - radiusBubble - 1; }

// Draw circle relative to dot
oled.circle(LCDWIDTH / 2, LCDHEIGHT / 2, radiusLarge);
oled.circle(LCDWIDTH / 2, LCDHEIGHT / 2, radiusSmall);
oled.circleFill(bubbleX, bubbleY, radiusBubble);

// Display angle/position once bubble is inside larger target area
if ( sqrt(averagedPitch * averagedPitch + averagedRoll * averagedRoll) < (radiusLarge - radiusBubble))
{
oled.setFontType(0); //Set font to smallest

oled.setCursor(LCDWIDTH/2 - 21, 0); //x, y
oled.print("X:");
oled.print(-averagedPitch);
oled.setCursor(LCDWIDTH/2 - 21, LCDHEIGHT - 8); //x, y
oled.print("Y:");
oled.print(averagedRoll);


// oled.setCursor(LCDWIDTH/2 - 11, 0); //x, y
// oled.print(averagedRoll);
// if (-averagedPitch < 0) { oled.setCursor(LCDWIDTH - 29, LCDHEIGHT/2 - 3); }
// else { oled.setCursor(LCDWIDTH - 23, LCDHEIGHT/2 - 3); }
// oled.print(-averagedPitch);
}

oled.display();
}

getAngles() Function

This function is executed in the main loop. The code retrieves accelerometer readings, translates ‎the readings into roll and pitch angles, and calculates an average based on a sample set size ‎‎(avgAmount = 16).‎

Copy Code
void getAngles()
{
averagedRoll = 0.0;
averagedPitch = 0.0;
const int avgAmount = 16;

// Average readings after 'avgAmount' samples
for (int reading = 0 ; reading < avgAmount ; reading++)
{
while (accel.available() == false) delay(1); // Wait for accelerometer connection

// Retrieve data from accelerometer
float accelX = accel.getX();
float accelY = accel.getY();
float accelZ = accel.getZ();

// Optional modification: https://www.nxp.com/docs/en/application-note/AN3461.pdf
//int signZ = constrain(accelZ, -1, 1);
//double roll = atan2(accelY , signZ * sqrt( accelZ * accelZ + .001 * abs(accelX) ) ) * 57.3;

// Calculate roll and pitch angles
double roll = atan2(accelY , accelZ) * 57.3;
double pitch = atan2((-accelX) , sqrt(accelY * accelY + accelZ * accelZ)) * 57.3;
if (constrain(accelZ, -1, 1) == -1) { roll = atan2(accelY, -accelZ) * 57.3; } // Invert if upside down

averagedRoll += roll;
averagedPitch += pitch;

// Debug Print Statements
//Serial.print(roll, 6);
//Serial.print(", ");
//Serial.print(pitch, 6);
//Serial.print(", ");
//
//Serial.print(accelX);
//Serial.print(", ");
//Serial.print(accelY);
//Serial.print(", ");
//Serial.print(accelZ);
//Serial.println("");
}

averagedRoll /= (float)avgAmount;
averagedPitch /= (float)avgAmount;

// Debug Print Statements
//Serial.print(averagedRoll, 6);
//Serial.print(", ");
//Serial.print(averagedPitch, 6);
//Serial.println(", ");

}

Demo Operation

Below is a demonstration of the example code in action. Enjoy!‎

demo_small

Demonstration of the bubble level code operating.‎

Troubleshooting

Not working as expected and need help?

‎For technical assistance and more information on a product that is not working as you expected, ‎please review the SparkFun Technical Assistance page for some initial troubleshooting.‎

SPARKFUN TECHNICAL ASSISTANCE PAGE‎

For additional assistance, the SparkFun Forums: MicroMod are a great place to find and ask for ‎help. First-time users will need to create a Forum Account to search product forums and post ‎questions.‎

SPARKFUN FORUMS: MICROMOD

Resources and Going Further

Want more information on the SparkFun Qwiic Carrier Board? Check out these links!‎

MicroMod Documentation:‎

制造商零件编号 DEV-17723
SPARKFUN MICROMOD QWIIC CARRIER
SparkFun Electronics
制造商零件编号 DEV-17724
SPARKFUN MICROMOD QWIIC CARRIER
SparkFun Electronics
制造商零件编号 KIT-16549
MICROMOD DIY CARRIER KIT 5PACK
SparkFun Electronics
制造商零件编号 WRL-16781
MICROMOD ESP32 PROCESSOR
SparkFun Electronics
制造商零件编号 DEV-17720
SPARKFUN MICROMOD RP2040 PROCESS
SparkFun Electronics
制造商零件编号 KIT-21702
SPARKFUN BLUES WIRELESS MICROMOD
SparkFun Electronics
制造商零件编号 CAB-14743
CABLE A PLUG TO C PLUG 3.28'
SparkFun Electronics
制造商零件编号 KIT-15081
QWIIC CABLE KIT
SparkFun Electronics
制造商零件编号 PRT-17259
FLEXIBLE QWIIC CABLE - 100MM
SparkFun Electronics
SOLDER LEAD FREE - 100-GRAM SPOO
制造商零件编号 TOL-09325
SOLDER LEAD FREE - 100-GRAM SPOO
SparkFun Electronics
制造商零件编号 CQ4LF-B-R
LIQUID FLUX NO-CLEAN IN 6ML (0.2
Chip Quik Inc.
HOBBY KNIFE
制造商零件编号 TOL-09200
HOBBY KNIFE
SparkFun Electronics
制造商零件编号 WLSK8012A
STATION W/WLIRP80 POWER IRON
Apex Tool Group
TRIPLE AXIS ACCELEROMETER BREAKO
制造商零件编号 SPX-15760
TRIPLE AXIS ACCELEROMETER BREAKO
SparkFun Electronics
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum