Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Trying to build a custom 7-segment display clock

Status
Not open for further replies.

lilsusboi89

New Member
I'm a beginner in electronics and circuitry, and for one of my first projects is to build a digital clock with 7-segment displays that shows the following 3 numbers in this specific way:

6 - without the "A" segment illuminated, meaning 6 only has 5 segments illuminated instead of the normal 6 segements that are illuminated. Making it look like a "b".

7 - with only segments A, B, and C illuminated.

9 - with segment "D" turned off, making it look like the 6 I mentioned above, but upside-down.

I'd also like it if the displays displayed the numbers in red.

The reason I want the numbers displayed in such a certain way is that it is asthetically pleasing to me, however, I cant find any microcontrollers that display the numbers this way, nor can I find a decent digital clock kit that displays the numbers this way.

If anyone knows of a microcontroller that displays the numbers this way, or knows of another method for me to achieve my goal, your help would be much appreciated. My end goal is a nice hand-made digital clock that I can put on my nightstand.

Thank you.
 
Any microcontroller can be programmed to do what you want. You just create a lookup table that converts the BCD value to the required 7 segment pattern. I have done a similar thing to simplify the wiring between the microcontroller pins and the segment pins on the display.

Les.
 
I'm a beginner in electronics and circuitry, and for one of my first projects is to build a digital clock with 7-segment displays that shows the following 3 numbers in this specific way:

6 - without the "A" segment illuminated, meaning 6 only has 5 segments illuminated instead of the normal 6 segements that are illuminated. Making it look like a "b".

7 - with only segments A, B, and C illuminated.

9 - with segment "D" turned off, making it look like the 6 I mentioned above, but upside-down.

I'd also like it if the displays displayed the numbers in red.

The reason I want the numbers displayed in such a certain way is that it is asthetically pleasing to me, however, I cant find any microcontrollers that display the numbers this way, nor can I find a decent digital clock kit that displays the numbers this way.

If anyone knows of a microcontroller that displays the numbers this way, or knows of another method for me to achieve my goal, your help would be much appreciated. My end goal is a nice hand-made digital clock that I can put on my nightstand.

Thank you.
Micro-controllers don't 'display numbers' - the programmer, YOU!!, displays numbers - just display them how you want. Kit's are likely to use the standard characters, because that's what everyone uses, and it's the accepted use of seven segments. However, if the kit comes with the source code it should be easy to modify it to use whatever characters you want.
 
Any microcontroller can be programmed to do what you want. You just create a lookup table that converts the BCD value to the required 7 segment pattern. I have done a similar thing to simplify the wiring between the microcontroller pins and the segment pins on the display.

Les.
How do I program a microcontroller? I know how to make a truth table, but what do i need to program a microcontroller?
 
Micro-controllers don't 'display numbers' - the programmer, YOU!!, displays numbers - just display them how you want. Kit's are likely to use the standard characters, because that's what everyone uses, and it's the accepted use of seven segments. However, if the kit comes with the source code it should be easy to modify it to use whatever characters you want.
Thank you, should i place the microcontroller IC into an arduino to program it?
 
There are integrated circuits that are specifically designed to drive 7-segment displays, such as the SN7447 (https://www.mouser.co.uk/c/?q=SN7447AN). That one is currently available and has been on the market for 50 years. It produces the segment pattern that you want.
The SN7447 is only the segment decoder. It takes in 4 digital input, which represent 0 - 9, and outputs the seven segment signals. You also need the counters that count the time, so you can easily end up with 10 - 20 integrated circuits to get a digital clock.

An Arduino is cheaper and a lot less wiring.
 
The SN7447 is only the segment decoder. It takes in 4 digital input, which represent 0 - 9, and outputs the seven segment signals. You also need the counters that count the time, so you can easily end up with 10 - 20 integrated circuits to get a digital clock.

An Arduino is cheaper and a lot less wiring.
I think I'll go with an Arduino then, thanks for the assistance
 
Thank you, should i place the microcontroller IC into an arduino to program it?
You could do that but the normal thing to do is the program the Arduino via a USB from a PC, and then use the complete Arduino to run the clock. If you want more clocks, you need a more Arduinos.

A microcontroller would be cheaper for large quantities, but you would need something to physically transfer the program to the microcontrollers. That could be a dedicated programming device, or it could be an Arduino. One programming device or Arduino could program as many microcontrollers as you want.

However, each microcontroller would need a circuit board and some interface circuitry. An Arduino already has a circuit board and it contains a much of the interface circuitry already. It saves a huge amount of development work and allows a simple program to run and flash a light on just the Arduino with no additional hardware.
 
The code to display the required 7 segments pattern will be much simpler than the code for the clock particulaly if you want to include date and year. That would involve dealing with leap years.
Here is an example of the lookup table method for a PIC mocrocontroller.
Code:
;        *** These bit patterns could be changed to assign segments to different I/O pins to make board layout easier ***


;These bit patterns are for the following segment to bit assignments


;    A    RB0
;    B    RB1
;    C    RB2
;    D    RB4
;    E    RB5
;    F    RB6
;    G    RB7

SEGMENTS :   
                RETLW   b'10000000'      ;0    NOTE low to illuminate segment
                RETLW   b'11110001'      ;1
                RETLW   b'01000100'      ;2
                RETLW   b'01100000'      ;3
                RETLW   b'00110001'      ;4
                RETLW   b'00100010'      ;5
                RETLW   b'00000010'      ;6
                RETLW   b'11110000'      ;7
                RETLW   b'00000000'      ;8
                RETLW   b'00100000'      ;9
                RETLW   b'00010000'      ;A
                RETLW   b'00000011'      ;B
                RETLW   b'10000110'      ;C
                RETLW   b'01000001'      ;D
                RETLW   b'00000110'      ;E
                RETLW   b'00010110'      ;F

;                    -----------------------------------
You just add the 4 bit BCD value to the address of the label "SEGMENTS" and do a CALL instruction to that address. The RETLW returns the value associated that instruction in the "W" register. you then just output the "W" registor to the I/O port that is connected to the display.
The above table also includes the hexidecimal characters A to F.
Other microcontrollers will have a different instruction set so you would have to use a different method to create a lookup table.
The wardware that you require to program the microcontroller depends on the microcontrollert that you choose. Yo then need to learn how to program the microcontroller. That could in assembler (The actual code that the microcontroller understands.) or a high level language such as "C" or python. (Or one of many other languages.)

Les.
 
Last edited:
Since you want a dual color display one thinks of a led matrix of RGB leds
to handle that part. Or a color OLED display. Or RGB 7 segment digits.

The programming is significant if you are a non programmer.

I would advise you tackle this in stages. First learning C or use a block
language like mBlock, FlowCode, nodered, lots of training videos on
youtube.

Do something simple like a single digit display and get it to work on an Arduino
board.

Note there are microcontrollers that have capability and code library to support
your requirement, like a PSOC. This is one of the onboard resources that would
handle your design. Once you learn to code, even though it has easy to use library
for programming it.



Regards, Dana.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top