Skip to content

Pin Reference

PinGPIOFunction
SCLGPIO 1I2C Clock
SDAGPIO 2I2C Data
VCC3.3VPower
GNDGNDGround

Cable colors: Yellow = SDA, White = SCL, Red = VCC, Black = GND

FeatureGPIONotes
Button A (front)GPIO 35User button
IR TransmitterGPIO 4Infrared LED
RGB LED (NeoPixel)GPIO 21WS2812 addressable LED
DisplaySPI0.49” OLED, 64x32
BuzzerGPIO 2Shared with SDA on Port A

When you run an I2C scan, these are common device addresses:

AddressDevice
0x38Atom Motion base
0x44SHT30 (ENV III temperature/humidity)
0x5DAXP2101 (Power management)
0x68MPU6886 (IMU / accelerometer)
0x76BMP280 (Pressure sensor)
import machine
i2c = machine.I2C(0, scl=machine.Pin(1), sda=machine.Pin(2), freq=100000)
devices = i2c.scan()
print("I2C devices found:", [hex(addr) for addr in devices])

import machine
from unit import ENV_III
import time
# Port A is I2C0 on pins 1 (SCL) and 2 (SDA)
i2c = machine.I2C(0, scl=machine.Pin(1), sda=machine.Pin(2), freq=100000)
env = ENV_III(i2c)
# Wait for sensor startup
time.sleep(1)
# Read (with error handling)
try:
temp, hum, press = env.read()
except:
print("Sensor not ready")
from machine import Pin, PWM
import time
# Pin 2 is common for servo on header
servo = PWM(Pin(2), freq=50)
def set_angle(angle):
# Convert 0-180 to duty cycle
duty = int((angle / 180 * 2 + 0.5) / 20 * 1023)
servo.duty(duty)
# Test
set_angle(90)
time.sleep(1)
set_angle(0)

Setup C: Multiple I2C Sensors (HUB Required)

Section titled “Setup C: Multiple I2C Sensors (HUB Required)”
# Scan first to see addresses
devices = i2c.scan()
print("Found:", [hex(d) for d in devices])
# If you see conflicts (two 0x44), you need:
# 1. Different I2C ports (Port A vs Port B), OR
# 2. I2C multiplexer, OR
# 3. Different sensor models with different addresses
Current page
🤖