NetBurner 3.5.6
PDF Version
SparkFun Qwiic KeyPad

SparkFun Qwiic KeyPad Application

Overview

This application demonstrates the basic use of the SparkFun Qwiic KeyPad (COM-15290) with an embedded system using the NetBurner NNDK (Network Development Kit). The application provides a simple interface to read button presses from the keypad and display them via serial output.

Hardware Requirements

  • NetBurner development board with I2C support
  • SparkFun Qwiic KeyPad (COM-15290)
  • Qwiic connection cable

Features

  • I2C Communication: Uses the Wire library for I2C communication with the keypad
  • Web Server: Includes a basic HTTP web server on port 80
  • Network Stack: Full network stack initialization with diagnostics
  • Real-time Button Detection: Continuously monitors for button presses
  • Serial Output: Displays button presses and status information via serial interface
  • Connection Monitoring: Verifies keypad connectivity on startup

Application Behavior

Initialization Sequence

  1. Initializes the network stack
  2. Enables system diagnostics
  3. Starts HTTP web server on port 80
  4. Waits for active network connection (5 second timeout)
  5. Initializes I2C communication
  6. Attempts to connect to the SparkFun Qwiic KeyPad
  7. Verifies connection status

Runtime Operation

  • Continuously polls the keypad for button presses
  • Updates the internal FIFO buffer to handle multiple key presses
  • Displays pressed keys in square brackets via serial output: [key]
  • Prints a dot (.) every second as a heartbeat indicator
  • Runs indefinitely until system reset

Serial Output Examples

Web Application: SparkFunKeypad
NNDK Revision: [version]
Begin True
Connected True
[1][2][3]....[A][B]....

Code Structure

Key Components

  • Serial Interface: SerialIf Serial - handles serial communication
  • Keypad Object: KEYPAD key - SparkFun keypad library instance
  • I2C Interface: TwoWire Wire - I2C communication handler

Main Functions

  • init() - Network stack initialization
  • key.begin() - Keypad initialization
  • key.isConnected() - Connection verification
  • key.getButton() - Button press detection
  • key.updateFIFO() - Internal buffer management

Dependencies

  • NetBurner NNDK framework
  • SparkFun Qwiic Keypad Arduino Library
  • Wire library for I2C communication
  • Standard NetBurner system libraries (init.h, nbrtos.h, system.h)

Setup Instructions

  1. Connect the SparkFun Qwiic KeyPad to your NetBurner board via I2C/Qwiic interface
  2. Compile and flash the application to your NetBurner device
  3. Open a serial terminal to monitor output
  4. The application will automatically initialize and begin monitoring for key presses
  5. Press keys on the keypad to see output in the serial terminal

Troubleshooting

Common Issues

  • **"Begin false"**: Keypad initialization failed - check I2C connections
  • **"Connected false"**: Keypad not detected - verify power and I2C address
  • No key output: Check FIFO buffer and polling frequency

Debug Tips

  • Verify I2C connections and pull-up resistors
  • Check keypad I2C address (default is typically 0x4B)
  • Ensure proper power supply to the keypad
  • Monitor serial output for initialization status messages

Technical Notes

  • The application uses a 1ms delay in the main loop for efficient polling
  • Button presses are buffered internally by the keypad library
  • The web server functionality provides additional networking capabilities
  • System diagnostics can be disabled for production builds by removing EnableSystemDiagnostics()