Family edition
Keyboard Builder: The Key Nobody Pressed
Your child finds out how a keyboard knows which keys are down, and catches it reporting a key nobody pressed.
What you need
- A computer or Chromebook with a current browser, and a mouse or trackpad.
- The lesson link: mytekdev.com/try/keyboardbuilder?lesson=the-key-nobody-pressed&ref=fam-keyboardbuilder-1. No account, no email and nothing to install.
Before you start: try it once yourself
Open mytekdev.com/try/keyboardbuilder?lesson=the-key-nobody-pressed&ref=fam-keyboardbuilder-1. A short guide opens over the app. The keyboard is a 60 percent board, 61 keys, and an order from a customer is on the right. Open the Matrix bench: the caps turn see-through and the gold lines under them are the row and column wires.
- The ghost. Click Q, W and A on the board. Each click holds a key down. S lights up pink, and the line under the board reads "The board sees 4 keys. You are holding 3. The pink one is a ghost."
- The fix. Under Diodes, click On. The line reads "You are holding 3 keys. The board sees 3." and the order closes with "Three keys held, three keys read."
- The cheaper fix. Take the order It says anti-ghosting on the box. The three keys are still held. Click Off under Diodes, then Block the doubt. The line reads "You are holding 3 keys. The board reports 2. It dropped A because it could not be sure." Three answers appear on the right; the one that closes the order is "No made-up key, but a real key can go missing".
- Other threes. Set the controller back to Report everything, and press Let go of every key before each test: a click on a held key lets it go. A, S and W give a ghost at Q. J, K and I give a ghost at O. Q, W and E, all in one row, give no ghost.
The ideas, in plain words
A wire for every key would take 61 pins on the controller, and the one in the app has 26. So the keys are wired as a grid. Each switch joins one row wire to one column wire. The controller powers one column at a time and reads the rows, about 1,800 times a second in the app, and works out which crossings are closed.
The trouble comes when three held keys sit on three corners of a rectangle: two rows and two columns. Current can run from the powered column through one switch, along a row, backward through a second switch, and through the third to the row of the fourth corner. The controller reads that row as joined to that column, and reports a key nobody pressed. A diode beside each switch lets current go one way only, which breaks the backward step. The other fix costs nothing: when a new key could be a ghost, the controller ignores it until another key is let go. Engineers call that blocking or jamming.
The keyboard in the app is a model. Its grid is the textbook one, with every key on its own row and column crossing; a real board often folds the grid to save pins. A real keyboard you can buy today almost never shows a ghost key: it either has a diode at every switch or it drops the key it cannot be sure of. On the Matrix bench, the panel named The keyboard in front of you counts the keys a child's real keyboard is reporting: on many laptops the count stops at 2 for some sets of three keys.
Do it together
- Open mytekdev.com/try/keyboardbuilder?lesson=the-key-nobody-pressed&ref=fam-keyboardbuilder-1 together. A short guide opens over the app. Open the Matrix bench and count the gold wires: 5 rows and 14 columns.
You'll know it worked when: That is 19 wires for 61 keys.
- Click Q, W and A on the drawn board so all three stay down.
If you get stuck: Click the keys on the screen. Your own keyboard will not show this.
You'll know it worked when: S lights up pink. The line under the board says it sees 4 keys and you are holding 3.
- Under Diodes, click On.
You'll know it worked when: Three keys held, three keys lit, and the order closes.
- Take the order It says anti-ghosting on the box. With the three keys still held, click Off under Diodes, then Block the doubt.
If you get stuck: If the keys were let go, click Q, W and A again, in that order.
You'll know it worked when: The board reports 2 keys. It dropped A because it could not be sure.
- Ask: which fix would you pay for, and why?
You'll know it worked when: Diodes read every key and need one more part for each key. Blocking is free and loses a real key.
Talk about it
Ask these while you work together. A child who has understood it can answer them without help:
- How many wires does this keyboard use, and how many would one wire per key take?
- Which key lit up that you did not press? Where does it sit compared with the three you held?
- Why did Q, W and E give no ghost?
- What did the diodes change? What did they cost?
- With the board blocking the doubt, which key went missing? Was it a key you were holding?
For younger and older kids
Younger: For a younger child, stop after the diodes and ask them to find another three keys that make a ghost.
Older: For an older teen, set the level to High school and ask them to draw the path the current takes around three closed switches to the fourth.
Keep going
- Find a rule: which sets of three keys make a ghost, and where does the ghost appear? Test the rule on three keys you have not tried.
- Click One wire per key under Wiring. How many pins does it take, and how many does this controller have?
- Change the size to Full size on the Build bench and come back. How many rows, columns and pins now? What does the card say about the controller?
Bring it into other subjects
- Math: a grid of 5 rows and 14 columns has room for 70 keys on 19 wires. How many keys could 6 rows and 21 columns hold, and on how many wires?
- Science: a diode is a one-way gate for electric current. Find one on a circuit diagram and say which way the current may go.
- English: write the two sentences a keyboard box should print in place of "anti-ghosting", so a buyer knows what the board really does.
- At home: on the Matrix bench, click the board and hold Q, W and A on a real keyboard. Does the count reach 3? Try other threes.
For your records
Ready to copy into an hour log, a portfolio or a transcript.
| Lesson | Keyboard Builder: The Key Nobody Pressed |
|---|---|
| Subjects | Computer science, Technology |
| Time | 45 minutes |
| What we did | Used a keyboard simulation to see how a key matrix is scanned, made a ghost key appear, fixed it with diodes, and compared that fix with blocking. |
| Skills practiced | How a keyboard matrix works; Testing a fix; Comparing two designs |
Keyboard Builder: The Key Nobody Pressed
Activity sheet (optional)
Name: ______________________________ Date: ______________
Open the app: scan the QR code, or go to mytekdev.com/try/keyboardbuilder?lesson=the-key-nobody-pressed
Essential question: How does a keyboard with 61 keys tell which ones are down using only 19 wires?
Warm-up: A keyboard has 61 keys. How many wires do you think it needs? ________
- Vocabulary. Matrix, controller, scan, ghost key, diode: write each in your own words.
- Count. Rows ________ Columns ________ Pins ________ Pins with one wire per key ________
- The test table. For each test write the three keys you held, the diodes (on or off), what the controller does, and what the board saw. Start with Q, W, A three ways: no diodes, diodes on, and blocking the doubt. Then A, S, W and Q, W, E with no diodes, and one set of your own.
1. Why did S light up when you held Q, W and A? Use the words row and column.
2. Diodes or blocking: which fix would you choose for a keyboard used for games, and what does it cost?
Quick check
Name: ______________________________
1. A keyboard matrix finds a pressed key by (A) a separate wire for every key (B) checking which row and column are joined (C) reading the letter printed on the cap
2. With no diodes, Q, W and A held made S appear because (A) S is a worn-out key (B) the four keys share two rows and two columns (C) the board scans too slowly
3. A box says "anti-ghosting". Name one thing that keyboard might do when three keys are held.
Answers
| Question | Answer | Why |
|---|---|---|
| 1 | B | Each switch joins one row to one column, and the controller scans for the crossings that are closed. |
| 2 | B | Three closed switches on three corners of a rectangle give the current a way around to the fourth corner. |
| 3 | Drop one of the keys | It can ignore a key it cannot be sure of, so no ghost shows but a real key goes missing. "Read all three, because it has diodes" is also right. |
If your state or umbrella school asks, this lesson covers CSTA 2017 2-CS-03, CSTA 2017 3A-CS-01, CSTA 2026 HS-SYS-HW-30.