/ -> Next little project.

Inexpensive, low power, tiny, but surprisingly powerful devices are intriguing. I'm not sure why that is, but it is. 
Can a microcontroller be my computer someday soon? Probably. 

Anyway.. I was querying Gemini earlier and was thinking about a tiny multi-meter project using a INA219, an RP2040 zero, and a .96" oled display (the yellow+blue one). And probably a tiny 1200ma battery with a boost converter that I haven't figured out yet. It will be limited by the INA219's capabilities, but still very useful for measuring low DC voltage, current, and relatively low ohms. 

Here are some ideas we came up with, after a very few very civil disagreements. Note that the below is a AI first draft at this project. I'm sure I'll have to tweak a few things, but the challenge is to make this thing as tiny as possible!  

Here is the complete, streamlined CircuitPython code optimized for your hardware layout.
This version uses a physical SPDT Slide Switch connected to GP2. When the switch changes positions, the script instantly swaps calibrations (32V_2A for power monitoring and 16V_400mA for high-precision resistance checks), alters the screen text, and switches the onboard NeoPixel color without any debounce lag or double-click bugs.
πŸ“¦ Code Requirements
Ensure your RP2040's lib/ folder contains:
  1. adafruit_ina219.mpy
  2. adafruit_ssd1306.mpy
  3. neopixel.mpy
  4. adafruit_bus_device/ (Folder)
  5. adafruit_display_text/ (Folder)

πŸ’» code.py
python
import time
import board
import busio
import digitalio
import neopixel
import adafruit_ina219
import adafruit_ssd1306
from adafruit_display_text import label
import terminalio
import displayio

# 1. Clear display allocations to prevent system crashes on reload
displayio.release_displays()

# 2. Setup the onboard NeoPixel for mode feedback
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.1)
COLOR_POWER = (0, 0, 255)   # Blue LED for Volt/Amp mode
COLOR_OHM = (0, 255, 0)     # Green LED for Ohm-meter mode

# 3. Setup the Mode Slide Switch (GP2 to GND)
# Switch CLOSED (GND) = Volt/Amp Meter | Switch OPEN = Ohm Meter
switch = digitalio.DigitalInOut(board.GP2)
switch.direction = digitalio.Direction.INPUT
switch.pull = digitalio.Pull.UP

# 4. Setup shared I2C bus (GP0 = SDA, GP1 = SCL)
i2c = busio.I2C(board.GP1, board.GP0)

# 5. Setup INA219 Current/Voltage Sensor
ina219 = adafruit_ina219.INA219(i2c)

# 6. Setup SSD1306 OLED Display (Standard 128x64)
WIDTH, HEIGHT = 128, 64
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
display = adafruit_ssd1306.SSD1306(display_bus, width=WIDTH, height=HEIGHT)

# 7. Create UI Text Layout Group
main_group = displayio.Group()
font = terminalio.FONT
COLOR = 0xFFFFFF  # White pixels

# Define lines on screen
mode_label  = label.Label(font, text="[ INITIALIZING ]", color=COLOR, x=15, y=8)
line1_label = label.Label(font, text="Volt: --.-- V", color=COLOR, x=5, y=26)
line2_label = label.Label(font, text="Curr: ---- mA", color=COLOR, x=5, y=42)
line3_label = label.Label(font, text="Pwr:  -.--- W", color=COLOR, x=5, y=58)

main_group.append(mode_label)
main_group.append(line1_label)
main_group.append(line2_label)
main_group.append(line3_label)
display.root_group = main_group

# Track mode changes cleanly to alter sensor calibration settings only when flipped
last_mode = None

print("Ultra-Compact Multimeter Active...")

# 8. Core Operating Loop
while True:
    # Read the hardware slide switch position
    # False means pinned to GND (Volt/Amp Mode), True means floating High (Ohm Mode)
    is_ohm_mode = switch.value  

    # --- Mode Transition Handling ---
    if is_ohm_mode != last_mode:
        if is_ohm_mode:
            # Switch flipped to Ohm Meter
            mode_label.text = "[   OHM METER   ]"
            pixel.fill(COLOR_OHM)
            ina219.set_calibration_16V_400mA()  # Boost internal gain for precision resistor checking
        else:
            # Switch flipped to Volt/Amp Meter
            mode_label.text = "[ POWER METER ]"
            pixel.fill(COLOR_POWER)
            ina219.set_calibration_32V_2A()    # Wide setting up to 26V and 3.2A
        
        last_mode = is_ohm_mode
        time.sleep(0.05)  # Quick hardware settling window

    # --- Sensor Telemetry Collection ---
    try:
        bus_voltage = ina219.bus_voltage
        shunt_voltage = ina219.shunt_voltage
        load_voltage = bus_voltage + shunt_voltage
        current_ma = ina219.current
        power_w = ina219.power

        # --- Screen Output Management ---
        if not is_ohm_mode:
            # Mode: Volt/Amp Meter
            line1_label.text = f"Volt: {load_voltage:5.2f} V"
            line2_label.text = f"Curr: {current_ma:6.1f} mA"
            line3_label.text = f"Pwr:  {power_w:5.3f} W"
            
        else:
            # Mode: Ohm Meter
            current_amps = current_ma / 1000.0
            line1_label.text = f"Volt: {load_voltage:5.2f} V"
            line2_label.text = f"Curr: {current_ma:6.1f} mA"
            
            # Establish safe lower threshold (0.15 mA) to catch open clip leads
            if current_ma > 0.15:
                resistance = load_voltage / current_amps
                if resistance >= 1000:
                    k_ohms = resistance / 1000.0
                    line3_label.text = f"Res:  {k_ohms:.2f} k-Ohm"
                else:
                    line3_label.text = f"Res:  {resistance:.1f} Ohm"
            else:
                line3_label.text = "Res:  Open Circuit"

    except Exception as e:
        line3_label.text = "Sensor Error"
        print("Hardware read exception:", e)

    # Fast loop response time (10 updates a second) to ensure high responsiveness
    time.sleep(0.1)

