# ARDUINO AND a DIALER DISK INTERFACING

1,547

53

2

by Francesco Fusco (francesco.fusco@virgilio.it)

Scope of the project is to interface a Disk Dialer (or a numbers selector) located on old phone (fixed line) with open source electronics in order to manage this input device (the ancestor of all digital keypads) (pict.1).

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Description and Objective

The idea is to interface the selector with an electronic circuit (pict.2) in order to recognize the numbers entered by the user with the disk/selector. Once we have this circuit we can use the numbers to dial numbers or send sms or use them as security codes or other else.

## Step 2: Device Analisys

The Dialer Disk is a mechanical gimmick (a very clever mechanism) that can be seen as a device that has 3 pins (see picture 3) that we call for semplicity:

• Common
• Pulse
• Activity

The names will be more clear later. When the user rotate the disk clockwise in order to compose a number, an internal spring is loaded (LOADING state), and then, when the user leave the finger, the disk rotates counterclockwise(RELEASING state) returning to the initial state (STANDBY). The diagram of states in picture 4.

## Step 3: Connections

The pictures 5 and 6 show how the pins are shorted to the common in the described phases. So, let’s suppose that we connect the common pin to a Voltage +V. On the pins we register the voltages as in picture 7.

## Step 4: The Signals

The “pin free” state means that the pin is not connected. If we connect this pin to a digital circuitry, its state is unknow. To have a LOW level, it’s enough to connect the PIN to Ground through a resistor (tipically 10k ohm) in order to not impact on the circuitry (pict. 8) . So the signals generated by this device are as in picture 9:

In the STANDBY phase, the Pulse pin is HIGH and the Activity pin is LOW; in the LOAD phase both of the pins are HIGH; in the RELEASE phase the Activity pin continue to be HIGH while the Pulse pin oscillates between V and 0 with as many pulses as the number selected by the user with the disk. So it’s enough to count the pulses to extract this number. In general the Activity pin is always LOW but not when the disk is rotating (manually in the LOAD phase or automatically in the RELEASE phase). Instread the Pulse pin is always HIGH but not when oscillates with X pulses. So you could understand the reason we called the pin in that way.

## Step 5: Arduino Integration

Let’s suppose we measure continuously the signals on the pin Pulse and the Pin Activity. We ca do by using an Arduino board and connecting the dialer disk as in the picture 10.

The device acts like 2 buttons that are pushed as described in the picture 11.

## Step 6: Measurements

With a loop block as in picture 12, in the two variables you can collect HIGH or LOW values as in the picture 13.

Obviusly the sampling period that is the duration of the loop, must be very short. So the instructions you put in the loop cycle must be simple and fast. The disk oscillates with pulse of 45msec. A simple Arduino cycle is about 10 msec. So we have many samples (the red lines) for each phase. The samples measured are shown below the signals line in the picture 13.

## Step 7: The Algorithm

As described in the previous paragraphs, in a continuous loop, the Arduino board reads the values of the pin connected to Pulse pin and Activity pin of the disk dialer (disk selector). The picture 14a shows the samples measured.

To count the pulses it’s enough to count the start of the PulseOn where the pulse signal goes from 1 to 0 and the activity signals remains on 1 (see red circle). In other words, we have to compare in each loop cycle the new read values to the old ones in order to catch the fall from HIGH to LOW of the pulse signal. To be faster, in the code we introduce 4 variables:

statusMergedNew = (pulseSignal << 1) + activitySignal in order to combine the 2 signals in just one

oldnew = statusMergedOld*4 + statusMergedNew

statusMergedOld to maintain the statusMergeNew of the previous cycle

The variable oldnew combine in a single number the read values of a cycle and those of the previous cycle. A sample code is the following

```void loop() {<br> pulseSignal    = digitalRead(PULSEPIN);
statusMerged   = (unsigned int) pulseSignal <<1;
statusMerged   = statusMerged + activitySignal;
oldnew = (unsigned int) statusMergedOld << 2;
oldnew = oldnew + statusMerged;
switch(oldnew) {
...
case 13:
numpulse++;
break;
case STARTSTANDBY:
//The cycle is terminated and the disk is in the STANDBY state
insertInBuffer(number);
break;
}
statusMergedOld=statusMerged;
}```

For example, if the user composes the number 2 on the selector, the graphs that represents the samples measured and the new combined values are shown in the picture 14b.

In synthesis:

