This showed up in my Facebook memories this morning and I quickly shared it.
Then I thought about it for a minute and the scale on the chart seemed out of whack, so I deleted the post. I opened up a Google spreadsheet and started messing with numbers. Here’s what a real chart looks like if you improve by 1% each day.
What does this really show though? If the starting number 1 represents your current ability in some skill, the end result is your ability in that skill. So if you improved by 1% each day, at the end of a year your skill level would be over 37x what it currently is. Conversely if you got 1% worse each day, at the end of a year you’d be left with about 2.5% of your original ability. I can’t think of any skill where either that much of an improvement or decline is possible by any stretch of the imagination.
What about 0.1% changes though?
If you got 0.1% better each day for a year, your skill level would improve by 44% and if you got 0.1% worse each day you’d be left with just under 70% of your ability. Now we’re getting somewhere realistic!
It’s still hard to grasp what that means though, with 1 representing some ability or skill level. To put this in perspective, I’ll use the time it takes to run a mile. Starting with a 10 minute mile on day one makes it easy to understand.
If you run 1% faster each day, you’d have to run a 15.5 second mile at the end of the year. Good luck!
If you run 0.1% faster each day, you’d be running a mile in 6:56 at the end of the year. That’s seems possible doesn’t it?
In parts 1 and 2, I walked through my journey of repurposing the keypad out of a phone from 1980. I learned that a more modern keypad matrix doesn’t exactly function (behind the scenes) in a way I’d expect. I wanted to understand it better so I set out to recreate a 2×2 keypad (kept it simple to make wiring easier) that would function the same way as something you can buy today. It would be a success if it worked with the Arduino Keypad Library.
From my earlier looks through the code I knew it pulsed power out to a column pin and then read in each row’s key from that column before switching to the next column and repeating the process. I figured that should be enough for me to wire this up and try example programs without going back to look at the library’s code again.
I don’t know why I was thinking this would be more complicated and at least a little more exciting, but it was unbelievably easy. I guess I should be celebrating I understood how it worked. Literally all you do is connect one side of every button in a column to a pin and one side of every button in a row to a pin. No need for connections to power, or ground. No pull up/down resistors.
It immediately worked with the Arduino Keypad library examples, even the MultiKey one. I guess being able to detect multiple key presses at once is where the advantage to this implementation comes in. It worked flawlessly when pressing 2 of the 4 buttons, but when you get to 3/4 there are too many connections to distinguish the keys.
Just to be sure I had it figured out, I added a 3rd column to make it a 2×3 grid and it was just as easy.
I love the beauty of how simple this is. I’ve added Fritzing for both of these to my phone-keypad GitHub repo (2×2 & 2×3). If you check this PDF, in the How it Works section it has a really good explanation and shows the row and column connections exactly like I came up with.
Naturally now I need to do a part 4 and attempt to recreate the keypad implementation I ended up with from the old phone. Due to how it mechanically makes the electrical connections I think it’s going to be a bit more complicated than this was. We shall see…
Go back and read Part 1 if you want to the full story on this little project. I did decide to get rid of the PCB on the old phone keypad. Good thing I’ve been getting a lot of desoldering practice. In order to remove the PCB, I first had to remove the wires I had added to the column and row contact points. That was easy and getting the PCB off was a pretty smooth process as well.
Now that I didn’t have the PCB to carry power and ground around everywhere, I had to solder in my own wires. I also had to solder back in all of my connection points to provide the outputs I’d feed into a microcontroller (I used an Adafruit Feather 32u4 Basic Proto).
Once all of the wires were in place and then connected to my microcontroller I wasn’t getting expected results from a simple little program I wrote to display the values. Took far too long for me to remember I needed to use pull down resistors to prevent floating values. I put 10k Ω resistors in each of the circuits…
Output from the pins couldn’t get any better…
I loaded an example from the Arduino KeyPad library, which gave me very weird behavior. After looking at the underlying code, I realized it wanted the outputs of the keypad to be HIGH when a key was not pressed and LOW when it was. Well, my circuit was doing the opposite, so I had to have to invert everything. I didn’t have any inverter ICs, so I used NPN transistors to create an inverter circuit on each output.
Progress. Now I was able to get the library to correctly recognize some key presses. 95% of the time it seemed to think everything was coming from column 1 (1, 4, 7, *) though. The library comes with a MultiKey example. When I ran that, it was reporting every key on the row as being pressed. WTF?!
For the life of me I could not figure out what caused this. I checked wires, measured voltages, did continuity tests, resoldered connections, changed boards, used different GPIO pins, and countless other things. Nothing made a difference. My own code was working beautifully though. Eventually I gave up on the library. It wasn’t worth the effort and I was out of ideas.
Update: Later on I went back and read the KeyPad library code again because it was bugging me. Turns out these keypads don’t actively read the column pins like they do the row pins. My assumptions about how they worked was very wrong because I hadn’t read far enough into the code before. When checking for key presses, typical keypads iterate through the columns to send a pulse which feeds over in to the rows, which are then read in. How a Key Matrix Works has a pretty good explanation with visuals. If I get my hands on another similar keypad maybe I’ll try to recreate this functionality.
I rewired everything to use the pull down resistors again (video of soldering). A huge benefit of the decision was it drastically simplified my circuitry. This would save me 49 solder points! I probably would have needed to use a half-size perma-proto board instead of the 1/4 size I ended up using.
I decided to put in a piezo buzzer to add sounds. I also used a tiny LED, which I had salvaged from some old computer speakers, to show when power is switched on to the backlight.
I tried a couple of different methods of producing touch tones (DTMF) to match up with each key, but with the microcontroller I’m using and the small piezo buzzer, the sound was terrible. I would need something a little more capable I think.
Here’s a demo video.
Hard to see the OLED screen in the video, but I was only using it to output each key press. Something like this…
I even went out of my comfort zone and did a quick share of this on Adafruit’s Show and Tell. If the video doesn’t start at the right spot you can skip ahead to the 12:42 mark. Going back to watch, my demo kind of sucked since it’s hard to hold something up to the Mac camera and push buttons at the same time.
Update: Continue on to Part 3, where I create a matrix of buttons to act as a keypad.
I’ve been on a kick tearing apart electronics. In addition to the switch I got a bunch of parts from, I’ve tore into a lamp and some old computer speakers. When I found an old telephone (it has a date of 5/30/1980 printed on it!) in my basement I knew I had to see what was inside. The previous owners left it in a storage room and I have no idea why I never pitched it. I didn’t take a picture before taking a screwdriver to it, but it looked exactly like the photo on the right.
People have been hacking phones for a long time. Perhaps the earliest and most well-known was the Steves (Jobs and Wozniak) using a blue box on payphones. I’m nowhere near that level, but you have to start somewhere right? I pulled the ringer, speaker, and microphone out of it. I haven’t messed with these yet.
The part I thought would be neat to work with was this keypad.
It was a bit of a process figuring out how to tap into this thing. Eventually I realized what these contact switches on the sides were for.
There are seven of them. The top has two and the bottom has one, which correspond to the 3 columns of keys on the grid. Then the left and right sides each have 2, which match up with the 4 rows of keys.
I figured out I could solder wires to the contacts points connected to each of those switches. I was in! From the way the keypad was connected to the rest of the phones circuitry I knew the screws were an important piece to tie it all back into the entire system. After some trial and error I determined which screws should be used for power (red wire) and ground (black) in order to get useable data out of the 7 switch contact points. The other 3 screws also connect to power. I was using alligator clips on those, but disconnected them for the picture.
Something isn’t quite right about the screw connections though. When I connect them the opposite way, flopping to have 1 power and 4 grounds, the backlight on the keypad works, but the readings from the soldered contact points are useless. With them connected this way, I don’t get the backlight, but I get data I can make sense of. There is probably something obvious I’m missing about how this all works together.
Unfortunately for me, the output from the contact points isn’t digital (limited to on/off), so I couldn’t use the Arduino library. It would have made things so much easier. It’s not surprising though, since this piece of technology is almost 40 years old!
I was able to get some code mostly working. Detecting the column of a button press was pretty straight forward and works great. Rows detection is another story. I’m reading in analog values and using sampling along with standard deviations to determine which row’s value is unlike the others. Well, the first row always reads a pretty high value, when a key on any row is pressed. The values for the other rows fluctuate as expected. When that first row is high, I’ve attempted to also look for a high value from another row, but it triggers the wrong row too often.
Even making this short little video, which took at least 5 takes, there was a false trigger for pressing 1 and many key presses not being recognized. Not useable.
I have a hunch the screw connections are responsible, at least in some part, for sending DTMF signals, also known as Touch-Tone. I don’t really care to get in the business of decoding these. This is precisely why I was hoping I could detect useful output from each of the row and column contact points.
I pulled apart the unit even more and discovered a Western Electric 557D is the brains of the operation, but it’s so old there doesn’t seem to be a datasheet online for it. What I’m going to do is remove the PCB and wire up everything on my own. Then I can easily get on/off as digital values from the columns and rows and make sure the backlight works. Stay tuned…
My posting streak hits triple digits with this post! It all started on November 10th. I tallied up some rough numbers:
You can get the function (not perfect) I wrote to calculate these numbers on GitHub.
I’m not sure if I’m getting burnt out or if I’m just not as excited about recent posts because I haven’t been working on many cool hobby projects to write about. Hopefully I can get motivated to finish up some projects I’ve already started and work on updates to others.
I don’t know how long I’ll continue this daily posting, but I do have a cool announcement coming next week.
When I adjust the volume on my entertainment system I will always stop on a number ending in 0, 2, 5, or 8; never 2. 3, 4, 6, 7, or 9. Even numbers kick more ass, but not enough to make me resist going one more notch from 4 or 6 to get to 5.