Rotary Dialer PIC Interface


Introduction: Rotary Dialer PIC Interface

About: My name is Randy and I am a Community Manager in these here parts. In a previous life I had founded and run the Instructables Design Studio (RIP) @ Autodesk's Pier 9 Technology Center. I'm also the author ...

I have found myself with an abundance of rotary phones. In fact, they're everywhere I look. In hopes that I may someday see less of them, I've begun taking them apart and re-using the parts for other purposes.

For some reason I got it into my brain that interfacing the rotary control with a PIC chip would be a good idea. I can only think of a couple of vague uses for it at the moment and none are particularly useful, but I hope to do something cool with this in the future.

Step 1: Go Get Stuff.

You will need:

1 - Rotary phone
3 - 220 ohm resistors
2 - 0.1uF capacitors
2 - 20K resistor (can substitute anything between 10K and 47K)
2 - LEDs
1 - PIC development board (I used the Basic Micro development environment)
1 - 20 MHZ resonator or crystal
1 - Breadboard
1 - 5V power source
1 - A foot or so of hookup wire
1 - Screwdriver
1 - Wire stripper

Step 2: Dissect the Phone.

Open up your rotary phone. On the inside you will notice the few basic parts; the rotary dial, the ringer, two jacks, the hook switch and the basic circuitry which is usually encased in a metal junction-box-like thing.

There will be four wires running from the rotary dialer to this junction-box-like thing. The wires should be held in place by little more than tightened screws. Loosen the screws and disconnect the wires.

After that, disconnect the rotary dialer from the phone itself.

Step 3: Determine What the Wires Do.

Wire up two LEDs as shown in the diagram below.

The two white wires should be the pair that closes the switch that lets you know when the dial is turned. The blue and green wire should be the pair that lets you know what number was dialed.

As such, when you turn the dial, the LED connected to the white wires should turn on, and when you let go of the dial, the LED connected to the blue and green wires should blink on and off as many times as the number you dialed (see video).

For instance, if you dial 8, the LED connected to the green and blue wire will turn off and on 8 times. This happens because one way to dial a phone number is to rapidly break the connection the number of times for the digit you are trying to dial. So, again, to dial an 8 you would have to rapidly break the connection 8 times.

Step 4: Connect the Dialer to the PIC Chip.

Connect the rotary dialer to the PIC chip as seen in the diagram. Notice that I am reading in the state of the rotary dialer by using RC-timing. In other words, the PIC chip is counting the number of times it takes for a capacitor to discharge (which changes when resistance is added).

That is where the 20K resistor comes in. Adding this to the input allows for a clear differentiation between the signal from a closed and open rotary switch connection.

Step 5: Assemble the Code.

To program the chip, I used the MBasic development environment available from Basic Micro. MBasic, quite simply, is a variation of Basic designed for use with PIC chips. It is easily convertible into a more universal (useful) language.

The code is essentially determining when someone has turned the dial and then does edge-detection on the signal (determining low-high transitions) until the dial recoils to its initial state. After tallying the number of times it measures a signal transition, it then blinks the LED accordingly.

For instance, if you dial 3, the PIC will count three low-high transitions and then blink an LED 3 times.

The LED, as you may have inferred, is unnecessary for this to operate and is just there to give you visible feedback. You can substitute any output device that you deem necessary.

Here is some code:

CPU = 16F877
MHZ = 20
CONFIG 16254

clicker var word
startcountin var word
countclicks var word
repvar var word
clacker var word
largefig var word


countclicks = 0
repvar = 0
'sets/resets values

high B2
rctime B2,1,startcountin
countclicks = 0
if startcountin > 10 then goto countmeup
' checks to see if dial has been turned and goes to subroutine if it has

goto main



high B1
rctime B1,1,clacker
'sets compare value

goto countmeuploop



high B1
rctime B1,1,clicker
'checks counting value

largefig = clacker + 100
'sets a value for the threshold that will be larger
'than 0 but lesser than possible pin-high values

if largefig < clicker then
countclicks = countclicks + 1
'adds 1 value every time a low to high transition is recorded

high B2
rctime B2,1,startcountin

if startcountin < 10 then
if countclicks > 0 then
goto blink
goto main
'checks to see if the dial has recoiled back to its initial state
'if it has and a number was dialed it goes to the LED routine
'otherwise, if no number was dialed it goes to main

clacker = clicker
'resets the comparison value to the current pin value

goto countmeuploop
'no pauses AT ALL in this routine!



repvar = repvar + 1
'counts each repetition of this routine

high B3
pause 1000
low B3
pause 1000
'blinks the LED

if repvar = countclicks then
repvar = 0
goto main
'if the repetitions equal the number of times the LED should blink
'then it goes back to the main routine

goto blinker

Step 6: Testing.

If you did everything the same as I, it should work (see video).

