Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use Adafruit KB2040: Examples, Pinouts, and Specs

Image of Adafruit KB2040
Cirkit Designer LogoDesign with Adafruit KB2040 in Cirkit Designer

Introduction

The Adafruit KB2040 (Manufacturer Part ID: 5302) is a compact microcontroller board based on the RP2040 chip, designed specifically for keyboard and other input device projects. It features a USB-C interface, multiple GPIO pins, and support for various peripherals. The KB2040 is programmable using CircuitPython, MicroPython, or C/C++, making it versatile for both beginners and advanced users.

Explore Projects Built with Adafruit KB2040

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Battery-Powered Smart Light with Proximity Sensor and OLED Display using Adafruit QT Py RP2040
Image of lab: A project utilizing Adafruit KB2040 in a practical application
This circuit is a portable, battery-powered system featuring an Adafruit QT Py RP2040 microcontroller that interfaces with an OLED display, a proximity sensor, an accelerometer, and an RGB LED strip. The system is powered by a lithium-ion battery with a step-up boost converter to provide 5V for the LED strip, and it includes a toggle switch for power control. The microcontroller communicates with the sensors and display via I2C.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered Smart Sensor Hub with Adafruit QT Py RP2040
Image of wearable final: A project utilizing Adafruit KB2040 in a practical application
This circuit features an Adafruit QT Py RP2040 microcontroller interfaced with an APDS9960 proximity sensor, an MPU6050 accelerometer and gyroscope, and an OLED display via I2C communication. It also includes a buzzer controlled by the microcontroller and is powered by a 3.7V LiPo battery with a toggle switch for power control.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered Sensor Hub with Adafruit QT Py RP2040 and OLED Display
Image of 512: A project utilizing Adafruit KB2040 in a practical application
This circuit features an Adafruit QT Py RP2040 microcontroller interfacing with an MPU-6050 accelerometer, an Adafruit APDS-9960 sensor, and a 0.96" OLED display via I2C communication. It is powered by a 3.7V LiPo battery and includes a green LED with a current-limiting resistor connected to an analog pin of the microcontroller.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Mega 2560 Controlled Multi-Display Interface with Rotary Encoders and OLED Screens
Image of A320 FCU: A project utilizing Adafruit KB2040 in a practical application
This circuit is designed around an Arduino Mega 2560 microcontroller, which interfaces with multiple input devices including pushbuttons, rotary encoders, and a bank of KD-22 LEDs through current-limiting resistors. The Arduino also communicates with an Adafruit TCA9548A I2C multiplexer to manage multiple 0.96" OLED displays over the I2C bus, allowing for multiple displays to be controlled independently. The circuit appears to be set up for user interaction with input devices to control or adjust displayed information on the OLED screens, possibly for a control panel or user interface application.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with Adafruit KB2040

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 lab: A project utilizing Adafruit KB2040 in a practical application
Battery-Powered Smart Light with Proximity Sensor and OLED Display using Adafruit QT Py RP2040
This circuit is a portable, battery-powered system featuring an Adafruit QT Py RP2040 microcontroller that interfaces with an OLED display, a proximity sensor, an accelerometer, and an RGB LED strip. The system is powered by a lithium-ion battery with a step-up boost converter to provide 5V for the LED strip, and it includes a toggle switch for power control. The microcontroller communicates with the sensors and display via I2C.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of wearable final: A project utilizing Adafruit KB2040 in a practical application
Battery-Powered Smart Sensor Hub with Adafruit QT Py RP2040
This circuit features an Adafruit QT Py RP2040 microcontroller interfaced with an APDS9960 proximity sensor, an MPU6050 accelerometer and gyroscope, and an OLED display via I2C communication. It also includes a buzzer controlled by the microcontroller and is powered by a 3.7V LiPo battery with a toggle switch for power control.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of 512: A project utilizing Adafruit KB2040 in a practical application
Battery-Powered Sensor Hub with Adafruit QT Py RP2040 and OLED Display
This circuit features an Adafruit QT Py RP2040 microcontroller interfacing with an MPU-6050 accelerometer, an Adafruit APDS-9960 sensor, and a 0.96" OLED display via I2C communication. It is powered by a 3.7V LiPo battery and includes a green LED with a current-limiting resistor connected to an analog pin of the microcontroller.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of A320 FCU: A project utilizing Adafruit KB2040 in a practical application
Arduino Mega 2560 Controlled Multi-Display Interface with Rotary Encoders and OLED Screens
This circuit is designed around an Arduino Mega 2560 microcontroller, which interfaces with multiple input devices including pushbuttons, rotary encoders, and a bank of KD-22 LEDs through current-limiting resistors. The Arduino also communicates with an Adafruit TCA9548A I2C multiplexer to manage multiple 0.96" OLED displays over the I2C bus, allowing for multiple displays to be controlled independently. The circuit appears to be set up for user interaction with input devices to control or adjust displayed information on the OLED screens, possibly for a control panel or user interface application.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Custom mechanical keyboards
  • Input devices such as macro pads or media controllers
  • HID (Human Interface Device) projects
  • General-purpose microcontroller applications
  • Prototyping and educational projects

Technical Specifications

