background image

Qwiic Pro Micro USB-C (ATmega32U4) Hookup Guide

Introduction

Heads up!

 This is for the 

Qwiic Pro Micro USB-C (ATmega32U4)

 version. If you are looking for

information about hardware on the 

Pro Micros with the micro-b USB connector

, make sure to check out the

older Pro Micro & Fio V3 Hookup Guide.

The SparkFun Qwiic Pro Micro USB C is a really cool, little development board. It's an Arduino-compatible
microcontroller, micro-sized, and it accomplishes with one single chip what old Arduino Unos, Duemilanoves, and
Diecimeillas could never dream of: 

true USB functionality

. In this tutorial, we'll check out the updated Qwiic Pro

Micro and go through a few examples to get you started!

SparkFun Qwiic Pro Micro - USB-C (ATmega32U4)

 DEV-15795

Product Showcase: SparkFun Qwiic Pro Micro

Product Showcase: SparkFun Qwiic Pro Micro

Summary of Contents for ATmega32U4

Page 1: ...Qwiic Pro Micro USB C is a really cool little development board It s an Arduino compatible microcontroller micro sized and it accomplishes with one single chip what old Arduino Unos Duemilanoves and Diecimeillas could never dream of true USB functionality In this tutorial we ll check out the updated Qwiic Pro Micro and go through a few examples to get you started SparkFun Qwiic Pro Micro USB C ATm...

Page 2: ...t read through the guide and adjust the cart as necessary Tools You will need a soldering iron solder and general soldering accessories for a secure connection when using the plated through hole pads SparkFun Qwiic Pro Micro USB C ATmega32U4 DEV 15795 Reversible USB A to C Cable 0 8m CAB 15425 Soldering Iron 60W Adjustable Temperature TOL 14456 Solder Lead Free 15 gram Tube TOL 09163 ...

Page 3: ... to the plated through holes for a secure connection For those that want to take advantage of the Qwiic enabled devices you ll want to grab a Qwiic cable Breadboard Self Adhesive White PRT 12002 Break Away Headers Straight PRT 00116 IC Hook with Pigtail CAB 09741 Photon Stackable Header 12 Pin PRT 14322 SparkFun Qwiic Cable Kit KIT 15081 Qwiic Cable 100mm PRT 14427 ...

Page 4: ...ok at the following tutorials if you aren t familiar with them Qwiic Cable Breadboard Jumper 4 pin PRT 14425 Qwiic Cable 500mm PRT 14429 Serial Communication Asynchronous serial communication concepts packets signal levels baud rates UARTs and more What is an Arduino What is this Arduino thing anyway Installing Arduino IDE A step by step guide to installing and testing the Arduino software on Wind...

Page 5: ...thout the need to take out a piece of jumper wire The USB micro b connector has been replaced with the USB type C connector The through hole pads have castellated edges for each pin to add a lower profile in your projects should you decide build it into another assembly during production Finally a Qwiic connector is populated on the bottom of the board to easily add Qwiic enabled I C devices Older...

Page 6: ...what special hardware functions it may have Click on image for a closer view Power There are a variety of power and power related nets broken out to connectors and through hole pads Each pad has a castellated edge The back of the board also has the USB pins broken out for power Castellated Power and Reset Pins USB Power Pins These nets consist of the following V is the voltage provided from the US...

Page 7: ...high GND of course is the common ground voltage 0V reference for the system I O Pins The Qwiic Pro Micro breaks out the I O pins to plated through hole pads on the edge of the board Each pad is castellated as well On the back there are additional pins to connect to the USB data pins Castellated I O PTH Pads USB Pads The Pro Micro s I O pins 18 in all are multi talented Every pin can be used as a d...

Page 8: ...errupt 4 INT6 On Board LEDs There are three LEDs on the Pro Micro One red LED indicates whether power is present The other two LEDs help indicate when data is transferring over USB A yellow LED represents USB data coming into RX the Pro Micro and a green LED indicates USB data going out TX Jumpers On the back of the board is a jumper that is able to select the system voltage The default voltage fo...

Page 9: ... cases provide more power Alternatively if your Qwiic Pro Micro is living out in the wild out of reach of USB cables it can be powered through either the RAW or 5V pins A supply going into those pins will provide power to the Qwiic Pro Micro To be safe it shouldn t be any higher than 6V If the jumper is set to 3 3V the voltage will be regulated down to 3 3V How exactly you power your project is up...

