Blogroll

Powered by Blogger.

Tuesday 19 August 2014

Working of the Circuit to Interface 4*4 Key Pad and SSD to Arduino Mega

by realfinetime  |  in Seven Segment Display at  01:16

Previous: Circuit Diagram Next: Arduino Program

          We had already seen the circuit for Interfacing 4*4 Button Key Pad and Seven Segment Display to Arduino Mega in previous post. Here we will see the working of that circuit in deep.

          Connections of 4*4 button pad to arduino can be redrawn using press button switches as shown below. R1, R2, R3, R4, R5, R6, R7 and R8 are the pull up resistors.
R1 = R2 = R3 = R4 = R5 = R6 = R7 = R8 = 1K

Working of Circuit (Pressed key detection process)

Working of circuit can be easily illustrated using an example. HIGH = 1 = 5V and LOW = 0 = 0V.

1. Declare digital pins 4, 5, 6 and 7 of arduino as output pins.
2. Declare digital pins 8, 9, 10 and 11 of arduino as input pins.
3. Send LOW ( 0 ) through digital pins 4, 5, 6 and 7.

4. All the switches will be off by default. That is, digital pins 8, 9, 10 and 11 will be pulled to 5V through the pull up resistors ( R1, R2, R3 and R4 ) and these digital pins will read 1 1 1 1 since it is an input port.

5. When any switch is pressed, corresponding column ( O, P, Q or R ) get grounded. For example, if switch 5 is pressed as shown in the following image, P get grounded through the switch 5 and L, since K, L, M and N are at LOW voltage ( 0V ). Then digital pins O, P, Q and R will read 1 0 1 1 ( O P Q R ). Since P reads 0, microcontroller will assume that the switch pressed will be either one of  2, 5, 8 or 0. Next is to find the pressed switch from switches 2, 5, 8 and 0. Read the following procedures to select the pressed switch from these switches.


          Send LOW through K and HIGH through L, M and N. If P reads 0, then pressed switch will be 2. Because, if the pressed switch is 2, P will read LOW from K through switch 2 since K is LOW. If switch 2 is not pressed, P will read HIGH through pull up resistor R2. In our circuit P will read HIGH, because we have already mentioned that pressed switch is 5. Eliminate switch 2. Remaining switches are 5, 8 and 0.

          Send LOW through L and HIGH through K, M and N. If P reads 0, then pressed switch will  be 5. Because, if the pressed switch is 5, P will read LOW from L through switch 5 since L is LOW. If switch 5 is not pressed, P will read HIGH through pull up resistor R2. Since switch 5 is pressed in this circuit as we have already mentioned, P will read 0 and microcontroller will conclude the pressed switch as switch 5.

          Send LOW through M and HIGH through K, L and N. If P reads 0, then pressed switch will be 8. Because, if the pressed switch is 8, P will read LOW from M through switch 8 since M is LOW. If switch 8 is not pressed, P will read HIGH through pull up resistor R2. In our circuit P will read HIGH, because we have already mentioned that pressed switch is 5. Eliminate switch 8.

          Send LOW through N and HIGH through K, L and M. If P reads 0, then pressed switch will be 0. Because, if the pressed switch is 0, P will read LOW from N through switch 0 since N is LOW. If switch 0 is not pressed, P will read HIGH through pull up resistor R2. In our circuit P will read HIGH, because we have already mentioned that pressed switch is 5. Eliminate switch 8.

From these analysis, microcontroller will conclude that pressed switch is 5.

D0 pin of  4511 is connected to the 0th digital pin of Arduino mega.
D1 pin of  4511 is connected to the 1st digital pin of Arduino mega.
D2 pin of  4511 is connected to the 2nd digital pin of Arduino mega.
D3 pin of  4511 is connected to the 4th digital pin of Arduino mega.
LE pin of  4511 is connected to the 12th digital pin of Arduino mega.

If 0 is pressed, arduino will send 0 to LE. 0 0 0 0 to D3 D2 D1 D0 respectively. Then send 1 to LE.
If 1 is pressed, arduino will send 0 to LE. 0 0 0 1 to D3 D2 D1 D0 respectively. Then send 1 to LE.
If 2 is pressed, arduino will send 0 to LE. 0 0 1 0 to D3 D2 D1 D0 respectively. Then send 1 to LE.
If 3 is pressed, arduino will send 0 to LE. 0 0 1 1 to D3 D2 D1 D0 respectively. Then send 1 to LE.
If 4 is pressed, arduino will send 0 to LE. 0 1 0 0 to D3 D2 D1 D0 respectively. Then send 1 to LE.
If 5 is pressed, arduino will send 0 to LE. 0 1 0 1 to D3 D2 D1 D0 respectively. Then send 1 to LE.
If 6 is pressed, arduino will send 0 to LE. 0 1 1 0 to D3 D2 D1 D0 respectively. Then send 1 to LE.
If 7 is pressed, arduino will send 0 to LE. 0 1 1 1 to D3 D2 D1 D0 respectively. Then send 1 to LE.
If 8 is pressed, arduino will send 0 to LE. 1 0 0 0 to D3 D2 D1 D0 respectively. Then send 1 to LE.
If 9 is pressed, arduino will send 0 to LE. 1 0 0 1 to D3 D2 D1 D0 respectively. Then send 1 to LE.

          LE should be 0 before sending the number through D3, D2, D1 and D0. If LE is 1, display will not change even if the value of D3, D2, D1 and D0 changes.

          We will see the arduino program for pressed key detection and display interfacing in next post.

Previous: Circuit Diagram Next: Arduino Program

0 comments:

IMPORTANT NOTICE

All the circuits, published in this blog is only after testing and getting proper results in my private lab. When you try these circuits, you should check the supply voltage, polarity of components, presence of childrens nearby and shorts in the circuits. This website will not be responsible for any harm happened to you or your components caused by your carelessness.

For More Electronic Tips



Blog Archive

Proudly Powered by Blogger.