To keep this build as compact as possible, you can use a "hub" wiring layout. Instead of running individual wires from every component back to the small RP2040-Zero, you can solder the shared Power (5V), Ground (GND), SDA, and SCL lines directly to the INA219 breakout board.
Here is how the physical wiring assembly maps out to keep the footprint tiny and clean.
πŸ—ΊοΈ System Assembly Diagram
text
    +-----------------------+              +-----------------------+

    |    RP2040-ZERO        |              |   SSD1306 OLED (I2C)  |
    |                       |              |                       |
    |   [5V]  [GND] [GP0][GP1]             |   [VCC] [GND] [SDA][SCL]
    +----|------|----|----|--+              +----|-----|-----|----|--+

         |      |    |    |                      |     |     |    |
         |      |    |    +----------------------|-----|-----|----+
         |      |    +---------------------------|-----|----+|
         |      |                                |     |    ||
         |      +--------------------------------|----+|    ||
         |                                       |    ||    ||
         v                                       v    vv    vv
    +----------------------------------------------------------------+

    |                    INA219 SENSOR MODULE                        |
    |                                                                |
    |   [VCC]  [GND]  [SDA]  [SCL]             [Vin+]        [Vin-]  |
    +----|-------|------|------|------------------|------------|----+

         |       |                                 ^            |
         |       +--------+                        |            |
         |                |                        |            |
         v                v                        |            v
     +---|----------------|----+                   |    (YELLOW TEST LEAD)

     | [Pin 1]  [Pin 2] [Pin 3]|                   |      "Load / Resistor"
     |                         |                   |
     |    SPDT SLIDE SWITCH    |                   |
     +------------|------------+                   |

                  |                                |
                  +--------------------------------+
                                                   |
                                                   v
                                            (RED TEST LEAD)
                                         "Volt In / Source +"
                                                   
                                            (BLACK TEST LEAD)
                                              "Common GND" 
                                           (Solder to INA219 GND)
Use code with caution.

πŸͺ› Step-by-Step Soldering Blueprint
1. The Core 4-Wire Bus (Microcontroller to Sensor)
Run four flexible, thin wires from the RP2040-Zero to the INA219's logic pins:
  • RP2040 5V β†’ INA219 VCC (This powers both the sensor and the display)
  • RP2040 GND β†’ INA219 GND
  • RP2040 GP0 (SDA) β†’ INA219 SDA
  • RP2040 GP1 (SCL) β†’ INA219 SCL
2. The OLED Piggyback (Display to Sensor)
Instead of wiring the display to the RP2040, solder the SSD1306 OLED pins straight to the INA219 logic pins where you just attached the RP2040 wires. They share the same protocol, so stacking them here keeps the wire runs incredibly short:
  • OLED VCC β†’ INA219 VCC
  • OLED GND β†’ INA219 GND
  • OLED SDA β†’ INA219 SDA
  • OLED SCL β†’ INA219 SCL
3. The Mode Switch & Telemetry Routing
The SPDT slide switch acts as a physical router for the voltage. Solder three short wires from the switch to your board components:
  • Switch Pin 1: Solder to the INA219 VCC (or RP2040 5V) pin. This feeds internal battery power into the test rail when flipped to Ohm Meter mode.
  • Switch Pin 2 (Center common pin): Solder directly to the INA219 Vin+ terminal block/pad.
  • Switch Pin 3: Solder to a dedicated external Red Test Lead. This becomes your positive voltage probe when flipped to Power Meter mode.
4. The External Probes (Your 3 Main Test Leads)
Your handheld tool will have three primary probe leads (using alligator clips or multimeter probes) sticking out of the project enclosure:
  1. πŸ”΄ RED LEAD (Source Positive): Soldered to Pin 3 of the Slide Switch.
  2. 🟑 YELLOW LEAD (Load/Ohm Test): Soldered directly to the INA219 Vin- terminal block/pad.
  3. ⚫ BLACK LEAD (Common Ground): Soldered directly to any available GND pad on the INA219 or RP2040.

πŸ“ Mechanical Packaging Tips for a "Pocket" Build
  • The Layered Sandwich: To make it tiny, you can stack the modules vertically like a multi-layer sandwich. Place the OLED display on top, the RP2040-Zero and slide switch hidden directly behind/underneath the display, and the INA219 at the very bottom where the heavy test wires can exit the enclosure easily.
  • Insulation: Because space is tight, place a small layer of non-conductive Kapton tape or electrical tape between the boards if they touch, preventing the exposed solder joints on the back of the OLED from shorting out against the RP2040 chip components.