Page 10: ...ur choice to the board for a secure connection For advanced users you could also design a PCB to take advantage of the castellated edges for a lower profile Here are a few tutorials to connect to the pads depending on your personal preference How to Power a Project FEBRUARY 7 2013 A tutorial to help figure out the power requirements of your project How to Solder Through Hole Soldering SEPTEMBER 19...

Page 11: ...board you will simply need a USB C cable connected to your computer For the scope of this tutorial you ll get as far as example 1 Working with Wire FEBRUARY 8 2013 How to strip crimp and work with wire How to Solder Castellated Mounting Holes MAY 12 2015 Tutorial showing how to solder castellated holes or castellations This might come in handy if you need to solder a module or PCB to another PCB T...

Page 12: ...nabled Device You can also easily connect a Qwiic enabled device to the Qwiic connector Below is an example of a distance sensor connected to the Qwiic Pro Micro If you have an installation with a kiosk with the screensaver turned on you could use the Qwiic Pro Micro to wake it up by moving a mouse if there is someone within a certain distance of the VL53L1X sensor ...

Page 13: ... you should find the inf and cat files which contains all the information Windows needs to install the Pro Micro s driver The sparkfun inf driver and sparkfun cat digitally signed catalog file will be found in Arduino_Boards master sparkfun avr signed_driver Step 2 Plug in the Qwiic Pro Micro When you initially plug the board in an Installing device driver software bubble notification should pop u...

Page 14: ...hat pops up click Browse my computer for driver software On the next window click Browse to search for the driver you just downloaded It should be a folder named Arduino_Boards master in a subdirectory noted in step 1 After you ve selected the driver folder click OK then select Next Click on image for a closer view Windows will attempt to do its driver install thing but not before complaining abou...

Page 15: ...n HID USB device e g keyboards and mice the Mac thinks your Pro Micro is a human input device which it could be but isn t yet There s nothing to configure in this window so just click the big red X to close it That s all there is to it The CDC communication device class portion of your Qwiic Pro Micro the part that handles USB to serial conversion should automatically install on your computer Sett...

Page 16: ...s Then towards the bottom of the window paste this URL into the Additional Board Manager URLs text box https raw githubusercontent com sparkfun Arduino_Boards master IDE_Board_Manager package_spark fun_index json You can add multiple URLs by clicking the window icon and pasting in one URL per line Click OK Then open the Board Manager by clicking Tools then hovering over the Board selection tab and...

Page 17: ... important that you select the Pro Micro option that matches your board s voltage and speed This should be listed under the Tools Processor For the Qwiic Pro Micro you will need to ensure that you select the ATmega32U4 5V 16MHz You should also see your Pro Micro s COM port under the Tools Serial Port menu Select it and head over to the Example 1 page where we ll upload our first piece of code ...

Page 18: ... check the Sketchbook location text box Just make sure you close all Arduino windows once you re done Once you ve unzipped that folder into the hardware folder within your Arduino sketchbook you may actually have to create a hardware folder your directory structure should look something like this The structure of this directory is critical it should look something like Arduino hardware manufacture...

Page 19: ... Mac and Linux Following these directions is critical to getting your Pro Micro supported within your Arduino environment Using the Board Manager Since the release of Arduino v1 6 4 adding third party boards to the Arduino IDE is easily achieved through the board manager If you re running an older version of Arduino v1 6 3 or earlier we recommend upgrading now As always you can download the latest...

Page 20: ...in the Board Manager You should see the SparkFun AVR Boards package appear Click install wait a few moments and all the brd files you ll need should be installed indicated by the blue Installed that is printed next to the package You should now be able to upload code to a number of SparkFun Arduino compatible products including Pro Micro Manually Installing the brd Files If you are using an older ...

Page 21: ...ok something like Arduino hardware sparkfun avr 5 Restart Arduino and look under the Tools Board menu You should see a few new options including SparkFun Pro Micro SparkFun Fio V3 and Qduino Mini If the boards are visible select the option that matches your board If you have a Pro Micro make sure you select the correct operating speed and voltage under Tools Processor At this point select the COM ...

