# Scrambled Number Security Keypad

## Overview

https://www.youtube.com/watch?v=5uwrZtHLxbU

Electronic keypads are often used to enter a password to perform a function, such as open a door in a security application. No key is needed, only memorization of a passcode.

Many keypad implementations suffer from several security issues which make a keypad entry system much less secure. Using the same keys on the keypad over and over may lead to someone in the vicinity seeing the pattern of keystrokes used. Also, over time the used keys will start to wear down, allowing a person to more easily guess the digits used on the keypad.

There are methods to thwart the shortcomings noted above. One such was implemented by Stephen B. Hirsch circa 1980. He developed a lock which scrambled where the digits would be located on the keypad. This prevented the use of pattern memorization and created even wear on the keys. There is a [demonstration video on YouTube](https://www.youtube.com/watch?v=4jUx4-PCr8A "demonstration video on YouTube").

![circuitpython_scramblepad.png](https://cdn-learn.adafruit.com/assets/assets/000/104/312/medium640/circuitpython_scramblepad.png?1630451197)

The [Hirsch Scramblepad](https://blog.adafruit.com/2019/03/13/high-security-the-hirsch-scramblepad-security/ "Scramblepad") required 7-segment displays on the keys, a costly proposition. But that can be simulated on the Adafruit MacroPad.

This project will use the much, much less expensive (and much more fun) Adafruit MacroPad to simulate some of the high security features of locks such as the Hirsch Scramblepad. As the keys do not have displays in them (only colorful LEDs underneath), the scrambled numbers will be displayed on the MacroPad display

![](https://cdn-learn.adafruit.com/assets/assets/000/104/317/medium800/circuitpython_project.jpg?1630509410)

The MacroPad will include an indication of success and failure. Optionally, the digital pins on the STEMMA QT port can be used to trigger opening of a solenoid lock with a bit of standard electronics, if desired.

## Parts
### Adafruit MacroPad RP2040 Starter Kit - 3x4 Keys + Encoder + OLED

[Adafruit MacroPad RP2040 Starter Kit - 3x4 Keys + Encoder + OLED](https://www.adafruit.com/product/5128)
Strap yourself in, we're launching in T-minus 10 seconds...Destination? A new Class M planet called MACROPAD! M here stands for Microcontroller because this 3x4 keyboard controller features the newest technology from the Raspberry Pi sector: say hello to the RP2040. It's a speedy...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5128)
[Related Guides to the Product](https://learn.adafruit.com/products/5128/guides)
![Video of a hand playing with a rainbow-glowing keypad.](https://cdn-shop.adafruit.com/product-videos/640x480/5128-08.jpg)

### USB Type A to Type C Cable - approx 1 meter / 3 ft long

[USB Type A to Type C Cable - approx 1 meter / 3 ft long](https://www.adafruit.com/product/4474)
As technology changes and adapts, so does Adafruit. This&nbsp;&nbsp; **USB Type A to Type C** cable will help you with the transition to USB C, even if you're still totin' around a USB Type A hub, computer or laptop.

USB C is the latest industry-standard connector for...

In Stock
[Buy Now](https://www.adafruit.com/product/4474)
[Related Guides to the Product](https://learn.adafruit.com/products/4474/guides)
![Angled shot of a coiled black, USB-C to USB-A cable.](https://cdn-shop.adafruit.com/640x480/4474-02.jpg)

Optional keycaps for the lower left and right of the keypad:

### Black Windowed Lamp R4 Keycap for MX Compatible Switches

[Black Windowed Lamp R4 Keycap for MX Compatible Switches](https://www.adafruit.com/product/5112)
These stark and elegant **Black Windowed Lamp R4 Keycaps** are made of opaque black plastic with a small cutout in the south-center edge that wraps around the top and bottom. The cut-out has a clear plastic window to allow an LED installed under the switch to glow through. They...

In Stock
[Buy Now](https://www.adafruit.com/product/5112)
[Related Guides to the Product](https://learn.adafruit.com/products/5112/guides)
![Angled shot of single black 1U R4 lamp keycap.](https://cdn-shop.adafruit.com/640x480/5112-05.jpg)

To make the optional solenoid lock driver:

### Lock-style Solenoid - 12VDC

[Lock-style Solenoid - 12VDC](https://www.adafruit.com/product/1512)
Solenoids are basically electromagnets: they are made of a big coil of copper wire with an armature (a slug of metal) in the middle. When the coil is energized, the slug is pulled into the center of the coil. This makes the solenoid able to pull from one end.  
  
This solenoid in...

In Stock
[Buy Now](https://www.adafruit.com/product/1512)
[Related Guides to the Product](https://learn.adafruit.com/products/1512/guides)
![Angled shot of lock-style solenoid.](https://cdn-shop.adafruit.com/640x480/1512-04.jpg)

### Part: TIP120
quantity: 1
 Power Darlington Transistor
[TIP120](https://www.adafruit.com/product/976)

### Part: Breadboard
quantity: 1
Half-size
[Breadboard](https://www.adafruit.com/product/64)

### Part: 1N4001 Diode 
quantity: 1
10 Pack (1 used)
[1N4001 Diode ](https://www.adafruit.com/product/755)

### Part: Through-Hole Resistor - 2.2K ohm 
quantity: 1
5% 1/4W - Pack of 25
[Through-Hole Resistor - 2.2K ohm ](https://www.adafruit.com/product/2782)

### Part: Female DC Power adapter
quantity: 1
 - 2.1mm jack to screw terminal block
[Female DC Power adapter](https://www.adafruit.com/product/368)

### Part: STEMMA QT / Qwiic JST SH Cable
quantity: 1
4-pin to Male Headers Cable - 150mm Long
[STEMMA QT / Qwiic JST SH Cable](https://www.adafruit.com/product/4209)

### Part:  Hook-up Wire Spool Set
quantity: 1
 22AWG Solid Core - 6 x 25 ft
[ Hook-up Wire Spool Set](https://www.adafruit.com/product/1311)

- [Next Page](https://learn.adafruit.com/scrambled-number-security-keypad/macropad-assembly.md)

## Featured Products

### Adafruit MacroPad RP2040 Starter Kit - 3x4 Keys + Encoder + OLED

[Adafruit MacroPad RP2040 Starter Kit - 3x4 Keys + Encoder + OLED](https://www.adafruit.com/product/5128)
Strap yourself in, we're launching in T-minus 10 seconds...Destination? A new Class M planet called MACROPAD! M here stands for Microcontroller because this 3x4 keyboard controller features the newest technology from the Raspberry Pi sector: say hello to the RP2040. It's a speedy...

Out of Stock
[Buy Now](https://www.adafruit.com/product/5128)
[Related Guides to the Product](https://learn.adafruit.com/products/5128/guides)
### USB Type A to Type C Cable - approx 1 meter / 3 ft long

[USB Type A to Type C Cable - approx 1 meter / 3 ft long](https://www.adafruit.com/product/4474)
As technology changes and adapts, so does Adafruit. This&nbsp;&nbsp; **USB Type A to Type C** cable will help you with the transition to USB C, even if you're still totin' around a USB Type A hub, computer or laptop.

USB C is the latest industry-standard connector for...

In Stock
[Buy Now](https://www.adafruit.com/product/4474)
[Related Guides to the Product](https://learn.adafruit.com/products/4474/guides)
### Lock-style Solenoid - 12VDC

[Lock-style Solenoid - 12VDC](https://www.adafruit.com/product/1512)
Solenoids are basically electromagnets: they are made of a big coil of copper wire with an armature (a slug of metal) in the middle. When the coil is energized, the slug is pulled into the center of the coil. This makes the solenoid able to pull from one end.  
  
This solenoid in...

In Stock
[Buy Now](https://www.adafruit.com/product/1512)
[Related Guides to the Product](https://learn.adafruit.com/products/1512/guides)
### TIP120 Power Darlington Transistors - 3 pack

[TIP120 Power Darlington Transistors - 3 pack](https://www.adafruit.com/product/976)
Transistors are powerful little electronic switches, and when our little NPN transistors aren't power enough for your project, we have been known to use these beefy TIP120 Darlington transistors. Great for whenever you need to control medium to high-power electronics such as motors,...

In Stock
[Buy Now](https://www.adafruit.com/product/976)
[Related Guides to the Product](https://learn.adafruit.com/products/976/guides)
### Half Sized Premium Breadboard - 400 Tie Points

[Half Sized Premium Breadboard - 400 Tie Points](https://www.adafruit.com/product/64)
This is a cute, half-size breadboard with&nbsp;400 tie points, good for small projects. It's 3.25" x 2.2" / 8.3cm&nbsp;x 5.5cm&nbsp;with a standard double-strip in the middle and two power rails on both sides.&nbsp;You can pull the power rails off easily to make the breadboard as...

In Stock
[Buy Now](https://www.adafruit.com/product/64)
[Related Guides to the Product](https://learn.adafruit.com/products/64/guides)
### Female DC Power adapter - 2.1mm jack to screw terminal block

[Female DC Power adapter - 2.1mm jack to screw terminal block](https://www.adafruit.com/product/368)
If you need to connect a DC power wall wart to a board that doesn't have a DC jack - this adapter will come in very handy! There is a 2.1mm DC jack on one end, and a screw terminal block on the other. The terminals are labeled with positive/negative assuming a positive-tip configuration...

In Stock
[Buy Now](https://www.adafruit.com/product/368)
[Related Guides to the Product](https://learn.adafruit.com/products/368/guides)
### 1N4001 Diode - 10 pack

[1N4001 Diode - 10 pack](https://www.adafruit.com/product/755)
This here is a 10 pack of the classic 1N4001 power blocking diode. These are good for reverse polarity protection (put it between your DC power jack and circuitry to avoid a negative-voltage that would zap your delicate electronics), kickback protection (place across your solenoids, relays...

Out of Stock
[Buy Now](https://www.adafruit.com/product/755)
[Related Guides to the Product](https://learn.adafruit.com/products/755/guides)
### Through-Hole Resistors - 2.2K ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 2.2K ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/2782)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 2.2K Ω Resistors.** More specifically, they are **carbon film** , through-hole...

In Stock
[Buy Now](https://www.adafruit.com/product/2782)
[Related Guides to the Product](https://learn.adafruit.com/products/2782/guides)

## Related Guides

- [Adafruit MacroPad RP2040](https://learn.adafruit.com/adafruit-macropad-rp2040.md)
- [MacroPad Summer Olympics Hotkeys](https://learn.adafruit.com/macropad-olympic-hotkeys.md)
- [MACROPAD Hotkeys](https://learn.adafruit.com/macropad-hotkeys.md)
- [An Introduction to RP2040 PIO with CircuitPython](https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython.md)
- [MacroPad Braille Keycaps](https://learn.adafruit.com/macropad-braille-keycaps.md)
- [Custom HID Devices in CircuitPython](https://learn.adafruit.com/custom-hid-devices-in-circuitpython.md)
- [Keypad and Matrix Scanning in CircuitPython](https://learn.adafruit.com/key-pad-matrix-scanning-in-circuitpython.md)
- [Ableton Live MacroPad Launcher](https://learn.adafruit.com/ableton-live-macropad-launcher.md)
- [MacroPad Remote Procedure Calls over USB to Control Home Assistant](https://learn.adafruit.com/macropad-remote-procedure-calls-over-usb-to-control-home-assistant.md)
- [MacroPad 2FA TOTP Authentication Friend](https://learn.adafruit.com/macropad-2fa-totp-authentication-friend.md)
- [Minecraft Turbopad](https://learn.adafruit.com/minecraft-turbopad.md)
- [MP3 Playback on RP2040 with CircuitPython](https://learn.adafruit.com/mp3-playback-rp2040.md)
- [Dragon Drop: a CircuitPython Game for MacroPad](https://learn.adafruit.com/dragon-drop-a-circuitpython-game-for-macropad.md)
- [AdaBox 019](https://learn.adafruit.com/adabox019.md)
- [3D Printed Stand for MacroPad RP2040](https://learn.adafruit.com/3d-printed-stand-for-macropad-rp2040.md)
