Pimoroni pico breakout garden base no i2c devices found

Hi, I try to put in use a recently delivered Pimoroni Pico Breakout Garden Base. On it connected a Raspberry Pi Pico, in I2C slot #1 a BG adapter with via Qwiic cable an Adafruit TM117 temperature sensor. In I2C slot #3 a BG RV3028 rtc. CircuitPython flashed. The contents of file boot_out.txt =

Board ID:raspberry_pi_pico```.

In code.py the following lines:

import board
import busio
# NOTE the dir(board) result does not show I2C so I had to use busio.I2C instead
i2c = busio.I2C(scl=board.GP5, sda=board.GP4)

while not i2c.try_lock():

print("I2C devices found: ", [hex(i) for i in i2c.scan()])

The result of the scan is: 
"I2C devices found:  []"

Note: the RV3028 I use successfully on a Pimoroni pico explorer board (which has 2 BG connectors)-

Give this a try, its what works for me. I think it works for circuit python? I know for sure it works in Micro Python.

import machine
sda=machine.Pin(4) # Explorer 20 Breakout 4
scl=machine.Pin(5) # Explorer 21 Breakout 5
i2c=machine.I2C(0,sda=sda, scl=scl, freq=400000)
print('Scan i2c bus...')
devices = i2c.scan()
if len(devices) == 0:
  print("No i2c device !")
  print('i2c devices found:',len(devices))
  for device in devices:  
    print("Decimal address: ",device," | Hex address: ",hex(device))

Hi @alphanumeric. Thank you for your suggestion. I tried already ‘import machine’ but the reply is that ‘machine’ is unknown in CircuitPython. I searched a whole bunch of Adafruit libraries that I have in my desktop PC but I didn’t find a module ‘machine’. I think it is a module specific for MicroPython.
Pity. What I can do is to flash Micropython and then start from beginning, but I am not so familiar with MPY.

The last time I used that code was likely with the Pimoroni Micro Python uf2 image.

On the plus side, if it works for you in Micro Python and you get all the right numbers back. You’ll know your hardware is good, its just a code issue in what you posted above.

I flashed Pimoroni micropython. In a RPi400 I installed various libraries that were asked for, when using the Thonny IDE, after installing module ‘machine’. Finally got stuck with ‘module ffi not found’. Then I did the following (since I possess various Pico’s): I exchanged the Pico. I flashed it with Pimoroni’s ciruitpython; installed various needed libaries in CIRCUITPY/lib, then created a code.py script. This time the script reported the existance of my RV3028 BG device and a BG adapter with an Adafruit TMP117 board connected. I have to check again if the fault was in the RPi Pico initially used.

There is a flash_nuke.uf2 file here, that will erase everything and give the PICO a clean start.
Raspberry Pi Documentation - Raspberry Pi Pico

Thank you. I already used that today.

I have the OLED working, finally! I found an example at:

I only had to adapt the pin numbers and the rotation. Now I can go to work on displaying the temperature from the TMP117 sensor and also date and time from the RV3028 BG rtc.

1 Like

This is what I ended up with, BME688 and a 1.54" SPI Color Square LCD (240x240) Breakout. Pimoroni Micro Python uf2. On the right is pressure. Pictures not the best, the readings change color based on what they are.
It started here,
Need Help: Pico weather station guide using the Pico Explorer - Discussion / Learning Resources - Pimoroni Buccaneers

Your picture is OK to me!
I am ‘struggeling’ a bit with the code. I expanded the script to display the temperature from the TMP117 sensor in that big white frame down but the displayed temperature value is getting garbled after some updates. I tried to write first a string of 12 spaces (in color white) but that doesn’t work for one way or the other. I studied the source listings of the various modules used. I did not find a suitable function to call to cleanup a label. So, for the moment I think the only way to work around this text-filling-up is to re-write the whole display every loop which in a way is stupid when you only want to update a temperature value.

As a wild suggestion just before updating the display could you perhaps try re-writing the current data in the same place as original but white character on white background (thus “clearing” the display) then switch back to black character on white background before writing the new data.

Hi @neilman Thank you for the suggestion. I go to try that. In the mean time I changed the script. I decided to rewrite the whole screen every loop. That has the wanted result. And above that I cannot see the refresh than only the numbers of the temperature value changing. I also replaced repetitive sequences by for… loops.

You might be able to just repaint that one white square, then the text in it?
Mine is redrawn every time with a clear first.


Posting the code your using might help.

@alphanumeric thank you for that tip!.
Here is my script:

# SPDX-License-Identifier: Unlicense
# 2021-12-19 22h00, by @Paulskpt
# Downloaded from:
# https://learn.adafruit.com/adafruit-monochrome-1-12-in-128x128-oled/circuitpython.
# After modifying pin numbers for the actual hardware, the OLED was displaying text.
# I only had to change the ROTATION TO 270 degrees to have the orientation in the right way.
# This is version 2.0
# In this version are implemented various measures to prevent exaust of memory.
Based on example by Mark Roberts (mdroberts1243).

This example writes text to the display, and draws a series of squares and a rectangle.
import sys
import time
import board
import busio
import displayio
import terminalio
import adafruit_tmp117
from adafruit_display_text import bitmap_label as label
from adafruit_displayio_sh1107 import SH1107, DISPLAY_OFFSET_ADAFRUIT_128x128_OLED_5297


# Global variable definitions
display = None
tmp117 = None
# Width, height and rotation for Monochrome 1.12" 128x128 OLED
WIDTH = 128
HEIGHT = 128
# Border width

def setup():
    global SH1107, display, WIDTH, HEIGHT, ROTATION, BORDER, tmp117

    # For SPI:
    dc = board.GP16
    cs = board.GP17  # for BG SPI socket A (front). GP22 for socket B
    sck = board.GP18
    mosi = board.GP19
    rst = board.GP20  # for BG SPI socket A (front). GP21 for socket B

    spi_bus = busio.SPI(sck, mosi)
    display_bus = displayio.FourWire(spi_bus, command=dc, chip_select=cs, reset=rst)

    display = SH1107(

    # i2c for sensors like the TMP117 or the RTC RV3028
    i2c = busio.I2C(board.GP5, board.GP4)

    # Create tmp117 object
    tmp117 = adafruit_tmp117.TMP117(i2c)

def drw():
    global WIDTH, HEIGHT, ROTATION, BORDER, tmp117
    white = 0xFFFFFF
    black = 0x000000
    # Make the display context
    splash = displayio.Group()

    color_bitmap = displayio.Bitmap(WIDTH, HEIGHT, 1)
    color_palette = displayio.Palette(1)
    color_palette[0] = white

    bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)

    # Draw a smaller inner rectangle in black
    inner_bitmap = displayio.Bitmap(WIDTH - BORDER * 2, HEIGHT - BORDER * 2, 1)
    inner_palette = displayio.Palette(1)
    inner_palette[0] = black
    inner_sprite = displayio.TileGrid(
        inner_bitmap, pixel_shader=inner_palette, x=BORDER, y=BORDER

    b_0 = [8, 16, 32, 110]
    b_1 = [8, 16, 32, 50]
    b_x = [58, 71, 91, 10]
    b_y = [17, 15, 28, 69]
    ble = len(b_0)

    # Draw three white squares and a white rectangle
    for _ in range(ble):
        bm = displayio.Bitmap(b_0[_], b_1[_], 1)
        sq = displayio.TileGrid(bm, pixel_shader=color_palette, x=b_x[_], y=b_y[_])

    fnt = terminalio.FONT

    # Draw some label text
    t_lst = ["Monochrome 1.12in", "128x128", "OLED", "TEMP:", "       "]
    s_lst = [1, 1, 2, 2, 2]
    x_lst = [8, 8, 9, 15, 15]
    y_lst = [8, 25, 44, 80, 104]
    c_lst = [white, white, white, black, black]

    le = len(x_lst)
    for _ in range(le):
        if _ < le-1:
            t = t_lst[_]
            t = "{:0.2f} C".format(tmp117.temperature)
        t_area = label.Label(fnt, text=t, scale=s_lst[_], color=c_lst[_], x=x_lst[_], y=y_lst[_])


    del color_bitmap  # to prevent memory exception error
    del splash        # idem

def main():
    while True:
        except KeyboardInterrupt:


if __name__=="__main__":

Thanks for that, might take me a while to “maybe” decipher it all?
Won’t happen tonight, relaxing with some Rum & Coke, yarr.
@Tonygo2 might be the guy for this though?

@alphanumeric I tried your:

however it results in the following error:
AttributeError: 'SH1107' object has no attribute 'set_pen'

Yeah, set_pen is for the st7789. And it just sets it all to black.
You’ll have to cypher out the equivalent command (if it exists) for your oled display. Which I think your already doing?


    del color_bitmap  # to prevent memory exception error
    del splash        # idem

Where that one white box is in that code I haven’t figured out just yet? For me its just easier to rewrite the whole screen as most of it potentially changes anyway.

Abt: Where that one white box is in that code I haven’t figured out just yet?

The comment in the script gives the answer:
# Draw three white squares and a white rectangle

That one (rectangle) white box (in fact: the 4th white box) is created in the
ultimate iteration of this for… loop:

for _ in range(ble):
    bm = displayio.Bitmap(b_0[_], b_1[_], 1)
    sq = displayio.TileGrid(bm, pixel_shader=color_palette, x=b_x[_], y=b_y[_])

I don’t agree. In my script only the temperature value readout is changing. The rest of the screen is static and could be written once.

1 Like

The key words were “for me” its just easier to rewrite the whole screen as most of it potentially changes anyway.

I agree, for you all you want to update is the box where your temp is displayed.