Page 22: ...e RXLED OUTPUT Set RX LED as an output TX LED is set as an output behind the scenes Serial begin 9600 This pipes to the serial monitor Serial println Initialize Serial Monitor Serial1 begin 9600 This is the UART pipes to sensors attached to board Serial1 println Initialize Serial Hardware UART Pins void loop Serial println Hello world Print Hello World to the Serial Monitor Serial1 println Hello C...

Page 23: ... RXLED OUTPUT Set RX LED as an output digitalWrite RXLED LOW set the RX LED ON digitalWrite RXLED HIGH set the RX LED OFF TX LED The TX LED was not provided as an Arduino defined pin unfortunately so you ll have to use a pair of macros to control it TXLED1 turns the LED on and TXLED0 turns the LED off We could use the same macros for the RX LED too RXLED1 and RXLED0 Here s part of the code highlig...

Page 24: ...o which enables self programming via serial To our operating system the bootloader looks like a completely different device so it gets its own serial port number While the Qwiic Pro Micro is being programmed the bootloader serial port will be open When the sketch upload is finished the bootloader will exit that serial port will be closed and the regular Qwiic Pro Micro serial port will open up Wha...

Page 25: ...ble ASCII defined character 0 9 a z A Z space symbols etc Here s an example line of code Keyboard write z This will send a single z character to your computer Keyboard print string If you need to perform a series a Keyboard write s consider using just a single Keyboard print This works similar to Serial print give it a string of characters and it ll send that stream of characters over USB Keyboard...

Page 26: ...s In this sketch connecting pin 9 to ground will make the Qwiic Pro Micro spit out a z character If you have a simple momentary button handy tie one end to pin 9 and the other to ground Otherwise just use a wire to short 9 to GND After a Keyboard write or Keyboard print function has been performed by the Qwiic Pro Micro your computer will have to decide what to do with it What your computer does w...

Page 27: ...e press b sends a down click on a button or buttons The button s will remain pressed until you call Mouse release b The b variable is a single byte each bit of which represents a different button You can set it equal to any of the following or OR them together to click multiple buttons at once MOUSE_LEFT Left mouse button MOUSE_RIGHT Right mouse button MOUSE_MIDDLE Middle mouse button MOUSE_ALL Al...

Page 28: ... mouse should be about 500 int mouseClickFlag 0 int invertMouse 1 Invert joystick based on orientation int invertMouse 1 Noninverted joystick based on orientation void setup pinMode horzPin INPUT Set both analog pins as inputs pinMode vertPin INPUT pinMode selPin INPUT set button select pin as input digitalWrite selPin HIGH Pull button select pin high delay 1000 short delay to let outputs settle v...

Page 29: ... click This requires a bit more coding but it allows you to do things like drag and drop double click etc For more HID example code check out the Arduino supplied examples under the File Examples 09 USB menu Or check out Arduino s reference language under USB for more information ARDUINO LANGUAGE REFERENCE USB Example 3 Qwiic Enabled HID Mouse and Keyboard Note If you have not previously installed...

Page 30: ...our respective board enumerated to Qwiic Joystick Hookup Guide FEBRUARY 21 2019 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 ...

Page 31: ...T License http opensource org licenses MIT include Mouse h include Wire h include SparkFun_Qwiic_Joystick_Arduino_Library h Click here to get the library http lib rarymanager All SparkFun_joystick JOYSTICK joystick Create instance of this object int vertZero horzZero Stores the initial value of each axis usually around 512 int vertValue horzValue Stores current analog output of each axis const int...

Page 32: ...use move 0 invertMouse vertValue sensitivity 0 move mouse on y axis if horzValue 0 Mouse move invertMouse horzValue sensitivity 0 0 move mouse on x axis if joystick getButton 0 mouseClickFlag if the joystick button is pressed mouseClickFlag 1 Mouse press MOUSE_LEFT click the left button down else if joystick getButton mouseClickFlag if the joystick button is not pressed mouseClickFlag 0 Mouse rele...

Page 33: ...e before continuing on with the examples below Copy and paste the code below into the Arduino IDE Make sure to select the correct board and COM port that your respective board enumerated to Qwiic Keypad Hookup Guide APRIL 25 2019 If you are tired of taking up GPIO pins wiring a bunch of pull up resistors and using firmware that scans the keys taking up valuable processing time check out the new Qw...

