PRO001 - Rotary cellphone


Reading the Rotary dial

The phone

Intro

I recently bought an old RTT 72 phone and I wanted to give it a second life.
The first idea was to only reuse the horn of the phone such that I would be able to connect my cellphone through the jack connection. This soon became too little of a challange so I wanted to make the phone a full stand alone unit that can be used to make and receive calls.
For this I shall request the help on an Arduino.

Rotary dial front
Fig.1 - Front of the rotary dial mechanism.

The rotary dial

No rotary encoder was needed to read in the signal, as the original mechanism could be used. Two digital inputs are needed to cature the numbers.
One changes state the entire time the dial is turning and the other one gives a certain amount of pulses, equal to the number dialed.
So, two digital inputs are reserved on the Arduino. The figure below shows the two parts of the mechanism registering the dialed numbers.

Rotary dial rear
Fig.2 - Rear of the rotary dial mechanism showing the two components.

Two resistors and a connection to the ground are needed to correctly measure the signals. At first I tried hardware interrupts to register the pulses, but the result whas not as expected. More detailed investigation with the 'Serial Plotter' of the Arduino IDE at a high CAN rate showed that the signals sometimes switched states when not expected, So I moved to using normal digital inpus and compared two values measured consecutively with a 10 ms delay.

Below an extract of the Arduino code I used for this part:

 
int digitalPin_cnt = 6;          // Pin 6 is input connected to the number pulses of rotary dial
int digitalPin_reset = 7;        // Pin 7 is input connected to the single pulse showing rotary dial usage

float pulscount = 0;             // measured state of the 'digitalPin_cnt' signal
float pulscount_prev = 0;        // previous state of the 'digitalPin_cnt' signal
float reset = 0;                 // measured state of the 'digitalPin_reset' signal
float reset_prev = 0;            // previous state of the 'digitalPin_reset' signal
int count = 0;                   // variable counting the amount of pulses received when dialing a number
String PHnumber = "";            // string capturing the full phone number dialed
unsigned long timer;

void setup() {
  // start serial communication
  Serial.begin(9600);
  // set pin modes
  pinMode(digitalPin_cnt, INPUT);
  pinMode(digitalPin_reset, INPUT);
  // initiate the timer
  timer = micros();
}
void loop() {
  delay(10); // to filter out erractic signals
  pulscount = digitalRead(digitalPin_cnt);
  reset = digitalRead(digitalPin_reset);
// detect the pulses of the number dialed if the rotary dial is in motion
  if (pulscount == 0 && pulscount_prev == 1 && reset == 1) {
    count = count + 1;
    timer = micros();
  }
// If the rotary dial is no longer in motion the number dialed is captured
  if ( reset == 0 && reset_prev == 1) {
    PHnumber.concat(String(count % 10)); // a modulo operator because the '0' is 11 pulses
    count = 0;
    Serial.println(PHnumber);
    timer = micros();
  }
//If 'PHnumber' is not empty and nothing happens within 3s you capture the fully dialed number
  if (micros() - timer >= 3000000 && PHnumber != ""){
    Serial.println(PHnumber);
    PHnumber = "";
    timer = micros();
  }
  pulscount_prev = pulscount;
  reset_prev = reset;
}
         

Project overview:

Reading the rotary dialJune 28th 2020
Ringing the bellJuly 12th 2020
Linking to the cell moduleAugust 1st 2020