Lesson 6. The visitor counter
In picturesAfter this lesson the device is ready: two displays — "inside" (in +1, out −1) and "total in" (only +1) — and a Reset button. Four CD4029, four CD4511, two beams and two CD4011.
6.1. Idea: two displays on the same beams
- "Inside": the clock is
BOTH, the direction isIN. In — +1, out — −1; - "Total in": the same clock, the direction is always up, and counting is allowed (
CI= 0) only on the way in —CI=OUT.
No new gates are needed for the second display — everything is already in the lesson 5 circuit.
6.2. Idea: two digits — two counters
Units and tens are two CD4029 with a common clock. The tens count only when the units go over the edge: CO of the units → CI of the tens. Each digit has its own CD4511 and its own display.
6.3. Idea: Reset holds
Reset goes to PE of all counters. While PE is 1 the CD4029 loads 0000 and its clock is blocked: the counter counts nothing. That is why Reset is a button: press and let go. A switch left at 1 keeps the display at 00 whatever happens with the beams.
The whole circuit as one drawing — for building with wires:
6.4. Build
The lesson 5 project — the direction circuit is in place. The library needs CD4029 and CD4511.
Step 1. The Reset button
Reset goes to PE of all four counters: while it is pressed they load 0000.
| Part | Pin | Label |
|---|---|---|
| Button «Reset» | output | RESET |
Step 2. The "inside" display: two CD4029
The first — units (U0–U3), the second — tens (T0–T3). CLOCK of both — BOTH, the direction UD — IN: in — +1, out — −1. Decade counting (BD = 0). Carry: CO of units → CI of tens — the tens count only when the units go 9 → 0 (or 0 → 9 down).
| Part | Pin | Label |
|---|---|---|
| CD4029 | PE Q4 J4 J1 CI Q1 CO BD UD Q2 J2 J3 Q3 CLOCK | RESET U3 GND GND GND U0 COU GND IN U1 GND GND U2 BOTH |
| CD4029 | PE Q4 J4 J1 CI Q1 CO BD UD Q2 J2 J3 Q3 CLOCK | RESET T3 GND GND COU T0 COT GND IN T1 GND GND T2 BOTH |
Step 3. The "total in" display: two more CD4029
The first — units (V0–V3), the second — tens (W0–W3). Only up: UD = VCC. CI of the units — OUT: CI = 0 enables counting, so on the way in (OUT = 0) it counts, on the way out (OUT = 1) it stays. No new gates needed.
| Part | Pin | Label |
|---|---|---|
| CD4029 | PE Q4 J4 J1 CI Q1 CO BD UD Q2 J2 J3 Q3 CLOCK | RESET V3 GND GND OUT V0 COV GND VCC V1 GND GND V2 BOTH |
| CD4029 | PE Q4 J4 J1 CI Q1 CO BD UD Q2 J2 J3 Q3 CLOCK | RESET W3 GND GND COV W0 COW GND VCC W1 GND GND W2 BOTH |
Step 4. Four CD4511 decoders
| Part | Pin | Label |
|---|---|---|
| CD4511 | B C LT BL LE D A e d c b a g f | U1 U2 VCC VCC GND U3 U0 Ue Ud Uc Ub Ua Ug Uf |
| CD4511 | B C LT BL LE D A e d c b a g f | T1 T2 VCC VCC GND T3 T0 Te Td Tc Tb Ta Tg Tf |
| CD4511 | B C LT BL LE D A e d c b a g f | V1 V2 VCC VCC GND V3 V0 Ve Vd Vc Vb Va Vg Vf |
| CD4511 | B C LT BL LE D A e d c b a g f | W1 W2 VCC VCC GND W3 W0 We Wd Wc Wb Wa Wg Wf |
Step 5. Four displays
Copy the display from lesson 4 (legs a–g are already named) three more times (Cmd+C, Cmd+V) — if you do not have it, build it as in lesson 4. Place them in pairs: tens on the left, units on the right; on top — "inside", below — "total in". Labels on the legs:
| Part | Pin | Label |
|---|---|---|
| Segment LCD "inside" — tens | a b c d e f g | Ta Tb Tc Td Te Tf Tg |
| Segment LCD "inside" — units | a b c d e f g | Ua Ub Uc Ud Ue Uf Ug |
| Segment LCD "total" — tens | a b c d e f g | Wa Wb Wc Wd We Wf Wg |
| Segment LCD "total" — units | a b c d e f g | Va Vb Vc Vd Ve Vf Vg |
6.5. Check
The "inside" display — how many people are in the shop now; "total in" — how many came in since the last reset.
- Press Reset — both displays show 00. Reset is a button: while it is pressed (or a switch is at 1) the counters hold 00 and do not count.
- Walk a person in (as in lesson 5):
Alt/⌘+ click on A, on B — both displays 01; clear A, clear B. - Once more — 02 / 02.
- Walk a person out: B, A, clear B, clear A — "inside" 01, "total" 02.
- Stand on one beam and leave — nothing changes.
| What happened | Inside | Total |
|---|---|---|
| Reset | 00 | 00 |
| in | 01 | 01 |
| in | 02 | 02 |
| out | 01 | 02 |
| stood on beam A | 01 | 02 |
"Inside" does not stop below zero: 00 − 1 = 99 — that is how the CD4029 counts. In the morning the shop opens with Reset.
Lesson 6 paste (Cmd+I)
On top of lesson 5. You need CD4029 and CD4511. The paste does not place the displays — four copies of the lesson 4 display ("Four displays" step).
# Lesson 6 — the visitor counter: "inside" (+1 / -1) and "total in" (only +1) displays on the lesson 5 circuit.# Paste: Cmd+I on top of lesson 5 (CD4029 and CD4511 needed). The displays are placed by hand. button{label="Reset"}(RESET)CD4029(PE=RESET, Q4=U3, J4=GND, J1=GND, CI=GND, Q1=U0, CO=COU, BD=GND, UD=IN, Q2=U1, J2=GND, J3=GND, Q3=U2, CLOCK=BOTH)CD4029(PE=RESET, Q4=T3, J4=GND, J1=GND, CI=COU, Q1=T0, CO=COT, BD=GND, UD=IN, Q2=T1, J2=GND, J3=GND, Q3=T2, CLOCK=BOTH)CD4029(PE=RESET, Q4=V3, J4=GND, J1=GND, CI=OUT, Q1=V0, CO=COV, BD=GND, UD=VCC, Q2=V1, J2=GND, J3=GND, Q3=V2, CLOCK=BOTH)CD4029(PE=RESET, Q4=W3, J4=GND, J1=GND, CI=COV, Q1=W0, CO=COW, BD=GND, UD=VCC, Q2=W1, J2=GND, J3=GND, Q3=W2, CLOCK=BOTH)CD4511(B=U1, C=U2, LT=VCC, BL=VCC, LE=GND, D=U3, A=U0, e=Ue, d=Ud, c=Uc, b=Ub, a=Ua, g=Ug, f=Uf)CD4511(B=T1, C=T2, LT=VCC, BL=VCC, LE=GND, D=T3, A=T0, e=Te, d=Td, c=Tc, b=Tb, a=Ta, g=Tg, f=Tf)CD4511(B=V1, C=V2, LT=VCC, BL=VCC, LE=GND, D=V3, A=V0, e=Ve, d=Vd, c=Vc, b=Vb, a=Va, g=Vg, f=Vf)CD4511(B=W1, C=W2, LT=VCC, BL=VCC, LE=GND, D=W3, A=W0, e=We, d=Wd, c=Wc, b=Wb, a=Wa, g=Wg, f=Wf)¿No te sale? Algo no funciona →