The Adafruit KB2040 is packed with features that make it ideal for compact and efficient designs. Below are its key technical details:

Key Technical Details

  • Microcontroller: RP2040 dual-core ARM Cortex-M0+ processor
  • Clock Speed: 133 MHz
  • Flash Memory: 8 MB (QSPI Flash)
  • RAM: 264 KB SRAM
  • USB Interface: USB-C connector with native USB 1.1 support
  • GPIO Pins: 20 GPIO pins (including 4 analog inputs)
  • Power Supply: 5V via USB-C or external power source
  • Operating Voltage: 3.3V logic level
  • Dimensions: 51mm x 18mm x 4mm
  • Weight: 4.2g

Pin Configuration and Descriptions

The KB2040 features a total of 20 GPIO pins, which are broken out to the sides of the board. Below is the pinout description:

Pin Name Function
1 GND Ground
2 3V3 3.3V power output
3 A0 (GP26) Analog input 0 / GPIO 26
4 A1 (GP27) Analog input 1 / GPIO 27
5 A2 (GP28) Analog input 2 / GPIO 28
6 A3 (GP29) Analog input 3 / GPIO 29
7 GP0 General-purpose I/O pin 0
8 GP1 General-purpose I/O pin 1
9 GP2 General-purpose I/O pin 2
10 GP3 General-purpose I/O pin 3
11 GP4 General-purpose I/O pin 4
12 GP5 General-purpose I/O pin 5
13 GP6 General-purpose I/O pin 6
14 GP7 General-purpose I/O pin 7
15 GP8 General-purpose I/O pin 8
16 GP9 General-purpose I/O pin 9
17 GP10 General-purpose I/O pin 10
18 GP11 General-purpose I/O pin 11
19 SDA (GP20) I2C data line / GPIO 20
20 SCL (GP21) I2C clock line / GPIO 21

Usage Instructions

The Adafruit KB2040 is designed to be easy to use for a variety of projects. Below are the steps and best practices for using the board.

How to Use the KB2040 in a Circuit

  1. Powering the Board:

    • Connect the KB2040 to your computer or power source using a USB-C cable.
    • Alternatively, supply 5V to the USB pin or 3.3V to the 3V3 pin for external power.
  2. Programming the Board:

    • Install CircuitPython or MicroPython by following the instructions on the Adafruit website.
    • Alternatively, use the Arduino IDE with the RP2040 board package installed for C/C++ programming.
  3. Connecting Peripherals:

    • Use the GPIO pins to connect sensors, LEDs, or other peripherals.
    • For I2C devices, connect them to the SDA (GP20) and SCL (GP21) pins.
  4. Uploading Code:

    • Drag and drop your CircuitPython code onto the KB2040 when it appears as a USB drive.
    • For Arduino, upload the code directly via the USB-C connection.

Important Considerations and Best Practices

  • Voltage Levels: The GPIO pins operate at 3.3V logic. Avoid connecting 5V signals directly to the pins.
  • ESD Protection: Handle the board with care to avoid electrostatic discharge damage.
  • Pin Multiplexing: Some pins have multiple functions (e.g., analog input, I2C, or GPIO). Check the datasheet to avoid conflicts.
  • Bootloader Mode: To enter bootloader mode, hold down the BOOT button while connecting the board to your computer.

Example Code for Arduino UNO Integration

Below is an example of using the KB2040 to control an LED:

// Example: Blink an LED connected to GPIO 5 (GP5)

// Define the GPIO pin for the LED
#define LED_PIN 5

void setup() {
  pinMode(LED_PIN, OUTPUT); // Set GPIO 5 as an output
}

void loop() {
  digitalWrite(LED_PIN, HIGH); // Turn the LED on
  delay(1000);                 // Wait for 1 second
  digitalWrite(LED_PIN, LOW);  // Turn the LED off
  delay(1000);                 // Wait for 1 second
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. Board Not Recognized by Computer:

    • Ensure the USB-C cable is a data cable, not a charge-only cable.
    • Check that the board is in bootloader mode by holding the BOOT button while connecting it.
  2. Code Not Running:

    • Verify that the correct firmware (CircuitPython, MicroPython, or Arduino) is installed.
    • Check for syntax errors in your code.
  3. GPIO Pins Not Responding:

    • Confirm that the pins are configured correctly in your code.
    • Ensure that the connected peripherals are functioning and powered properly.
  4. Overheating or Power Issues:

    • Avoid drawing excessive current from the GPIO pins.
    • Use an external power source if your peripherals require more power than the USB can provide.

FAQs

  • Can I use the KB2040 for non-keyboard projects?
    Yes, the KB2040 is a general-purpose microcontroller and can be used for a wide range of applications.

  • What programming languages are supported?
    The KB2040 supports CircuitPython, MicroPython, and C/C++ (via the Arduino IDE or other development environments).

  • How do I reset the board?
    Press the RESET button on the board to restart it. To enter bootloader mode, hold the BOOT button while pressing RESET.

  • What is the maximum current output of the GPIO pins?
    Each GPIO pin can source or sink up to 12 mA. For higher currents, use an external transistor or driver circuit.

This concludes the documentation for the Adafruit KB2040. For additional resources, visit the Adafruit KB2040 product page.