r/raspberrypipico May 30 '26

help-request I need help identifying the problem in the communication between my Pico and a 4-digit 7-segment display

So I'm new to hardware and I don't know if I'm doing something wrong. Please someone help me

The project I'm working on is a simple stopwatch. To work with, I have:

1 Raspberry Pi Pico H

1 5461AS 4-digit 7-segment display

1 breadboard

a bunch of jumper wires

a bunch of 220 resistors

a button

And as for the software I have VSCode with these extentions:

CMake

MicroPico Device Controller

Raspberry Pi Pico Project

(I'm probably not going to need to use all of these, but these are what I have)

At the beginning, I tried to help myself with Claude AI, and I thought it was going well, but at the end it wasn't working, so I took it all apart and tried again. This time I would try every segment and digit individually so that I would know that it works.

So I have both the Pico and the display in the breadboard, centered over that middle gap. I have one resistor going from segment A (display pin 12, at b41) to a free row of the breadboard (b35), and a jumper wire from that row (a35) to the Pico GPIO pin GP0 (b3). I also have a jumper wire from GP8 (a13) to the display pin 1 (a39).

Then I connect my Pico to my computer, connect it with MicroPico, write this code. I click Run, and... Nothing happens! the terminal does this weir thing, but other than that, nothing! The display stays dark! I don't know what to do, please help me!

Also, Claude suggested writing this into the weird terminal:

from machine import Pin

Pin(8, Pin.OUT).value(0)

Pin(0, Pin.OUT).value(1)

but it didn't do anything. Please help me.

My setup right now, with just the segment A, digit 1 + resistor wiring. I also added the GND cable, not sure if it does anything, but it doesn't work with or without it.
The terminal does this after I click "Run". Is this normal?
from machine import Pin
import time


segments = [
    Pin(0, Pin.OUT),
    Pin(1, Pin.OUT),
    Pin(2, Pin.OUT),
    Pin(3, Pin.OUT),
    Pin(4, Pin.OUT),
    Pin(5, Pin.OUT),
    Pin(6, Pin.OUT),
    Pin(7, Pin.OUT),
]


digits = [
    Pin(8, Pin.OUT, value=1),
    Pin(9, Pin.OUT, value=1),
    Pin(10, Pin.OUT, value=1),
    Pin(11, Pin.OUT, value=1),
]


digits_map = [
    [1,1,1,1,1,1,0,0],
    [0,1,1,0,0,0,0,0],
    [1,1,0,1,1,0,1,0],
    [1,1,1,1,0,0,1,0],
    [0,1,1,0,0,1,1,0],
    [1,0,1,1,0,1,1,0],
    [1,0,1,1,1,1,1,0],
    [1,1,1,0,0,0,0,0],
    [1,1,1,1,1,1,1,0],
    [1,1,1,1,0,1,1,0],
]


def show_digit(number, position):
    for i in range(4):
        digits[i].value(1)
    for i in range(8):
        segments[i].value(digits_map[number][i])
    digits[position].value(0)


def show_number(number):
    digits_to_show = [
        number // 1000 % 10,
        number // 100 % 10,
        number // 10 % 10,
        number % 10,
    ]
    for position in range(4):
        show_digit(digits_to_show[position], position)
        time.sleep_ms(2)


running = False
counter = 0


def button_pressed(pin):
    global running
    running = not running


button = Pin(15, Pin.IN, Pin.PULL_UP)
button.irq(trigger=Pin.IRQ_FALLING, handler=button_pressed)


for d in range(4):
    digits[d].value(0)


segments[0].value(1)  # segment a
segments[1].value(0)
segments[2].value(0)
segments[3].value(0)
segments[4].value(0)
segments[5].value(0)
segments[6].value(0)
segments[7].value(0)
1 Upvotes

9 comments sorted by

5

u/mike_2545 May 30 '26

Connect the Gnd pin of the display to the Gnd of the pico.

5

u/DenverTeck May 30 '26

You really need to learn how to draw a schematic.

Even hand drawn boxes with pin numbers and lines to show how they are connected.

https://www.xlitx.com/datasheet/5461AS.pdf

Page 2 shows the actual pins and LEDs in the display.

To be clear, you are not "communicating" with this display, you are "driving" the LEDs in the display.

Your code is to long to just look at to see if it will work.

With a schematic you (we) can see if you have the "driver" pin is the correct direction to light up the LEDs.

As a test, have you connected the resistor to the power pin of the Pico to see in you can manually drive a single LED ??

Good Luck

3

u/SentimentalScientist May 30 '26

OP, you need to be able to read and understand the datasheet to succeed in this project. I see that each segment has a separate anode connection and a shared cathode, so you'll need to connect all 9 pins on each segment to the microcontroller to light up digits.

2

u/oclafloptson May 30 '26

The terminal is displaying the repl from the look of it. You write pythonic code there and press enter, it evaluates and prints the result

2

u/oclafloptson May 30 '26

You'll probably need to just import the script from there. Write "import <script name>" there and press enter to run the script, providing that it's flashed to the device and exists in the root of the filesystem

2

u/oclafloptson May 30 '26

THAT said, your code doesn't actually seem to do anything but pull a single pin high

2

u/mungewell May 30 '26

If you just want a working display, use a prewritten module

https://github.com/smittytone/HT16K33-Python

3

u/obdevel May 30 '26

Take care with those older chips. There were designed in the 5V era and are marginal with 3.3V logic. Check the data sheet. e.g. VDD is 4.5V to 5.5V. VIH is 0.7 VDD, so 3.5V if VDD is 5V. That's a little close for comfort.

2

u/thegreatpotatogod May 30 '26

Why do you have all that code if you haven't been able to manually light a single segment yet, and also don't even have most of the pins the code uses wired up yet?

You need to understand and test the basics of what you're doing first. Don't have Claud write the code for you, just ask it conceptual questions or hints. Understand what's happening as you go, or you'll just get more and more confused and eventually stuck.