If it doesn't work, make sure that you wired everything correctly and that the code is copied correctly. Also, be certain that your resonator (or crystal) is 20 MHZ. If you wrote your own code make sure there are no pauses in the routine that checks for low-high transitions.

Step 7: Go Beyond.

Figure out some sort of other use for the rotary dial other than blinking an LED.



    • Clocks Contest

      Clocks Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Oil Contest

      Oil Contest

    25 Discussions

    I have a rotary dial, and I have often wanted to construct a wood box
    for it with a single VFD tube on the top that shines a digital number
    coinciding with the number dialed. I have very minimal aptitude for the
    deep electronics necessary, but I can make the box. Any diagram help
    you can render me, I would very much appreciate.


    11 years ago

    How about adding on a DTMF encoder and speaker/cellphone headset connector? Perhaps a y-connector, too, for the headset connector. Or maybe something bluetooth...

    1 reply

    Seems to me that with BASIC-AVR also AVR-CPU's DO support DTMF coding !! Because clearly DTMF programming is completely supported in the Basic Compiler for AVR-Chips easily!

    By-the-way: I wrote a similar program in Flowcode that was published in Dutch Elektor April 2007.

    I like this, there are some retro-fans out there that could use this to connect the old dial phones to their phone lines.

    Hey...I was trying to think of a way of using it to input passwords or maybe a pin number that will switch on a PC or something..any ideas?

    just sayin': I really want to call the number on the phone, but I'll probably get charged a lot in long distance

    Great job. I was just wandering how i could transform an old phone to work with dtmf. I guees i have half of the answer. I was thinking of couting impulsions with a pic that would control a dtmf emitter when i found your intructuables. This is exectaly the starting point i needed as i was not sure how to connect the rotary switch to the ppic. This is just a porject in my head at the moment but i'll surely come bak if it goes furtuher

    1 reply

    The pic can generate DTMF tones easily. AVRs can't. You can also get another chip to do it. Holtek manufactures some that are cheap and easy to use.

    Use a HCF4017BEY to do it. They have 10 decoded outputs which could then be buffered and sent to some device which could use the signals.............only an idea, so you dont have to write any code.

    2 replies

    This old boat of mine uses a dail to control it... sends pules to the boat..

    C:\old king\reciver.jpgC:\old king\kqs.jpgC:\old king\rudder.jpgC:\old king\guts.jpg

    Nice! I have an old rotary dial phone out in the garage. It was in my parents house back in the day. We got it in 1976. Still works! I love the feel of dialing a rotary phone and the real ring of the bell. It would be very cool to hook this up as a 10 key numeric entry for a computer. Not practical but fun non-the-less.

    woha i love this project I would love to use it for my computer in planning (a suite case computer in a spy like design think 007) but how would one go about connecting it over usb or similar, I am reasonably handy whit a sodering iron. But this kind of electronics are out of my league

    1 reply

    The easiest way to use it as a USB controller is to hack a USB keyboard (or number pad) as seen here:

    Also, sells a micro controller development board for an ATMEGA168 chip called an Arduino which really simplifies working with micro controllers (and is completely open source too).

    Brilliant idea! Could perhaps be used to dial a phone number on your computer for VOIP like Skype. Or you could perhaps use it to perform Macro functions on your PC. Dial 7 and it would open the Text Editor for example. I don't really understand why you need the RC circuit to detect the pulses. With an ideal switch you should just be able to connect one end to +5v and the other to an I/O pin on the PIC. This will detect the closing of the switches. The only possible reason I can see for doing it this way is to de-bounce the noisy signal that the switch produces as it opens and closes. This could just as easily be done in software however. The timer ports on any microcontroller are very powerful tools that would be perfect for this kind of task. This will keep counting the dialing pulses regardless of what the software is doing at that moment in time. Once the dial has returned to its start position you simply read the value stored in the timer and that will be the number that you have dialed. Keep up the good work.


    11 years ago

    Playing with the idea for over a year now to make a mobile phone from a rotary phone. Just like sparksfun but then use a simple siemens m35 (or another cheap old mobile that understands AT-hayes commands) instead of an expensive GSM-module.

    I did this as well on an Arduino board. I use them for making and performing computer music. Two telephones and a microphone... forgive me.... I can also pipe sound in to the phone and use them sort of like DJ head phones. I set it up once to make the bells ring with Open Sound Control.
    Funny how DTMF is Analog signaling and the old Rotary is all digital.

    Arduino <-> serial <-> USB <->Python <-> OSC <-> supercollider, pure data or whatever


    you can see pics of a performance that my Friend dug put up on my myspace page. I am really bad at documentation. look in the Friends Comments.

    myspace link


    11 years ago

    Idea: Use it as the interface to a lock of some sort. Idea: Use it as input to a calculator. Bad Idea: Use the output of the PC board to dial the phone. Idea: Use it as a numeric keypad for a laptop computer.

    1 reply

    OOOOHHH a rotary calculator would be great hehehe maybe find a way to make a rotary dial cellphone?