0

I'm trying to make a display with several 7 segment displays so I decided to use multiplexing to make it work. I use CD4051BE to do that. The circuit is as follow: Circuit of the multiplexing The MCP23017 is then hooked up to a raspberry pi 3 where I code using python and CircuitPython. The segments look like that, you can see the displays that shouldn't turn on circled in blue. It seems like it is working at slower speed (when I add delay to the multiplexing). I think the problem comes from the way I did multiplexing but I really don't know... My code is the following:

import board
import busio
from digitalio import Direction, DigitalInOut
from adafruit_mcp230xx.mcp23017 import MCP23017
import time

i2c = busio.I2C(board.SCL, board.SDA)

mcp = MCP23017(i2c, address=0x21)

pin0 = mcp.get_pin(8)
pin0.direction = Direction.OUTPUT
pin1 = mcp.get_pin(9)
pin1.direction = Direction.OUTPUT

s1 = DigitalInOut(board.D14)
s1.direction = Direction.OUTPUT
s2 = DigitalInOut(board.D15)
s2.direction = Direction.OUTPUT
s3 = DigitalInOut(board.D18)
s3.direction = Direction.OUTPUT

pin0.value = True

while True:
  for i in range(0, 5):
    if (i % 2) == 0:
      pin1.value = False
    else:
      pin1.value = True
    s1.value = bool(i >> 0 & 1)
    s2.value = bool(i >> 1 & 1)
    s3.value = bool(i >> 2 & 1)

Thanks for any help !

Cyprien

Sigma
  • 1
  • 1
  • 1
    Possibly relevant: https://electronics.stackexchange.com/questions/62271/learning-multiplexing-with-leds-transistor-switching-speeds/62303#62303 –  Dec 17 '20 at 14:53
  • 1
    You should disable all of the 7-seg displays while you're sending an update to the MCP23017 to prevent the info from one display being carried over to the next one for a brief period. It would have been best if you'd connected your 4051's INH pin to your Pi for this, but setting it to one of the unused outputs (5, 6, 7) will work just as well - you'll just never be able to expand it to 8 digits. – brhans Dec 17 '20 at 15:35
  • Thank you very much ! Using the INH pin made it work perfectly ! – Sigma Dec 17 '20 at 16:07

0 Answers0