Engineering the most basic 7-Seg LED with keypad

Thread Starter

Loki23

Joined Sep 13, 2010
4
Hello,

Lately I've been trying to gain an understanding of processors/cpu's and the very simplest "input-output" system you can possibly engineer. I decided I would do a thought experiment where I would distill the computer down to the most basic level I could conceive, and decided that such a computer would be a single 7 segment LED. That seemed sufficiently simple, yet in some ways, still mysterious to me.

Here's an example of what I mean:



Imagine this LED hooked up to a keypad with numbers 0-9, each key sending a different signal to the processor. The processor, as I understand it, is best visualized as a network of on/off switches. But this is too general.

I want to go into more specific details but I'm not sure how. When you press a key on a small 0-9 numbered keypad, what exactly are the interactions occurring to produce the simple 7 bulb display? It's so simple, yet it's still not easy to see.

I put together another GIF of the next step in complexity, primitive animation:




^ not ready to tackle that yet, but would eventually like to understand that as well.
 
Are you asking what is actually happening?

A matrixed keypad works a little different than just a simple push button, which is probably easiest to work with for a beginner.

Basically, with a keypad there is a routine that the microcontroller uses that is written into the program to scan each key individually in an extremely fast manner. If you have three columns and 4 rows, the routine will "set" (make the voltage above ground to be "logic 1") each column individually and then begin working down each row in that column. If it's pressed, the key is grounded and then the program knows that column 3, row 2, for example (a "6") has been pressed. The program then tells the microcontroller what it should do when it notices that column three, row two is pressed. It then jumps to another routine that turns on all the necessary pins attached to the 7 segment LED to show a "6."
 

beenthere

Joined Apr 20, 2004
15,819
A 7 segment display usually gets driven by a specialized IC, like the CD4511 - http://talkingelectronics.com/ChipDataEbook-1d/html/4511.html

The process to illuminate a number that corresponds to a key pressed might be like:
1. Decode the key being to see which one it is by a column and row scheme. The number must be a BCD representation. A certain amount of external logic is necessary.
2. Latch that number into the CD4511 using a bit more external logic.
3. the display illuminates the segments to display the number in the latch.

While a microcontroller could be used, a few logic ICs can do the same thing.

Note: I fell into my own trap. By use of steering diodes, the 7 segment display can be made to light up the correct segments with each key pressed. Use a common anode display. Each key will output a ground, so the connections will be through a diode matrix and a fixed resistor in each segment line.
 
Last edited:

Thread Starter

Loki23

Joined Sep 13, 2010
4
Are you asking what is actually happening?

A matrixed keypad works a little different than just a simple push button, which is probably easiest to work with for a beginner.

Basically, with a keypad there is a routine that the microcontroller
Is there any way we can make an enlightening project without involving the "microcontroller"? I don't know what a microcontroller is, and for us to progress I would like have to focus on how a microcontroller works.

uses that is written into the program to scan each key individually in an extremely fast manner. If you have three columns and 4 rows, the routine will "set" (make the voltage above ground to be "logic 1") each column individually and then begin working down each row in that column. If it's pressed, the key is grounded and then the program knows that column 3, row 2, for example (a "6") has been pressed. The program then tells the microcontroller what it should do when it notices that column three, row two is pressed. It then jumps to another routine that turns on all the necessary pins attached to the 7 segment LED to show a "6."
I'm pretty sure you are speaking to me from too a high a level. Similar to what I said above, to understand you I would have to understand this "program" that scans each key individually. How does that work?
 
Last edited:

Thread Starter

Loki23

Joined Sep 13, 2010
4
A 7 segment display usually gets driven by a specialized IC, like the CD4511 - http://talkingelectronics.com/ChipDataEbook-1d/html/4511.html
I know next to nothing about electronics. I understand binary. And I get how signals of a lower charge are 0 and signals of a higher charge are 1. But I am not comfortable with circuit design or any of the nomenclature and terms.

