Maker.io main logo

Qwiic Pro Kit Project Guide

2020-02-27 | By SparkFun Electronics

License: See Original Project

Courtesy of SparkFun

Introduction

The Qwiic Pro Kit was designed to allow users to get started with Arduino without the need for soldering or a breadboard. We've included three inputs (a joystick, accelerometer, and proximity sensor) and one display that can be daisy chained to your Arduino. Hooking up a handful of inputs and outputs to an Arduino has never been so easy with the Qwiic system!

 

SparkFun Qwiic Pro Kit

Suggested Reading

If you aren't familiar with the Qwiic system, we recommend reading here for an overview.

system_1

We would also recommend taking a look at the following tutorials to set up the RedBoard Turbo and get a feel for each Qwiic component.

guide_2

RedBoard Turbo Hookup Guide - An introduction to the RedBoard Turbo.

  • Qwiic Micro OLED Hookup Guide: Get started displaying things with the Qwiic Micro OLED.
  • Qwiic Accelerometer (MMA8452Q) Hookup Guide: Freescale’s MMA8452Q is a smart, low-power, three-axis, capacitive micro-machined accelerometer with 12-bits of resolution. It’s perfect for any project that needs to sense orientation or motion. We’ve taken that accelerometer and stuck it on a Qwiic-Enabled breakout board to make interfacing with the tiny, QFN package a bit easier.
  • Qwiic Joystick Hookup Guide: Looking for an easy way to implement a joystick to your next Arduino or Raspberry Pi project? This hookup guide will walk you through using the Qwiic Joystick with the Arduino IDE on a RedBoard Qwiic and in Python on a Raspberry Pi.
  • Qwiic Proximity Sensor (VCNL4040) Hookup Guide: The SparkFun Qwiic Proximity Sensor is a great, qualitative proximity (up to 20 cm) and light sensor. This hookup guide covers a few examples to retrieve basic sensor readings.

Kit Contents

You will find the following parts in the kit.

kit_3

Hardware Hookup

The Qwiic connection system makes it easy to connect the boards together. Simply grab a Qwiic cable of your choice to connect. If you are using the demo code from this tutorial to play micro pong, you will need to connect all the boards together. We recommend using longer cable lengths for users using the Qwiic boards to control each paddle and placing them on opposite sides of the micro OLED. We also found it easier to add the accelerometer at the end of the daisy chain since the board requires movement. Additionally, you will need to orient the micro OLED so that the paddle is on the side of the player's Qwiic board after uploading the example code.

hardware_4

Warning! You will need to connect all of the boards together when using the demo code in this tutorial. Otherwise, you will need to comment out lines of code for the Qwiic board that is not connected to the daisy chain.

Installing the Board Add-Ons and Drivers

Note: This code/library has been written and tested on Arduino IDE version v1.8.8. Otherwise, make sure you are using the latest stable version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE.

There are a few board add-ons to install before you are able to upload code to your RedBoard Turbo. If you have not already, make sure to check out the RedBoard Turbo's hookup guide to install the SAMD21 and SparkFun board add-ons.

INSTALLING THE SAMD AND SPARKFUN BOARD ADD-ONS

Drivers

Heads up! Please be aware that the RedBoard Turbo is NOT currently supported on Windows 8 due to a lack of support drivers for those specific OS's.

The RedBoard Turbo is now easier than ever to program, thanks the UF2 bootloader. With this bootloader, the RedBoard Turbo shows up on your computer as a USB storage device without having to install drivers for Windows 10, Mac, and Linux!

However, if you are using a Windows 7 OS, you will need to install SAMD drivers. Head to the RedBoard Turbo's hookup guide for more information about installing drivers for Windows 7.

Installing the Library

Note: If you have not previously installed an Arduino library, please check out our installation guide.

SparkFun has written a library for the Qwiic enabled joystick, triple axis accelerometer (MMA8452Q), proximity sensor (VCNL4040), and 64x48 micro OLED. You can obtain these libraries through the Arduino Library Manager. Search for the following terms to automatically install the latest versions of each library. If you have issues compiling, you may need to download the respective library versions listed below.

If you prefer downloading the libraries manually, you can grab them from each of the respective GitHub repositories.

SPARKFUN QWIIC JOYSTICK ARDUINO LIBRARY (ZIP)

SPARKFUN VCNL4040 ARDUINO LIBRARY (ZIP)

Example Code

We recommend grabbing the code from its the GitHub repository. Otherwise, you can download the zipped file from the link below.

DOWNLOAD THE QWIIC PRO KIT CODE (ZIP)

After downloading, unzip the files and open the QwiicStarterExample.ino sketch. It should be located in the downloads folder similar to this path: .../Firmware/Arduino/QwiicStarterExample/QwiicStarterExample.ino. Open the code up in the Arduino IDE, select the board (i.e. the SparkFun RedBoard Turbo), and the COM port that the board enumerated on. Then hit the upload button.

With a friend, try rocking the accelerometer back and forth along the x-axis or moving your hand above the proximity sensor to control each paddle. You will need to orient the micro OLED so that the paddle is on the side of the player's Qwiic board. The game will continue as long as the ball hits the paddle and bounces to the other side. A player will win a round as soon as the other player fails to bounce the ball back to the other side. The current score will be briefly displayed before the next game. Try to rack up more points than your opponent!

sensor_5

Heads up! As with any distance sensor, there is a minimum distance at which the sensor can detect an object accurately. If your hand or finger is too close to the sensor, the readings for the distance can jump to a higher value causing the paddle to move off the screen. Make sure to be within the range to successfully hit the ball or try adjusting the code to include a minimum and maximum range for the paddle.

The default code uses the accelerometer as player 1 and the proximity sensor as player 2. Try adjusting the code to use the joystick for one of the players by adding and removing the single line comments. The joystick will control the paddle along the "vertical" y-axis. Each board can only have one player assigned. See if you can try to remove the unused Qwiic board from the daisy chain and commenting out each instance of the related board.

Resources and Going Further

Now that you've successfully got your Qwiic Starter Kit up and running, what else will you build? For more information, check out the resource below:

制造商零件编号 KIT-15349
SPARKFUN QWIIC PRO KIT
SparkFun Electronics
制造商零件编号 DEV-14812
REDBOARD TURBO ATSAMD21G18 EVAL
SparkFun Electronics
制造商零件编号 COM-15168
QWIIC JOYSTICK BOARD
SparkFun Electronics
制造商零件编号 SEN-14587
SPARKFUN TRIPLE AXIS ACCELEROMET
SparkFun Electronics
制造商零件编号 SEN-15177
QWIIC VCNL4040 PROXIMITY SENSOR
SparkFun Electronics
制造商零件编号 LCD-14532
QWIIC MICRO OLED BREAKOUT
SparkFun Electronics
制造商零件编号 PRT-14426
QWIIC CABLE - 50MM
SparkFun Electronics
制造商零件编号 PRT-14427
QWIIC CABLE - 100MM
SparkFun Electronics
制造商零件编号 PRT-14428
QWIIC CABLE - 200MM
SparkFun Electronics
制造商零件编号 PRT-14429
QWIIC CABLE - 500MM
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