• Skip to main content
  • Shop
  • Learn
  • Blog
  • Forums
  • IO
  • LIVE!
  • AdaBox
Adafruit Logo
0
  • Sign In | Create Account
  • Playground
  • Shop
  • Learn
  • Blog
  • Forums
  • IO
  • LIVE!
  • AdaBox
Sign In
0
Adafruit Logo
  • Learn Categories
    • 3D Printing
    • AdaBox
    • Adafruit Products
    • Arduino Compatibles
    • Breakout Boards
    • Circuit Playground
    • CircuitPython
    • CLUE
    • Community Support
    • Components
    • Crickit
    • Customer & Partner Projects
    • Development Boards
    • Educators
    • EL Wire/Tape/Panel
    • Feather
    • Gaming
    • Hacks
    • Internet of Things - IOT
    • LCDs & Displays
    • LEDs
    • Machine Learning
    • MakeCode
    • Maker Business
    • micro:bit
    • Microcontrollers
    • Programming
    • Raspberry Pi
    • Robotics & CNC
    • Sensors
    • STEMMA
    • Tools
    • Trellis
    • Wearables
    Explore, Groups to get your gears turning
    Explore
    Groups to get your gears turning
    Explore Groups
  • New Guides
  • Playground
lightwoheat Notes

lightwoheat

u/lightwoheat

Getting Started

Adafruit Playground is a wonderful and safe place to share your interests with Adafruit's vibrant community of makers and doers. Have a cool project you are working on? Have a bit of code that you think others will find useful? Want to show off your electronics workbench? You have come to the right place.

The goal of Adafruit Playground is to make it as simple as possible to share your work. On the Adafruit Playground users can create Notes. A note is a single-page space where you can document your topic using Adafruit's easy-to-use editor. Notes are like Guides on the Adafruit Learning System but guides are high-fidelity content curated and maintained by Adafuit. Notes are whatever you want them to be. Have fun and be kind.