• In the StandBy phase the OldNew sequence is 10’s –> we reset a counter X
• when the OldNew is 13 (red circle) –> we increase a counter X
• When the OldNew is 14, the pulses are terminated and so, the counter X expresses the entered/digitized cypher (in our case the number 2)

So, the occurrences of the number 13 between a value 10 and a value 14, represents the number digited. The pictures 14c shows that the sampling rate (the duration of the arduino loop) is much bigger than the duration of the dialer disk pulses.

## Step 8: A Practical Tutorial

Once described the theory, let’s go on with a pratical experiment.

A. Before all we need an old phone.

There are many models on Ebay but I bought 3 of them in little markets of old things:

I was fascinated by the mechanical aspect of the dialer disk. One of these is made in plastic material. Another one was made in metallic material. Very strong and well done. So I understood the difference in price of the old phones. It’s very easy to open the phone and isolate the disk dialer.

B. Then we need an Arduino

I used a NodeMCU as arduino and wifi connector. I bought the nodemcu on Amazon (geek) at about 6 euro.

The connections:

• the Voltage pin of the Disk selector to the 3.3V pin of the nodeMCU;
• the pulse pin and the activity pin to the 12th and 14th pin of the nodemcu

• #define PULSEPIN 12
• #define ACTIVITYPIN 14
• A resistor of 10kohom from each of the 2 pins to the nodemcu ground

C. The Box

I used the box of an iphone to create the prototype (see the photos). It was a very nice part of the project. (See the photos in picture 15)

D. The program

To program it, I used the arduino IDE. There are many guide on Internet about how use the nodemcu and the arduino Ide, so I will not spend time for this. The program is here.

The most relevant code block is the loop: we read the volts at the pulse and activity pin; we combine these values and with the ones of the old loop and create an additional variable. It’s enough to control the value of this variable with the instruction switch(oldnew).

```void loop() {<br> pulseSignal = digitalRead(PULSEPIN);
statusMerged = (unsigned int) pulseSignal <<1;
statusMerged = statusMerged + activitySignal;
oldnew = (unsigned int) statusMergedOld << 2;
oldnew = oldnew + statusMerged;
switch(oldnew) {
case CONTINUESTANDBY: counter++;
break;
case STARTCHARGE:
Serial.println("Dial disk in action: reset cycles counter");
counter=1;
// turn LED on:
digitalWrite(LEDPIN, HIGH);
number=0;
break;
case CONTINUECHARGEORPULSEOFF:
counter++;
break;
case STARTPULSEON:
Serial.println("Starting pulse at cycle " + String(counter) + " and reset counter");
counter=1;
number++;
break;
case CONTINUEPULSEON:
counter++;
break;
case STARTPULSEOFF:
Serial.println("Stop pulse at cycle " + String(counter) + " and reset counter");
counter=1;
break;
case STARTSTANDBY:
Serial.println("Returned in standby at cycle " + String(counter) + "steps");
Serial.println("NUMBER FOUND: " + String(number));
if ((number >0) and (number <11)) {
if (number==10) number=0;
insertInBuffer(number);
Serial.print("Stored number in the buffer:");
Serial.println(smsbuffer);
}
counter=1;
// turn LED off:
digitalWrite(LEDPIN, LOW);
break;
default:
counter++;
break;
}
statusMergedOld=statusMerged;
}```

The funcion insertInBuffer, add the number into a buffer. As the length reaches the value 10, then is invoked a function that send an sms to the number sequence (that is equal to the number typed).

```void insertInBuffer(int number){<br> unsigned long now = millis();
if ((now-lastInsertTime) > 6000) {
Serial.println("Resetting old buffer not used from " + String(now-lastInsertTime) + " millisecondi");
resetBuffer();
}
if (len<10) {
smsbuffer[len]=number+48;
len++;
lastInsertTime=now;
Serial.print("NEW BUFFER:");
Serial.println(smsbuffer);
}
if (len==10){
inviaSmsByRacEngineService(smsbuffer);
resetBuffer();
}
}```

To send an SMS I uses the service Nexmo (I thank a lot Nexxmo for letting me to perform many tests without paying nothing, but a suffix [Nexmo] in the sms text).

D. Enhancements

You could use the disk dialer as a nice gadget or as a keypad for an access control system. Nice next step is to start a phone call and add to the prototype a microphone and a speaker. Who knows when! Do you want to try? Let me know

## Recommendations

• ### Internet of Things Class

21,527 Enrolled

## 2 Discussions

Great explanations in a great Instructable. Excellent work!

That's a neat setup :)