7-Segment display numbers with HEF4093BP - Page 1
Forum section: electronics / projects

author: hichm19956
author_rank: Newbie
timestamp: February 05, 2025, 10:18:25 pm
content: Hi, it's my first topic here,i just share this project for fun, here i show how to display numbers in seven-segment driving by HEF4093BP it's a Quadruple 2-input NAND Schmitt trigger, sending data with Raspberry pi pico and powered by 5V from USB,it's maybe a make nice view of the led, not flicking each timing, i use Thonny to edit the code in MicropythonCode:from machine import Pinimport timePin_sdl = Pin(3, Pin.OUT) # redwirecolor Pin 5 (GP3)Pin_lck = Pin(5, Pin.OUT) # bleuwirecolor Pin 7 (GP5)Pin_sck = Pin(2, Pin.OUT) # whitewirecolor Pin 4 (GP2)Pin_lck(0)Pin_sck(0)Pin_sdl(0)def CP_4095():Pin_sck(0)time.sleep_us(30)Pin_sck(1)time.sleep_us(30)def DAT_CLEAR_4095():Pin_sdl(0) # reg_ACP_4095()Pin_sdl(0) # reg_BCP_4095()Pin_sdl(0) # reg_CCP_4095()Pin_sdl(0) # reg_DCP_4095()Pin_sdl(0) # reg_ECP_4095()Pin_sdl(0) # reg_FCP_4095()Pin_sdl(0) # reg_GCP_4095()def DAT_0_4095():Pin_sdl(0) # reg_ACP_4095()Pin_sdl(1) # reg_BCP_4095()Pin_sdl(1) # reg_CCP_4095()Pin_sdl(1) # reg_DCP_4095()Pin_sdl(1) # reg_ECP_4095()Pin_sdl(1) # reg_FCP_4095()Pin_sdl(1) # reg_GCP_4095()def DAT_1_4095():Pin_sdl(0) # reg_ACP_4095()Pin_sdl(0) # reg_BCP_4095()Pin_sdl(0) # reg_CCP_4095()Pin_sdl(0) # reg_DCP_4095()Pin_sdl(1) # reg_ECP_4095()Pin_sdl(1) # reg_FCP_4095()Pin_sdl(0) # reg_GCP_4095()def DAT_2_4095():Pin_sdl(1) # reg_ACP_4095()Pin_sdl(0) # reg_BCP_4095()Pin_sdl(1) # reg_CCP_4095()Pin_sdl(1) # reg_DCP_4095()Pin_sdl(0) # reg_ECP_4095()Pin_sdl(1) # reg_FCP_4095()Pin_sdl(1) # reg_GCP_4095()def DAT_3_4095():Pin_sdl(1) # reg_ACP_4095()Pin_sdl(0) # reg_BCP_4095()Pin_sdl(0) # reg_CCP_4095()Pin_sdl(1) # reg_DCP_4095()Pin_sdl(1) # reg_ECP_4095()Pin_sdl(1) # reg_FCP_4095()Pin_sdl(1) # reg_GCP_4095()def DAT_4_4095():Pin_sdl(1) # reg_ACP_4095()Pin_sdl(1) # reg_BCP_4095()Pin_sdl(0) # reg_CCP_4095()Pin_sdl(0) # reg_DCP_4095()Pin_sdl(1) # reg_ECP_4095()Pin_sdl(1) # reg_FCP_4095()Pin_sdl(0) # reg_GCP_4095()def DAT_5_4095():Pin_sdl(1) # reg_ACP_4095()Pin_sdl(1) # reg_BCP_4095()Pin_sdl(0) # reg_CCP_4095()Pin_sdl(1) # reg_DCP_4095()Pin_sdl(1) # reg_ECP_4095()Pin_sdl(0) # reg_FCP_4095()Pin_sdl(1) # reg_GCP_4095()def DAT_6_4095():Pin_sdl(1) # reg_ACP_4095()Pin_sdl(1) # reg_BCP_4095()Pin_sdl(1) # reg_CCP_4095()Pin_sdl(1) # reg_DCP_4095()Pin_sdl(1) # reg_ECP_4095()Pin_sdl(0) # reg_FCP_4095()Pin_sdl(1) # reg_GCP_4095()def DAT_7_4095():Pin_sdl(0) # reg_ACP_4095()Pin_sdl(0) # reg_BCP_4095()Pin_sdl(0) # reg_CCP_4095()Pin_sdl(0) # reg_DCP_4095()Pin_sdl(1) # reg_ECP_4095()Pin_sdl(1) # reg_FCP_4095()Pin_sdl(1) # reg_GCP_4095()def DAT_8_4095():Pin_sdl(1) # reg_ACP_4095()Pin_sdl(1) # reg_BCP_4095()Pin_sdl(1) # reg_CCP_4095()Pin_sdl(1) # reg_DCP_4095()Pin_sdl(1) # reg_ECP_4095()Pin_sdl(1) # reg_FCP_4095()Pin_sdl(1) # reg_GCP_4095()def DAT_9_4095():Pin_sdl(1) # reg_ACP_4095()Pin_sdl(1) # reg_BCP_4095()Pin_sdl(0) # reg_CCP_4095()Pin_sdl(1) # reg_DCP_4095()Pin_sdl(1) # reg_ECP_4095()Pin_sdl(1) # reg_FCP_4095()Pin_sdl(1) # reg_GCP_4095()def esc():B = print(f'DAT_{nbr}_4095()')return f'\{B}'while True:DAT_CLEAR_4095()Pin_lck(1)time.sleep(3)Pin_lck(1)time.sleep(3)DAT_CLEAR_4095()DAT_1_4095()Pin_lck(1)time.sleep(3)DAT_CLEAR_4095()DAT_2_4095()Pin_lck(1)time.sleep(3)DAT_CLEAR_4095()DAT_3_4095()Pin_lck(1)time.sleep(3)DAT_CLEAR_4095()DAT_4_4095()Pin_lck(1)time.sleep(3)DAT_CLEAR_4095()DAT_5_4095()Pin_lck(1)time.sleep(3)DAT_CLEAR_4095()DAT_6_4095()Pin_lck(1)time.sleep(3)DAT_CLEAR_4095()DAT_7_4095()Pin_lck(1)time.sleep(3)DAT_CLEAR_4095()DAT_8_4095()Pin_lck(1)time.sleep(3)DAT_CLEAR_4095()DAT_9_4095()Pin_lck(1)time.sleep(3)

