Interfacing Plasma2040 to Sparkfun 14segment display

I am trying to connect a Sparkfun 14 segment digital display to a Plasma2040 which is running Python code, using the Qwiic interface on the Plasma board. I have had some help from Matt Taylor at Pimoroni who pointed me at https://smittytone.net/ht16k33-python/​. I am presently stuck with what I think is a problem relating to the configuration of the I2C interface from the 2040 to the display. Following the examples given in the documentation for the display on the “smittytone” web site simply doesn’t appear to help. Has anyone succeeded in making this interface work under Python? I am not a software expert by any means and in fact “newbie” is probably a closer description so please keep it simple!

I haven’t used that combination of boards, but I have used another HT16K33-based device with the Raspberry Pi and Python. I however used Adafruit’s HT16K33 packages rather than the ones you’ve listed.

What seems to be the issue with the I2C configuration?

Hi major_tomm. Thanks for the prompt reply. I am simply following the documentation on the “smittytone” website and in particular the examples given for Micropython on page 3.of the documentation 1.0.0 for HT16K33Segment14. When I simply enter these 6 lines of code in Thonny, having imported what I believe are the correct driver files, and running the code, I get a message in the Shell window that says " Traceback (most recent call last):

File “”, line 5, in

NameError: name ‘Pin’ isn’t defined.

The line of code to which this refers is " i2c = I2C(scl=Pin(DEVICE_I2C_SCL_PIN), sda=Pin(DEVICE_I2C_SDA_PIN))" (to save you looking it up). This is my sole rational for thinking it is an I2C configuration problem.

My gut reaction is that the Pin class hasn’t been imported properly, might be worth checking the #import statements again? I can’t look at it in any more detail at the moment, but will try and give it another look later.

Ooh - didn’t realise there was a MicroPython driver for these displays, that’s handy - I’ve got a few of these!

Should be from machine import Pin maybe? You can use our I2C helper if you’re running our MicroPython though:

# MicroPython
from HT16K33segment14 import HT16K33Segment14
from pimoroni_i2c import PimoroniI2C

PINS_BREAKOUT_GARDEN = {"sda": 4, "scl": 5}
PINS_PICO_EXPLORER = {"sda": 20, "scl": 21}

i2c = PimoroniI2C(**PINS_PICO_EXPLORER)
led = HT16K33Segment14(i2c)

(note that Plasma uses the alternate I2C pins - GP20 and 21).

1 Like

Hello Hel, I have tried your code suggestions for my display problem and have entered it into Thonny exactly as shown below:

from HT16K33segment14 import HT16K33Segment14
from pimoroni_i2c import PimoroniI2C
#from machine import Pin, I2C

PINS_BREAKOUT_GARDEN = {“sda”: 4, “scl”: 5}
PINS_PICO_EXPLORER = {“sda”: 20, “scl”: 21}

i2c = PimoroniI2C(**PINS_PICO_EXPLORER)
led = HT16K33Segment14(i2c)

It does not run with the following failure report in the shell window:

Traceback (most recent call last):
File “”, line 1, in
ImportError: no module named ‘HT16K33segment14’

The Files window reports the following files in the Files window for raspberry Pi Pico:

ht16k33.py. and
ht16k33segment14.py

Any further thoughts but thanks for your efforts so far.

Oops, try
from ht16k33segment14 import HT16K33Segment14

EDIT: working for me :D

# MicroPython
from ht16k33segment14 import HT16K33Segment14
from pimoroni_i2c import PimoroniI2C

PINS_BREAKOUT_GARDEN = {"sda": 4, "scl": 5}
PINS_PICO_EXPLORER = {"sda": 20, "scl": 21}

i2c = PimoroniI2C(**PINS_PICO_EXPLORER)
led = HT16K33Segment14(i2c)

led.set_character("A", 0).set_character("h", 1)
led.set_character("o", 2).set_character("y", 3).draw()
1 Like

No luck Hel but the Error report might shine some light on the problem. It says:-

Traceback (most recent call last):
File “”, line 9, in
File “ht16k33segment14.py”, line 39, in init
File “ht16k33.py”, line 36, in init
File “ht16k33.py”, line 95, in power_on
File “ht16k33.py”, line 120, in _write_cmd
AttributeError: ‘pimoroni_i2c’ object has no attribute ‘writeto’

which makes me think that maybe the problem lies with the files I copied across from the GitHub repository. Can you tell me which files you copied and did you copy them simply as text files which you subsequently renamed? I freely confess to being very unfamiliar with how I get files safely from GiHub. As a slight aside, in desperation I “nuked” the Plasma2040 and reinstalled
“Pimoroni-pico-v1.18.4-micropython-v1.18-blinka-6.20.1-platformdetect-3.19.3.uf2.” I don’t know if this has any relevance.

Ah - I ran into this error too - try updating to our newest MicroPython version. Mine was also rather old!

The newest pimoroni-pico uf2 from the releases page should work: Releases · pimoroni/pimoroni-pico · GitHub (or here’s a direct link)

Yep, I just copied the contents of the driver files from Github and pasted them into new tabs in Thonny, as long as you save them to the board with the same filenames that should be fine.


Thank you Hel, we have lift-off !!!

3 Likes

Hooray! I’ll link that library up on the shop page as I imagine it could be useful to other folks :)

I think the Plasma2040 and these displays make a useful combination. One final question (and then I’ll go away for a bit), the colon between the second and third digits doesn’t seem to work as described in the “smittytone” documentation ie “led.set_colon().draw()”. Should it?

Looks like the set.colon() function doesn’t exist in the MicroPython driver for the 14 segment display (though I can see it in the driver for the 7 segment version) - perhaps it hasn’t been implemented yet? You might be best contacting the author of the driver about that one!

Thank you Hel. I will take up your suggestion and let you know the outcome.

Tony Smith has updated the drivers and it works very well!

2 Likes