# Interfacing Plasma2040 to Sparkfun 14segment display

**URL:** <https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444>\
**Category:** Support\
**Created:** [October 4, 2022, 8:24pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444 "2022-10-04T20:24:30Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![mickf](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mickf](https://forums.pimoroni.com/u/mickf)\
**Post date:** [October 4, 2022, 8:24pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/1 "2022-10-04T20:24:30Z")

</div>

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/​](https://smittytone.net/ht16k33-python/%E2%80%8B). 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!

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [October 4, 2022, 8:35pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/2 "2022-10-04T20:35:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mickf](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mickf](https://forums.pimoroni.com/u/mickf)\
**Post date:** [October 4, 2022, 8:59pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/3 "2022-10-04T20:59:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![major\_tomm](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/major_tomm/32/9044_2.png) [@major\_tomm](https://forums.pimoroni.com/u/major_tomm)\
**Post date:** [October 4, 2022, 9:03pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/4 "2022-10-04T21:03:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [October 5, 2022, 9:38am UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/5 "2022-10-05T09:38:47Z")

</div>

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:

```auto
# 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).

---

<div class="post-metadata">

**Author:** ![mickf](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mickf](https://forums.pimoroni.com/u/mickf)\
**Post date:** [October 5, 2022, 2:32pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/6 "2022-10-05T14:32:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [October 5, 2022, 2:57pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/7 "2022-10-05T14:57:13Z")

</div>

Oops, try  
`from ht16k33segment14 import HT16K33Segment14`

EDIT: working for me :D

 ![PXL_20221005_151455556](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/c/ca5d173e4467f43268d76c23e3a4d1490fb33be3.jpeg)

```auto
# 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()

```

---

<div class="post-metadata">

**Author:** ![mickf](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mickf](https://forums.pimoroni.com/u/mickf)\
**Post date:** [October 5, 2022, 3:34pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/8 "2022-10-05T15:34:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [October 5, 2022, 3:52pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/9 "2022-10-05T15:52:27Z")

</div>

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](https://github.com/pimoroni/pimoroni-pico/releases) (or here’s a [direct link](https://github.com/pimoroni/pimoroni-pico/releases/download/1.19.7/pimoroni-pico-1.19.7-micropython.uf2))

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.

---

<div class="post-metadata">

**Author:** ![mickf](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mickf](https://forums.pimoroni.com/u/mickf)\
**Post date:** [October 5, 2022, 4:06pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/10 "2022-10-05T16:06:05Z")

</div>

![Thnx](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/b/bf675b949fbfd912d4d6c786cf32fee219def77a.jpeg)  
Thank you Hel, we have lift-off !!!

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [October 5, 2022, 4:13pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/11 "2022-10-05T16:13:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mickf](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mickf](https://forums.pimoroni.com/u/mickf)\
**Post date:** [October 5, 2022, 4:56pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/12 "2022-10-05T16:56:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [October 6, 2022, 9:58am UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/13 "2022-10-06T09:58:06Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![mickf](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mickf](https://forums.pimoroni.com/u/mickf)\
**Post date:** [October 6, 2022, 10:30am UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/14 "2022-10-06T10:30:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mickf](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mickf](https://forums.pimoroni.com/u/mickf)\
**Post date:** [October 6, 2022, 6:26pm UTC](https://forums.pimoroni.com/t/interfacing-plasma2040-to-sparkfun-14segment-display/20444/15 "2022-10-06T18:26:43Z")

</div>

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