Page 34: ... SparkFun_Qwiic_Keypad_Arduino_Library h Click here to get the library http libra rymanager All SparkFun_keypad KEYPAD keypad1 Create instance of this object void setup Serial begin 9600 Serial println Qwiic KeyPad Example if keypad1 begin false Note using begin like this will use default I2C address 0x4B You can pass begin a different address like so keypad1 begin Wire 0x4A Serial println Keypad ...

Page 35: ...oard write 7 else if button 8 Keyboard write 8 else if button 9 Keyboard write 9 else if button Keyboard write else if button Keyboard write Do something else Don t call your Keypad a ton otherwise you ll tie up the I2C bus delay 25 25 is good more is better If you have a text editor Notepad Word TextEdit etc open and active from Example 2 press a button on the Qwiic Keypad Or you can try using th...

Page 36: ... HID Mouse and Keyboard Combined This example combines 3a and 3b into one sketch Copy and paste the code below into the Arduino IDE Make sure to select the correct board and COM port that your respective board enumerated to SparkFun Electronics Start Something SparkFun Qwiic Pro Micro USB C Testing Area ...

Page 37: ...d in the src folder http librarymanager Al l SparkFun_keypad License This code is released under the MIT License http opensource org licenses MIT include Mouse h include Keyboard h include Wire h include SparkFun_Qwiic_Joystick_Arduino_Library h Click here to get the library http lib rarymanager All SparkFun_joystick JOYSTICK joystick Create instance of this object include SparkFun_Qwiic_Keypad_Ar...

Page 38: ... Please check wiring Freezing endif while 1 delay 1000 short delay to let outputs settle vertZero joystick getVertical get the initial values horzZero joystick getHorizontal Joystick should be in neutral position when reading t hese if DEBUG Serial print Initialized Firmware Version Serial println keypad1 getVersion Serial println Press a button to do a space to go to next line endif Mouse begin I...

Page 39: ...ess MOUSE_LEFT click the left button down else if joystick getButton mouseClickFlag if the joystick button is not pressed mouseClickFlag 0 Mouse release MOUSE_LEFT release the left button if button 1 if DEBUG Serial println No keypad detected endif delay 1000 else if button 0 if DEBUG Serial print Qwiic Keypad Button Serial println button endif if button 0 note that this is a keypad 0 not the butt...

Page 40: ...directory of the subjects covered Troubleshooting Serial Port Not Showing Up in Tools Board menu How to Reset to Bootloader How to Revive a Bricked Pro Micro Code Runs Upon Upload But Fails to Start After Power Cycle Frequently Asked Questions What are VIDs and PIDs How Can I Change the VID and PID on an ATmega32U4 Why Does my ATmega32U4 Board Show up Twice in the Device Manager How Does the IDE K...

Page 41: ...loader run time Arduino Leonardo Leonardo bootloader on reset functionality When a Qwiic Pro Micro is externally reset by pulling the RST pin low it ll only briefly 750ms start the bootloader before continuing on to the sketch If you need the bootloader to run longer resetting twice quickly will get the Pro Micro to enter bootloader mode for eight seconds Qwiic Pro Micro Qwiic Pro Micro reset func...

Page 42: ...e the Pro Micro you ll need to find a way to upload a sketch to it with the board option correctly set We can do this with a little help from the bootloader First you ll need to set the serial port to the bootloader But that port is only visible when the board is in bootloader mode so hit the reset button or pull the reset line low twice quickly to invoke the bootloader reset feature discussed abo...

Page 43: ...selected Keep in mind that if you select the wrong board you will get the wrong VID PID uploaded which means the computer can t recognize and program the board The VID PID for the bootloader is part of the bootloader file To change this you will need to recompile the bootloader with the new VID PID and upload it Why Does my ATMega32U4 Board Show up Twice in Device Manager Both the bootloader and t...

Page 44: ... out these blog posts for inspiration Connecting Arduino to Processing Send serial data from Arduino to Processing and back even at the same time Cherry MX Switch Breakout Hookup Guide How to assemble and use the Cherry MX Switch Breakout allowing you to turn a matrix of mechanical switches into a full size keyboard LilyPad ProtoSnap Plus Hookup Guide The LilyPad ProtoSnap Plus is a sewable electr...

Page 45: ...Turning Your Pro Micro Into a Keyboard FEBRUARY 13 2012 Enginursday Pressing Our Buttons JUNE 15 2017 A Qwiic Upgrade for a DIY Keyboard FEBRUARY 11 2020 ...

Reviews: