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