Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Sparkfun Qwiic Button: Examples, Pinouts, and Specs

Image of Sparkfun Qwiic ButtonDesign with Sparkfun Qwiic Button in Cirkit Designer

Introduction

The SparkFun Qwiic Button is a versatile push button designed to integrate seamlessly with the Qwiic Connect System. It simplifies the process of adding a button interface to your project by utilizing the I2C communication protocol. This compact module features an onboard ATtiny84 microcontroller, which allows for advanced functionality such as configurable debounce time, customizable I2C address, and built-in LED control.

Explore Projects Built with Sparkfun Qwiic Button

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino UNO and ESP8266 NodeMCU Interactive Display with Pushbutton Inputs and Audio Feedback: A project utilizing Sparkfun Qwiic Button in a practical application
Arduino UNO and ESP8266 NodeMCU Interactive Display with Pushbutton Inputs and Audio Feedback

This circuit features an Arduino UNO microcontroller interfaced with multiple pushbuttons, a piezo buzzer, an LED dot display, and an ESP8266 NodeMCU. The pushbuttons are likely used for input to trigger different actions or events, the piezo buzzer for audible feedback, and the LED dot display for visual output. The ESP8266 NodeMCU is connected to the Arduino UNO for potential WiFi capabilities, expanding the functionality for IoT applications.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

The SparkFun Qwiic Button is designed to be both user-friendly and highly functional. Below are its key technical details:

Parameter Value
Operating Voltage 3.3V
Communication Protocol I2C
Default I2C Address 0x6F (modifiable via software)
Current Consumption ~1mA (idle)
Button Debounce Time Configurable (default: 50ms)
LED Control Built-in, software-controllable
Dimensions 25.4mm x 25.4mm (1" x 1")

Pin Configuration and Descriptions

The SparkFun Qwiic Button features a Qwiic connector for I2C communication and additional breakout pins for flexibility.

Pin Name Description
1 GND Ground connection
2 3.3V Power supply (3.3V)
3 SDA I2C data line
4 SCL I2C clock line
5 INT Interrupt pin (optional, for event-driven applications)
6 RST Reset pin (optional, used to reset the ATtiny84 microcontroller)

Usage Instructions

The SparkFun Qwiic Button is easy to integrate into your project. Follow the steps below to get started:

Connecting the Qwiic Button

  1. Power the Button: Connect the Qwiic Button to a 3.3V power source using the Qwiic cable or breakout pins.
  2. I2C Communication: Connect the SDA and SCL lines to the corresponding pins on your microcontroller (e.g., Arduino UNO).
  3. Optional Connections: Use the INT pin for interrupt-driven applications or the RST pin to reset the button.

Using the Qwiic Button with an Arduino UNO

The Qwiic Button is compatible with the Arduino platform. Below is an example of how to use it with the SparkFun Qwiic Button Arduino library.

Example Code

#include <Wire.h>
#include <SparkFun_Qwiic_Button.h> // Include the Qwiic Button library

QwiicButton button; // Create a Qwiic Button object

void setup() {
  Serial.begin(9600); // Initialize serial communication
  while (!Serial);    // Wait for the serial monitor to open

  // Initialize the Qwiic Button
  if (button.begin() == false) {
    Serial.println("Qwiic Button not detected. Check connections.");
    while (1); // Halt the program if the button is not detected
  }

  Serial.println("Qwiic Button initialized successfully!");
}

void loop() {
  // Check if the button is pressed
  if (button.isPressed()) {
    Serial.println("Button Pressed!");
    delay(100); // Debounce delay
  }

  // Optional: Control the onboard LED
  button.LEDOn();  // Turn the LED on
  delay(500);      // Wait for 500ms
  button.LEDOff(); // Turn the LED off
  delay(500);      // Wait for 500ms
}

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues and Solutions

  1. Qwiic Button Not Detected

    • Ensure the Qwiic cable is securely connected.
    • Verify that the SDA and SCL lines are correctly wired to the microcontroller.
    • Check that the I2C address matches the default (0x6F) or the configured address.
  2. Button Presses Not Detected

    • Confirm that the button is properly initialized in the code.
    • Check the debounce time setting and adjust if necessary.
    • Inspect the INT pin connection if using interrupts.
  3. Onboard LED Not Working

    • Ensure the LED control commands (LEDOn() and LEDOff()) are correctly implemented in the code.
    • Verify that the Qwiic Button is receiving sufficient power.

FAQs

Q: Can I use the Qwiic Button with a 5V microcontroller?
A: Yes, but you must use a logic level shifter to safely interface the 3.3V Qwiic Button with a 5V microcontroller.

Q: How do I change the I2C address?
A: Use the setI2CAddress() function in the SparkFun Qwiic Button library to assign a new address. Refer to the library documentation for details.

Q: Can I use multiple Qwiic Buttons in the same project?
A: Yes, but each button must have a unique I2C address. Use the library to configure the addresses.

Q: What is the maximum cable length for the Qwiic system?
A: The maximum cable length depends on the I2C bus speed and environment. For standard applications, keep the cable length under 1 meter to ensure reliable communication.

By following this documentation, you can effectively integrate the SparkFun Qwiic Button into your projects and troubleshoot any issues that arise.