Site icon Microcontroller Based Projects

Raspberry Pi 3 Digit LED 7-Segment Countdown Timer

Raspberry-Pi-3-Digit-LED-7-Segment-Countdown-Timer-Featured-Image

Multiplexing 7-Segment display scheme with Raspberry Pi as described here can be used as a basis for more complex projects. By adding 4×4 keypad matrix and replacing individual 7-Segment displays with a common anode 4 digit 7-Segments module a simple countdown counter can be built. Similar design based on Arduino platform is available at this link. In the schematic diagram you can see that 3 PNP 2N3906 transistors required for switching the relevant digits.

I’ve used MSQC6412 module however this circuit can work with most similar components. In case of common cathode 7-Segments need to replace PNP with NPN like 2N3904 or use NMOS like BS170. Also remove inverting symbol from OutputBinary() function. Attached Python code will wait for 3 digit number to be entered via 4×4 keypad. As soon as initial value is received the counter starts to count down until it reaches zero. At this point a LED connected to Raspberry Pi I/O pin 24 will be turned ON.1 sec time base is derived according to a multiplexing rate. I recommend not to change it or recalculating how many multiplexing cycles are needed for 1 second delay.

Exit mobile version