loading

I was given a payphone by my neighbor (he had removed the actual phone assembly) and I'm not sure what I want to do with it, just yet. But I know that whatever I do, I will want to be able to use the different parts of the phone, inclduing the keypad. Therefore, I've decided to use an Attiny85 to modularize the keypad, sending the key pressed to another microcontroller (ie. an Arduino acting as a main controller) via I2C communication.

To read all the keys, I will be using a voltage divider with different resistors to actually read six keys on each analog input pin of the ATtiny85. I will explain this more when we get to the electronics.

Step 1: Parts

Parts

  • payphone with keys
  • ATtiny85
  • resistors: 12, 27, 47, 100, 150, 270 kOhm (2 of each)
  • wire (several different colors may be helpful, but aren't necessary)
  • heat shirnk insulation

Tools

  • computer
  • Arduino Uno
  • soldering iron
  • solder
  • screwdrivers of different sizes
  • chisel
  • breadboard
  • breadboarding wires
  • 10uF, 6+V capacitor (doesn't need to be 10uF, I used 4.7uF and I've seen others use 1uF)

I have also attached some useful resources that I frequently use during many of my projects.

Step 2: Accessing the Keypad

First, we need to get to the keypad, but this may be a different process for you if you have a different payphone than I do. With that in mind, I will describe how I did it and hopefully all, or parts, of my explination will be applicable.

So, first, I opened up the front of the payphone using the two keys given to me. The actual phone part was removed when the payphone was taken down, so all that was left was the coin mech and the keypad area. I undid the four screws that secured the brackets for the peypad area (shown in Figure 1), allowing me to remove the keypad area (shown in Figure 2). I removed all the wire plugs from the brown circuit board. Then I removed the black, plastic dots that were holding the board to the buttons (shown in Figure 3) using a sharp chisel, and the metal plugs where the wire had attached to by prying them off with pliers. Then, with a little bit of help, the board came off.

I was then left with the circuit board (show in Figure 4) and the rubbery parts of the buttons (shown in Figure 5).

Step 3: About the General Keypad Circuit Board

In order to wire this board, we need to understand how the keypad works.

First, when a button is pressed a conductive surface on the rubber part bridges the gap between the contacts. This completes a circuit, telling the computer the button is pressed.

Secondly, the buttons are connected in a 3x4 array, where one of the contacts for the button is connected to the rest of the row, and the other contact is connected to the rest of the column (see Figure 1). Therefore, when a button is pressed, the controller actually recieves two signals, one row and one column, allowing it to pinpoint the button pressed (much like (x,y) coordinates on a Cartesian coordinate system).

With this setup, it would take 7 digital input pins on the controller to read the 12 keys. Instead, I want to use 2 analog input pins on the ATtiny85 to read the same 12 keys.

Step 4: Wiring the Keypad

Advice: This is the trickiest part of the project so take your time doing this to make sure you don't have to come back.

First, I removed the buzzer (the black cylinder) on the back of the board to give me room to run wires through the circuit board (Figures 1 and 2). This is easily done with some desoldering wick.

I wired the keypad according to the schematic in Figure 3. This takes advantage of something called a voltage divider. I got the idea from this Instructable here, showing how to turn one input into 5. Here is another good link if you want to learn about this method and the math behind it. Basically, each button is attached to a different resistor*, causing a different voltage to go to the analog pin. This results in a different analog reading for each button.

I split up the 12 keys into two sets of 6, buttons 1 through 6 and 7 thorugh #, one set for each analog pin.

For the actual wiring, I used the already exsiting row connections to act as the power line since these were already in place, and I could follow the circuit to find which pin in the grey box on the back it was connected to. I could then supply the power through these pins, making the wiring a bit easier. Then I broke the column connections with a chisel. This is important to get right, so really make sure these connections are broken before moving on. I then drilled a small hole, just large enough for 3 or 4 of my wires the fit through (Figure 4), for each row. I then soldered a wire to the contact of each button that wasn't the one shared by the row. This is also another place to be careful: you don't want to cross the gap of the contacts with solder. To help, you can use a small screwdriver to srape some of the covering off of the contact's circuit further upstream and solder there (see Figure 5). This reduces the chance of making a short circuit across the contact. I then threaded the wires through the holes I drilled.

To finish, I labeled all of the wires with which button they represented using some blue tape.

Step 5: Testing Connections

Then, I figured this is a good time to check the connections I had made, checking for three possible errors: I short circuited the button with bad soldering, the soldering wasn't good enough, or I hadn't broken the column connections properly.

To do this, I made a simple circuit consisting of a 9V battery, small red LED, some wire, two aligator clips and a 260 Ohm resistor. I'm not sure on the specs of the LED, but I knew it could handle atleast 2V and 20 mA (or 0.02A) so I used those numbers for the resistor calculation and used then a stronger resistor*. I posted a photo of the simple circuit as Figure 1.

I put the rubber buttons and the circuit board back into the phone (it was a bit harder to screw the brackets down because of the wiring) and then connected one end to the pin that supplied power to the row and the other clip to one of the buttons in that row. I then pressed the button, lighting the LED if there was a proper connection. Then I tried pressing the keys around this button to make sure I had cut the columns properly. I attached a video of this test.

After finding that the connections were good, I moved on.

*I'm lazy and used this calcuator to find the right resistor. Your calcultions may be different than mine if you are using a different LED or battery.

Step 6: Testing the Code

Before I soldered in the resistors, I used them on a breadboard to test all the code and electronics.

First, I to uploaded the code, attached at the bottom, to the ATtiny85. There are many tutorials on how to do this using the Arduino Uno as an ISP, but most of the tutorials out there are based off of this one. (Don't foget to upload the program onto the Uno to make it an ISP as shown here.)

In the code I wrote, I am communicating to the Uno through I2C. If you want to use this, you will need to download the library that allows the ATtiny85 to do this. This library, TinyWireS, can be downloaded here. Just upload this to the library folder in the Arduino IDE sketchbook folder.

Then upload the Arduino Uno code, attached at the bottom, also, to the Uno.

Lastly, connect everything as shown in the schematic (Figure 1), plug in the Uno to your USB port and open the Serial Monitor. Press some buttoms and you should get something that looks like Figure 2.

I attached a video of my test to this page.

Step 7: Finishing Wiring

So I have decided to leave everything on a breadboard* since I am not done with the payphone, just the keypad, but you are definitely welcome to solder everything onto a perfboard for something more permanent. I recommend using an IC socket for the ATtiny85 so it can be easily removed, just incase.

To start, I cut the resistor's legs (Figure 1), one short to be soldered to the wire connected to the button and one longer to be slid into a female-to-male breadboarding wire. I soldered the wire and resistor (Figure 2), then added the heatshrink insulation for short circuit protection. I used a soldering iron to heat the insulator, making it shrink around the connection.

Lastly, once all of the resistors were in place and the breadboard wires attached, I finished the circuit on the breadboard along with the ATtiny85 (uploaded with the proper code). Then before I stuffed everything in, I did one last test of the circuit.

*My breadboard is quite large for this project so I've ordered a small breadboard that is currently on it's way. A pack of 5 of these can be found on eBay for like $4.

Step 8: Done!

To finish this project, I just smushed everything into the phone housing (an Arduino Protoshield would have been nice here). As I mentioned before, I ordered a small breadboard, which I will replace for the current huge one once it arrives. I couldn't get any photos of this process since I was using both hands very precariously. I threaded the USB cord for the Arduino through a hole in the back of the phone to the computer.

But once it is done, all that is left to do is test it all out! I have attached another video of this.

What is great about this build is that since the ATtiny85 is monitoring the keypad and only calls the Arduino when a button is pressed, the Uno can do anything it wants in the meantime, freeing it up for other processes.

If you have any questions or comments (including if you found any spelling or grammer errors), please don't hesitate to leave it below in the comment section, or send me a personal message. Thanks for reading!

If you liked this Instructable, please vote for me in the Phone Contest and also follow my (soon to be) tweeting mint plant, @Minty_Python.

<p>Very interesting. I've got an older keypad that is more mechanical to activate the DTMF tones. But now this instructable gives me some ideas.</p>
<p>Excellent! If you do, enter the project in the Remix Contest and link back to this Instructable :) </p><p><a href="https://www.instructables.com/contest/remix2015/">www.instructables.com/contest/remix2015/</a></p>
<p>And then send me the winnings? :)</p>
<p>no more vertical video. PLEASE :D<br>hold your phone horizontal</p>
<p>I hear you. Next Instructable, I'll do it properly, I promise :)</p>

About This Instructable

6,440views

42favorites

License:

More by JoshuAc00k:Payphone Keypad Breakout How To Measure Fluorescence from IF Stianing Secret Pouch for Pen Knife 
Add instructable to: