[{"element_type":"text","content":"\u003cp\u003eUse 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 \u003ca href=\"https://github.com/geo-tp/ESP32-Bit-Pirate\"\u003eESP32 Bit Pirate\u003c/a\u003e, 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.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/652/original/uxb300-lps22-live.png?1792945559","metadata":{}},{"element_type":"text","content":"\u003ch4\u003e\u003cstrong\u003eHardware Used:\u003c/strong\u003e\u003c/h4\u003e\u003cp\u003eBoard: \u003ca href=\"https://www.digikey.com/en/products/detail/seeed-technology-co-ltd/113991114/19285530\"\u003eSeeed XIAO ESP32-S3\u003c/a\u003e\u003cbr\u003eExpansion Board (optional): \u003ca href=\"https://www.digikey.com/en/products/detail/seeed-technology-co-ltd/103030356/13572081\"\u003eSeeed XIAO Expansion Board\u003c/a\u003e\u003cbr\u003eSensor: \u003ca href=\"https://www.adafruit.com/product/4633\"\u003eAdafruit LPS22 Pressure Sensor - STEMMA QT\u003c/a\u003e\u003cbr\u003eCable: \u003ca href=\"https://www.adafruit.com/product/4528\"\u003eGrove to STEMMA QT Cable - 100mm\u003c/a\u003e (also at \u003ca href=\"https://www.digikey.com/en/products/detail/adafruit-industries-llc/4528/11627737\"\u003eDigiKey\u003c/a\u003e)\u003cbr\u003eUSB-C data cable\u003c/p\u003e\u003ch4\u003e\u003cstrong\u003eLinks to Firmware and GUI:\u003c/strong\u003e\u003c/h4\u003e\u003cp\u003eFirmware: \u003ca href=\"https://geo-tp.github.io/ESP32-Bit-Pirate/webflasher/\"\u003eESP32 Bit Pirate Web Flasher\u003c/a\u003e (thanks to geo-tp for the \u003ca href=\"https://github.com/geo-tp/ESP32-Bit-Pirate\"\u003eESP32 Bit Pirate\u003c/a\u003e project)\u003cbr\u003eTerminal: \u003ca href=\"https://geo-tp.github.io/ESP32-Bit-Pirate/web-tools/web-serial-terminal/\"\u003eBit Pirate Web Serial Terminal\u003c/a\u003e\u003cbr\u003eGitHub: \u003ca href=\"https://github.com/labs16/ESP32S3_BPIO2_I2CBridge\"\u003eESP32S3_BPIO2_I2CBridge\u003c/a\u003e\u003cbr\u003eGUI: \u003ca href=\"https://uxb-300.labs16.com/?utm_source=adafruit\u0026amp;utm_medium=social\u0026amp;utm_campaign=bitpirate-nov\u0026amp;utm_content=project-page\"\u003eUXB-300\u003c/a\u003e (Chrome or Edge on desktop)\u003c/p\u003e\u003cp\u003e\u003cstrong\u003eSet up the XIAO: ( Flash | BPIO2 )\u003c/strong\u003e\u003c/p\u003e\u003cp\u003e\u003cstrong\u003eFlash:\u003c/strong\u003e Open the \u003ca href=\"https://geo-tp.github.io/ESP32-Bit-Pirate/webflasher/\"\u003eweb flasher\u003c/a\u003e in Chrome or Edge. Hold \u003cstrong\u003eBOOT\u003c/strong\u003e on the XIAO while you plug in USB, select \u003cstrong\u003eXiao ESP32-S3\u003c/strong\u003e, then click \u003cstrong\u003eFlash selected firmware\u003c/strong\u003e.\u003c/p\u003e\u003cp\u003e\u003cstrong\u003eBPIO2:\u003c/strong\u003e Open the \u003ca href=\"https://geo-tp.github.io/ESP32-Bit-Pirate/web-tools/web-serial-terminal/\"\u003eweb serial terminal\u003c/a\u003e, click \u003cstrong\u003eConnect\u003c/strong\u003e and press any key. Then type:\u003c/p\u003e","metadata":{}},{"element_type":"code","content":"HIZ\u003e mode\nMode Number \u003e 12\nConfigure SD card GPIOs for USB? [n]: \u003cEnter\u003e\nUSB\u003e adapters\nEnter index (default 9): 8\nBPIO2 GPIOs IO0..IO7 [1 2 4 3 6 5 0 7]: 1 6 5 7 2 4 3 0","metadata":{"language":"auto","filename":""}},{"element_type":"text","content":"\u003cp\u003eThe XIAO reboots into BPIO2 adapter mode and the terminal closes. The GPIO list puts I2C on GPIO6 (SCL) and GPIO5 (SDA), the expansion board's Grove I2C port. Press \u003cstrong\u003eRESET\u003c/strong\u003e to return to normal Bit Pirate mode.\u003c/p\u003e\u003cp\u003e\u003cstrong\u003eNOTE:\u003c/strong\u003e Avoid pressing \u003cstrong\u003eRESET\u003c/strong\u003e while you're using UXB-300. A reset takes the XIAO out of BPIO2 mode, and you'd have to repeat the BPIO2 step above to get it back.\u003c/p\u003e\u003cp\u003ePlug the Grove end of the cable into the expansion board's I2C Grove port and the STEMMA QT end into the LPS22.\u003c/p\u003e\u003ch4\u003e\u003cstrong\u003eTry it now:\u003c/strong\u003e\u003c/h4\u003e\u003cp\u003eUXB-300 LPS22 GUI: \u003ca href=\"https://apps.labs16.com/lightwoheat/BPIO2_I2C_LPS22?utm_source=adafruit\u0026amp;utm_medium=social\u0026amp;utm_campaign=bitpirate-nov\u0026amp;utm_content=gui-link\"\u003ehttps://apps.labs16.com/lightwoheat/BPIO2_I2C_LPS22\u003c/a\u003e\u003c/p\u003e\u003cp\u003eWith the XIAO in BPIO2 mode and the LPS22 plugged in, open the link above. On the \u003cstrong\u003eConnection\u003c/strong\u003e page, click \u003cstrong\u003eConnect\u003c/strong\u003e, pick \u003cstrong\u003eESP32 Bit Pirate\u003c/strong\u003e, and click \u003cstrong\u003eConnect\u003c/strong\u003e.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/653/original/uxb300-usb-connected.png?1792945759","metadata":{}},{"element_type":"text","content":"\u003cp\u003eOn the \u003cstrong\u003eModel\u003c/strong\u003e page, click \u003cstrong\u003eWrite All\u003c/strong\u003e (top left) to configure the LPS22, then turn on \u003cstrong\u003ePolling\u003c/strong\u003e. TempC and TempF update live.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/654/original/uxb300-lps22-live.png?1792946548","metadata":{}},{"element_type":"text","content":"\u003ch4\u003e\u003cstrong\u003eMake it yours:\u003c/strong\u003e\u003c/h4\u003e\u003cp\u003eRegister free to unlock the Factory Projects catalog of ready-made ICs, then save and tweak your own copy.\u003c/p\u003e\u003cp\u003eOpen \u003ca href=\"https://uxb-300.labs16.com/?utm_source=adafruit\u0026amp;utm_medium=social\u0026amp;utm_campaign=bitpirate-nov\u0026amp;utm_content=project-page\"\u003eUXB-300\u003c/a\u003e, click \u003cstrong\u003eCreate\u003c/strong\u003e, then \u003cstrong\u003eBrowse\u003c/strong\u003e and \u003cstrong\u003eRegister / Sign In\u003c/strong\u003e.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/655/original/uxb300-factory-register.png?1792947648","metadata":{}},{"element_type":"text","content":"\u003cp\u003eSigned in, \u003cstrong\u003eSelect\u003c/strong\u003e the \u003cstrong\u003eLPS22HB\u003c/strong\u003e, set Device ID to \u003ccode\u003e0x5D\u003c/code\u003e, choose \u003cstrong\u003eBus/Bit Pirate BPIO2 I2C\u003c/strong\u003e and click \u003cstrong\u003eCreate\u003c/strong\u003e.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/656/original/uxb300-project-settings.png?1792947703","metadata":{}},{"element_type":"text","content":"\u003cp\u003eOn the \u003cstrong\u003eConnection\u003c/strong\u003e page, click \u003cstrong\u003eConnect\u003c/strong\u003e and pick \u003cstrong\u003eESP32 Bit Pirate\u003c/strong\u003e. Click \u003cstrong\u003eScan\u003c/strong\u003e: 0x3C and 0x51 are the OLED and RTC on the expansion board, and \u003cstrong\u003e0x5D\u003c/strong\u003e is the LPS22.\u003c/p\u003e\u003cp\u003e\u003cstrong\u003eNOTE:\u003c/strong\u003e On the Seeed XIAO expansion board, IO4 (D1, GPIO2) and IO7 (GPIO0) are connected to hardware on that board and don't stay at HiZ on their own. Set both to \u003cstrong\u003eHiZ\u003c/strong\u003e in the panel before you scan. Wired straight to the XIAO? You can skip this.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/657/original/uxb300-bpio2-scan.png?1792947744","metadata":{}},{"element_type":"text","content":"\u003cp\u003eSet the Device Address to \u003ccode\u003e0x5D\u003c/code\u003e.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/658/original/uxb300-device-connection.png?1792947778","metadata":{}},{"element_type":"text","content":"\u003cp\u003eA fresh project starts the LPS22 at its power-on defaults, so wake it up: in \u003cstrong\u003eBackstage\u003c/strong\u003e, type \u003cstrong\u003e40\u003c/strong\u003e into CTRL_REG1 (0x10) and press Enter.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/659/original/uxb300-ctrl-reg1-40.png?1792947818","metadata":{}},{"element_type":"text","content":"\u003cp\u003eRead registers \u003cstrong\u003e0x28–0x2C\u003c/strong\u003e for the raw pressure and temperature bytes.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/660/original/uxb300-press-temp-regs.png?1792947884","metadata":{}},{"element_type":"text","content":"\u003cp\u003eTo watch them live, open the \u003cstrong\u003eEditor\u003c/strong\u003e, change Access on 0x28–0x2C from Read to \u003cstrong\u003ePoll\u003c/strong\u003e and set the Poll Rate (500 ms is a good start).\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/661/original/uxb300-register-poll-rate.png?1792947926","metadata":{}},{"element_type":"text","content":"\u003cp\u003eThen switch on \u003cstrong\u003eP\u003c/strong\u003e under Transactions.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/662/original/uxb300-transactions-poll.png?1792947962","metadata":{}},{"element_type":"text","content":"\u003cp\u003eThat's it: the pressure and temperature calculations now update in real time.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/663/original/uxb-300_poll.png?1792948004","metadata":{}},{"element_type":"text","content":"\u003ch4\u003e\u003cstrong\u003eStep by step (no account):\u003c/strong\u003e\u003c/h4\u003e\u003cp\u003eRather not sign in? Build the LPS22 model yourself. In \u003ca href=\"https://uxb-300.labs16.com/?utm_source=adafruit\u0026amp;utm_medium=social\u0026amp;utm_campaign=bitpirate-nov\u0026amp;utm_content=project-page\"\u003eUXB-300\u003c/a\u003e, click \u003cstrong\u003eCreate\u003c/strong\u003e, then \u003cstrong\u003eBrowse\u003c/strong\u003e and \u003cstrong\u003eContinue without (Custom)\u003c/strong\u003e. Name your project, set Device ID to \u003ccode\u003e0x5D\u003c/code\u003e, choose \u003cstrong\u003eBus/Bit Pirate BPIO2 I2C\u003c/strong\u003e and click \u003cstrong\u003eCreate\u003c/strong\u003e. The BPIO2 dongle is built in, so there are no packets to define.\u003c/p\u003e\u003cp\u003eIn the \u003cstrong\u003eEditor\u003c/strong\u003e, click \u003cstrong\u003e+\u003c/strong\u003e under IC Registers.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/664/original/uxb-300_IC_reg.png?1792948055","metadata":{}},{"element_type":"text","content":"\u003cp\u003eEnter the addresses \u003ccode\u003ef-12, 27-2c\u003c/code\u003e and click \u003cstrong\u003eCreate\u003c/strong\u003e.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/665/original/uxb-300_CR.png?1792948094","metadata":{}},{"element_type":"text","content":"\u003cp\u003eClick register 0x10 and set Name to \u003cstrong\u003eCTRL_REG1\u003c/strong\u003e, Access to \u003cstrong\u003er/w immediate\u003c/strong\u003e and Packet to \u003cstrong\u003eOne Byte\u003c/strong\u003e. Name 0x0F \u003cstrong\u003eWHO_AM_I\u003c/strong\u003e, 0x2B \u003cstrong\u003eTEMP_OUT_L\u003c/strong\u003e and 0x2C \u003cstrong\u003eTEMP_OUT_H\u003c/strong\u003e the same way.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/666/original/uxb-300_param.png?1792948130","metadata":{}},{"element_type":"text","content":"\u003cp\u003eClick the \u003cstrong\u003eGear\u003c/strong\u003e icon and select \u003cstrong\u003eMulti-Registers\u003c/strong\u003e.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/667/original/uxb-300_mreg1.png?1792948221","metadata":{}},{"element_type":"text","content":"\u003cp\u003eClick \u003cstrong\u003e+\u003c/strong\u003e to add a multi-register for temperature.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/668/original/uxb-300_mreg2.png?1792948255","metadata":{}},{"element_type":"text","content":"\u003cp\u003eName it \u003cstrong\u003eTemperature\u003c/strong\u003e and add \u003cstrong\u003eTEMP_OUT_H\u003c/strong\u003e (1) and \u003cstrong\u003eTEMP_OUT_L\u003c/strong\u003e (0), bits 7-0, to form the 16-bit value.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/669/original/uxb-300_mreg3.png?1792948284","metadata":{}},{"element_type":"text","content":"\u003cp\u003eClick the pencil next to \u003cstrong\u003eParameter\u003c/strong\u003e and add the converters: \u003ccode\u003evalue * 0.01\u003c/code\u003e for TempC and \u003ccode\u003evalue * 0.01 * 1.8 + 32\u003c/code\u003e for TempF.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/670/original/uxb-300_mreg_param.png?1792948326","metadata":{}},{"element_type":"text","content":"\u003cp\u003eNow connect, scan and set the address to 0x5D as in Make it yours above. Write \u003cstrong\u003e40\u003c/strong\u003e to CTRL_REG1, switch on \u003cstrong\u003eP\u003c/strong\u003e under Transactions, and TempC and TempF update live.\u003c/p\u003e","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/002/671/original/uxb-300_poll.png?1792948360","metadata":{}},{"element_type":"text","content":"\u003cp\u003eSave your project so you can load it again later.\u003c/p\u003e\u003ch4\u003e\u003cstrong\u003eNext Steps:\u003c/strong\u003e\u003c/h4\u003e\u003cp\u003eAdd pressure: create a multi-register from PRESSURE_OUT_XL, PRESSURE_OUT_L and PRESSURE_OUT_H (0x28 to 0x2A) and set the converter to value/4096 for hPa.\u003cbr\u003eThe same GPIO list also gives you SPI (IO0 to IO3), so try an SPI sensor next.\u003c/p\u003e\u003cp\u003eWe'd love your feedback - and let us know what other examples you'd like to see.\u003c/p\u003e","metadata":{}}]