Click here to learn more about Adafruit Playground and how to get started.

  • By lightwoheat

    XIAO ESP32-S3 Bit Pirate as I2C Bridge with GUI Control

    Use your XIAO ESP32-S3 to create a USB to I2C Bridge to connect to your I2C Peripherals. Everything is done in your browser: flash it with ESP32 Bit Pirate, put it into BPIO2 mode, and have UXB-300 read and write any I2C or SPI peripheral with no additional code changes. This example uses the LPS22, and you'll be polling it in no time without writing a single line of code. You read and write it by register name and real units instead of raw bytes, which makes bring-up and tuning fast.

    Hardware Used:

    Board: Seeed XIAO ESP32-S3
    Expansion Board (optional): Seeed XIAO Expansion Board
    Sensor: Adafruit LPS22 Pressure Sensor - STEMMA QT
    Cable: Grove to STEMMA QT Cable - 100mm (also at DigiKey)
    USB-C data cable

    Links to Firmware and GUI:

    Firmware: ESP32 Bit Pirate Web Flasher (thanks to geo-tp for the ESP32 Bit Pirate project)
    Terminal: Bit Pirate Web Serial Terminal
    GitHub: ESP32S3_BPIO2_I2CBridge
    GUI: UXB-300 (Chrome or Edge on desktop)

    Set up the XIAO: ( Flash | BPIO2 )

    Flash: Open the web flasher in Chrome or Edge. Hold BOOT on the XIAO while you plug in USB, select Xiao ESP32-S3, then click Flash selected firmware.

    BPIO2: Open the web serial terminal, click Connect and press any key. Then type:

    Save
  • By lightwoheat

    ESP32-S3(M5StickCPlus2) as I2C Bridge with GUI Control

    Use your M5StickCPlus2 to create a USB to I2C Bridge to connect to your I2C Peripherals. The UXB-300 is a browser-based GUI builder that lets you wire up register-level controls of an IC without touching any code. The example below uses the LTR-329 as the peripheral. 

    Hardware Used:

    USB Bridge: ESP32S3 - M5StickC Plus2 : https://www.adafruit.com/product/4290

    Peripheral : Light Sensor - LTR-329: https://www.adafruit.com/product/5591

    Schematic/Datasheet: https://learn.adafruit.com/adafruit-ltr-329-ltr-303/downloads

    Cables: USB-C Cable between PC and M5Stick https://www.adafruit.com/product/4474

     Grove to Qwiic cable between M5Stick and LTR-329 https://www.adafruit.com/product/4528

    The Arduino IDE 2.3.10 was used to create and load a sketch onto the M5Stick. The UXB-300 was used to create a GUI to control the peripheral and display the results in real time.

     Links to Sketch and GUI:

    Arduino Sketch: m5stickC_esp32s3_i2c_oled.ino  : https://github.com/labs16/ESP32S3-I2C-Bridge

    UXB-300 LTR-329 GUI: https://apps.labs16.com/poverholt/esp32-s3_ltr-329

     Just want to jump in? Connect your M5Stick with LTR-329 Hardware, click the UXB-300 LTR-329 GUI link above, and skip to the Connect Hardware and Control with GUI step below.

     Want to build it yourself?  Continue to follow along…

     Detailed Steps to do on your own: ( Define | Create | Connect )

     The ESP32-S3 has USB OTG capability and is configured in the sketch to use serial protocol to send and fetch I2C commands. The UXB-300 GUI can be easily configured to communicate with the ESP32-S3 and interactively communicate via I2C with the peripherals. 

     Since the ESP32-S3 is used as a USB bridge, we need to define the serial data being sent and received between the ESP32-S3 and the UXB-300 GUI over USB. The packet payload definition will, at a minimum, need to support the peripheral being used - in this case an LTR-329.

     Packet Payload Definition: (byte count varies with data length) 

                 < Byte0 > < Byte1 > < Byte3 >< Byte4 >.....< Byte8 >

     < Byte0 > = Mode/Size Byte and it contains information on whether it is a Block Transfer and the Size(Bytes) of the Data. The High Nibble determines if it is Block and the Lower Nibble is the size of the Data Transfer. A High Nibble of  0xB indicates a block transfer.

     Example: 0xB2 means Block of length two bytes, 0x04 means non-block of length four bytes.

     < Byte1 > =  R/W Byte: Read = 0x72 and Write = 0x77

     < Byte2 > = dev-id = 7-bit Device Address for the peripheral

     < Byte3 > = ADDR = register address in Hex

     < Byte4:N Bytes > = DATA sent / received

    < Byte N+1 > ERROR Byte

     The Packet Payload Definition above was used for this project. This definition is flexible — both the sketch and GUI packet builder are easy to adjust per your application.

     The peripheral datasheet and peripheral schematic allow us to confirm the settings and that the definition above is sufficient. The peripheral is non-block with a data size of one byte.    

    Byte0 = 0x01

     dev-id (7-bit) Device Address is 0x29 per the Datasheet.

     Byte 2 = dev-id (7-bit) = 0101001b = 0x29

     Page 14 from the datasheet provides the supported Register Addresses, which are one byte in size, together with the datalength which is shown to be one byte in size as well.

     The ERROR Byte will be returned by the M5Stick (0x00 if no error, 0xFF if error)

     This translates to the following for writing and reading from the peripheral using the M5Stick as a USB bridge.

     Send: 0x01 0x77 0x29<ADDR><DATA><ERROR>

    Fetch : 0x01 0x72 0x29<ADDR><DATA><ERROR>    

     - Bold indicates bytes returned from the M5Stick versus sent from the host.

     The Arduino Sketch uses M5's M5StickCPlus2 board, which is available via Board Manager on the Arduino IDE under esp32 version 3.3.10. The M5StickCPlus2(v 1.0.1), M5Unified(v 0.2.17) and M5GFX(v 0.2.22) Libraries were installed. 

     Normally you'd write something custom on the host side to read these registers — UXB-300 handles that, letting you skip straight to the hardware. The tool is available at 

    https://uxb-300.labs16.com/

    Click Create to start a new project. Choose the sign-in path or create the device from scratch. If you are already signed in, you can select the LTR-329 from the list of devices available, Otherwise, name your project, type in the Device ID (as noted above, the Device ID for this board is 0x29) and select custom. Click on Create.

    Click on Pkt Builder from the Page Nav. Here you will create your custom packet protocol based on the Packet Payload Definition steps. Page 14 of the datasheet shows the device using a One Byte interface. 

    Click on the Edit pencil for the One Byte protocol to edit the Send and Fetch fields to match the Defined Packet Payload. Click the ‘+’ sign under each section to add Send and Fetch steps.

    Save
  • By lightwoheat

    KB2040 as I2C Bridge with GUI Control

    Use your KB2040 to create a USB to I2C Bridge to connect to your I2C Peripherals. The UXB-300 is a browser-based GUI builder that lets you wire up register-level controls of an IC without touching any code. Below are the details using the LPS22 as the peripheral. 

    Hardware Used:

    USB Bridge: Raspberry Pi - KB2040 : https://www.adafruit.com/product/5302

    Peripheral : Temperature & Pressure Sensor - LPS22HB: https://www.adafruit.com/product/4633

    Schematic/Datasheet: https://learn.adafruit.com/adafruit-lps25-pressure-sensor/downloads

    Cables: USB-C Cable between PC and KB2040 https://www.adafruit.com/product/4474

    Qwiic cable between KB204 and LPS22HB https://www.adafruit.com/product/4399

    The Arduino IDE 2.3.8 was used to create and load a sketch onto the KB2040. The UXB-300 was used to create a GUI to control the peripheral and display the results in real time.

     Links to Sketch and GUI:

    Arduino Sketch: m5stickC_esp32s3_i2c_oled.ino  : https://github.com/labs16/KB2040-I2C-Bridge

    UXB-300 LPS22HB GUI: https://apps.labs16.com/poverholt/kb2040_i2c_lps22

     Just want to jump in? Connect to your KB2040 with LPS22HB Hardware, click the UXB-300 LPS22HB GUI link above, and skip to the Connect Hardware and Control with GUI step below.

     Want to build it yourself?  Continue to follow along…

     Detailed Steps to do on your own: ( Define | Create | Connect )

     The Raspberry Pi has USB OTG capability and is configured in the sketch to use serial protocol to send and fetch I2C commands. The UXB-300 GUI can be easily configured to communicate with the KB2040 and interactively communicate via I2C with the peripherals. 

     Since the KB2040 is used as a USB bridge, we need to define the serial data I will be sending and receiving between the KB2040 and the UXB-300 GUI over USB. The packet payload definition will, at a minimum, need to support the peripheral being used - in this case an LPS22HB.

     Packet Payload Definition: (byte count varies with data length) 

                 < Byte0 > < Byte1 > < Byte3 >< Byte4 >.....< Byte8 >

     < Byte0 > = Mode/Size Byte and it contains information on whether it is a Block Transfer and the Size(Bytes) of the Data. The High Nibble determines if it is Block and the Lower Nibble is the size of the Data Transfer. A High Nibble of  0xB indicates a block transfer.

     Example: 0xB2 means Block of length two bytes, 0x04 means non-block of length four bytes.

     < Byte1 > =  R/W Byte: Read = 0x72 and Write = 0x77

     < Byte2 > = dev-id = 7-bit Device Address for the peripheral

     < Byte3 > = ADDR = register address in Hex

     < Byte4:N Bytes > = DATA sent / received

    < Byte N+1 > ERROR Byte

     The Packet Payload Definition above was used for this project. This definition is flexible — both the sketch and GUI packet builder are easy to adjust per your application.

     The peripheral datasheet and peripheral schematic allow us to confirm the settings and that the definition above is sufficient. The peripheral is non-block with a data size of one byte.    

    Byte0 = 0x01

     dev-id (7-bit) Device Address is as follows:

    101110xb, where x reflects the SDO/SA0 pad state (labeled SDO/ADR on the schematic, pulled high to 3.3V via R4).

     Byte 2 = dev-id (7-bit) = 1011101b = 0x5D

     Table 16 from the datasheet provides the supported Register Addresses, which are one byte in size, together with the datalength which is shown to be one byte in size as well.

     The ERROR Byte will be returned by the KB2040 (0x00 if no error, 0xFF if error)

     This translates to the following for writing and reading from the peripheral using the KB2040 as a USB bridge.

     Send: 0x01 0x77 0x5D

    Fetch : 0x01 0x72 0x5D

     - Bold indicates bytes returned from the KB2040 versus sent from the host.

     

    The Arduino Sketch uses Adafruit’s KB2040 board, which is available via Board Manager on the Arduino IDE under Raspberry Pi Pico/RP2040/RP2350. The Adafruit NeoPixel Library was installed. 

     Normally you'd write something custom on the host side to read these registers — UXB-300 handles that, letting you go skip straight to the hardware. The tool is available at 

    https://uxb-300.labs16.com/

    Click Create to start a new project. Choose the sign-in path or create the device from scratch. If you are already signed in, you can select the LPS22 from the list of devices available, Otherwise, name your project, type in the Device ID (as noted above, the Device ID for this board is 0x5D) and select custom. Click on Create.

     

     

    Save
Search

Getting Started

Adafruit Playground is a wonderful and safe place to share your interests with Adafruit's vibrant community of makers and doers. Have a cool project you are working on? Have a bit of code that you think others will find useful? Want to show off your electronics workbench? You have come to the right place.

The goal of Adafruit Playground is to make it as simple as possible to share your work. On the Adafruit Playground users can create Notes. A note is a single-page space where you can document your topic using Adafruit's easy-to-use editor. Notes are like Guides on the Adafruit Learning System but guides are high-fidelity content curated and maintained by Adafuit. Notes are whatever you want them to be. Have fun and be kind.

Click here to learn more about Adafruit Playground and how to get started.

    • Contact Us
    • Tech Support Forums
    • FAQs
    • Shipping & Returns
    • Freebies
    • Terms of Service
    • Privacy & Legal
    • Website Accessibility
    • LLMs.txt
    • About Us
    • Press
    • Educators
    • Distributors
    • Jobs
    • Gift Cards
    "How wonderful it is that nobody need wait a single moment before starting to improve the world"
    Anne Frank
    Adafruit Logo
    A Minority and Woman-owned Business Enterprise (M/WBE)