author: Benta
author_rank: Super Contributor
timestamp: February 05, 2025, 11:01:39 pm
content: Dunno where you get your data sheets from, but check again. Looks more like a 74HC138 with faulty pinout.What you show is nonsense. AI?

author: wasedadoc
author_rank: Super Contributor
timestamp: February 05, 2025, 11:20:30 pm
content: A pico is perfectly capable of sinking 0.5 mA through LEDs. No need for interface chip.

author: edavid
author_rank: Super Contributor
timestamp: February 06, 2025, 12:04:17 am
content: I think OP meant the HEF4094 shift register. He managed to hit on both sides of it with 4093 in the title and diagram, and 4095 in his code.OP, the HEF4094 is a poor LED driver due to its weak outputs. Also, if you power it from 5V, the VIHis 3.5V, so it can't be reliably driven from 3.3V outputs (and if you power it from 3.3V, the outputs are even weaker).If you really don't have enough GPIO pins available to drive the LEDs directly from the Pi Pico, it's better to use the 74HCT595, which has higher output drive and compatible input levels (or 74HC595 if you power it from 3.3V).

author: PCB.Wiz
author_rank: Super Contributor
timestamp: February 06, 2025, 12:23:55 am
content: Quote from: Benta on February 05, 2025, 11:01:39 pmYes, the words and images are badly mangled.It looks like a HEF4094 / HC4094, but the pinout is wrong, and the code fails to manage the latch enable (STR) correctly, but shift is fast enough that bug goes unnoticed.

author: hichm19956
author_rank: Newbie
timestamp: February 15, 2025, 10:34:51 pm
content: Hey guys, Thanks for your replies, it's great here to know new things about HEF4094, i just found it away in a broken peace of PCB long time ago,i build a module with it because i find that it can take signal in three pins and out it in parallel , the idea came from this post inarduino forumthe code is not good and not optimized they are a lot of thinks that i should know the make the coding in MicroPython smaller lines and work faster than that one, because even that is the object of a good programmer.i found an other module collected from a broken piano i didn't buy it just find it somewhere on the floor when i get ready i will post a counter two digit seven-segment, just i need some time and mood because the life is even harder than before.