Is there anyway we can drive the LED without anything too complicated?

If not, how can I conceptualize an input-output system that is incredibly simple and build up from there?
 

JoeBro391

Joined May 15, 2010
68
I think a 74LS147 is what you're looking for. I take an input from a keypad (well, any assortment of switches, but ideally a keypad) and turns it to a binary value which is turned into a digit on a 7-segment display. Maybe this isn't want you're referring to, but it's the first thing I thought of when I read your initial post. -Joe
 

Kermit2

Joined Feb 5, 2010
4,162
A BCD(binary coded decimal) decoder chip is what you want to go with your 3x4 matrix keypad. By connecting the correct column and row with each input, it will output 4 signals(combo of 1's and 0's) that represent the pressed Key#. Connecting those four signals to a 7seg display driver chip will cause an LED display to show that pressed Key# in blazing light emitted diode glory.

:)

That's a real stripped down description of what it takes, without all the powersupply and hardware polluting the idea. Very doable, even for a beginner.

The first place to start is to look up the chips from a web site like www.alliedelec.com and get an idea of just how many types and varieties of chips are made that decode BCD and drive 7 seg LED's. Once you have done that you'll have more questions for us, and you can also look up matrix pushbutton keypads while you are there.
 
Last edited:

Thread Starter

Loki23

Joined Sep 13, 2010
4
I think a 74LS147 is what you're looking for. I take an input from a keypad (well, any assortment of switches, but ideally a keypad) and turns it to a binary value which is turned into a digit on a 7-segment display. Maybe this isn't want you're referring to, but it's the first thing I thought of when I read your initial post. -Joe
yes, this is exactly what I'm referring to. But i want to understand how it works.
 

Kermit2

Joined Feb 5, 2010
4,162
I want to go into more specific details but I'm not sure how. When you press a key on a small 0-9 numbered keypad, what exactly are the interactions occurring to produce the simple 7 bulb display? It's so simple, yet it's still not easy to see.
Look at the 74147 picture. ONE of those inputs will be 'activated'. In the case of that particular chip, that means it will have the appropriate input pin set to ground level by the keypad being 'pressed'. Other chips might need the input to be set to 5 volts, but this one needs a ground. This can be determined by those little round circles at the base of the lines on that picture. They tell us that THIS chip needs a low, or a '0', as an input to function.

Now look at the drawing of the 7447, which is the chip which drives the seven segment display. It will look at the four output pins of the 74147 and using the 'rats nest' of logic gates inside itself, will turn those four inputs of either ones or zeros into an output. Depending on which combo of 1's and 0's it 'sees'. The appropriate output pins, will be activated. Again, this kind of chip comes in various flavors, some which need 0's for inputs and others that look for 1's as inputs. Some will give 0's as an active output, others will give 1's as the active output.

Now look at the drawing of the seven segment display. Each of the little bars which makes up the figure eight is assigned a letter 'a' thru 'g'. The active output from the 7447 chip will be connected to these input pins. Again, we have several flavors of this kind of display. Some which become active, or light up, when they are sent a 0, and others which need a 1.

And that's it. If you want to understand it more you will need to learn some logic(Boolean algebra). This will help you to 'decode' the rats nest of logic gates inside those chips and see how it is they determine which pins are active and which aren't based on how the input pins are set(1's and 0's)

That's about as simple as it can be explained without using electronics terminology which you already told us-you don't understand.
 

Attachments

enorthcutt

Joined Sep 26, 2012
2
If I wanted to increment the 7-segment each time a single switch is closed rather than use the BCD input, how would I construct the circuit. Also need a clear function. Basically it is a simple "count up" function with a single input and clear.
 

MrChips

Joined Oct 2, 2009
30,806
You really need to start your own thread.

Then start from square one and tell us what you want to accomplish having first told us about your knowledge of digital electronics.
 
Top