Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
rudizoon
Published © GPL3+

Partyline Telephone Ringer

Make a old-style telephone ring with ten party-line (Morse) codes plus the standard USA and New Zealand ringing cadences.

IntermediateShowcase (no instructions)585
Partyline Telephone Ringer

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
12 Key Numeric Keypad
Any keypad will work, you could even use individual buttons. I recommend a 12 button matrix keypad.
×1
12.6V CT, 7VA 500mA Centre Tapped - Type 2853 Transformer
×1
Jiffy Box - Black - 158 x 95 x 53mm
Or any box that will fit the parts will work.
×1
Arduino Compatible DC Voltage Regulator
This buck regulator ensures a steady Voltage of 5V to power the Nano. However, the Nano should be able to handle the 12V direct to VIN, which would mean that this part could be omitted.
×1
IRLZ33N N channel MOSFET
Or any other data N channel MOSFET that meets the specifications, such as the IRF3708. Just watch the pinout, I don't think they're all the same!
×2
220 Ohm 0.5 Watt Metal Film Resistors
×2
10k Ohm 0.5 Watt Metal Film Resistors
×2
100 Ohm 1 Watt Carbon Film Resistors
I used five in parallel to make 20 Ohms, it should be possible to reduce this value, check with an oscilloscope on the output and adjust to get 60V peak-to-peak.
×5
1N4007 1A 1000V Diode
×2
PC Boards Vero Type Strip - 95mm x 75mm
×1
12V DC 400mA Ultra-Slim Power Supply
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Circuit diagram

Circuit diagram showing all connections and components.

Veroboard layout

Be care that the MOSFET tabs don't touch!

Code

Arduino Nano Partyline Telephone Ringer

Arduino
I have used the KISS principle here and used only very basic instructions. This code can easily be "tidied up" with the use of further functions and arrays.
/* Partyline telephone ringer
  This will ring a telephone with various ring cadences
  which may include the standard UK and US rings as well
  as a number of partyline rings.
  The number of different cadences is controlled by
  push buttons - so the number depends on the number
  of buttons installed.
*/

// set pins for ringing output
  const int ringPin1 = 2;
  const int ringPin2 = 3;

// Set pin IDs for rows and columns for buttons
const int rowA = 4;
const int rowB = 5;
const int rowC = 6;
const int rowD = 7;
const int colA = 8;
const int colB = 9;
const int colC = 10;

// set pin for on-board LED for testing purposes
const int LED = 13;

// define variable for setting length of short ring
// long ring and NZ and US rings.  300mS should be about
// right for the short ring, and a long ring 900mS
// this number is the number of cycles, so at a frequency
// 20Hz, and a length of 300mS, there are 6 cycles
// and at 900mS, 18 cycles.
// At 20Hz, each cycle is 50mS
unsigned shortring = 6;
unsigned longring = 18;
unsigned shortpause = 200;
unsigned longpause = 2000;
unsigned NZring = 8;  // NZ ring is 400 mS
unsigned USring = 40;  // US ring is 2000mS
// define variable for setting frequency of ring
// e.g. for 20Hz, one cycle is 50mS, half cycle is 25mS
// this number is the length of one half cycle.
unsigned frequency = 25;
// declare variable used in subroutine
unsigned count = 1;


void setup() {
  
//  Serial.begin(9600);
//  Serial.println("Partyline ringer");
  
  pinMode(LED, OUTPUT);

  // setup pins for the ringing output
  pinMode(ringPin1, OUTPUT);
  pinMode(ringPin2, OUTPUT);

  // setup the pins for the buttons
  pinMode(rowA, OUTPUT);
  pinMode(rowB, OUTPUT);
  pinMode(rowC, OUTPUT);
  pinMode(rowD, OUTPUT);
  pinMode(colA, INPUT_PULLUP);
  pinMode(colB, INPUT_PULLUP);
  pinMode(colC, INPUT_PULLUP);

  //Set all output pins to LOW
  digitalWrite(ringPin1, LOW);
  digitalWrite(ringPin2, LOW);
  digitalWrite(rowA, HIGH);
  digitalWrite(rowB, HIGH);
  digitalWrite(rowC, HIGH);
  digitalWrite(rowD, HIGH);

  digitalWrite(LED, LOW); // set LED to off
}

void loop() {
  
  digitalWrite(rowA, LOW);

  // rowA, colA for A (.-) ring  
  if (digitalRead(colA) == LOW) {
    Ringing(shortring);
    delay(shortpause);
    Ringing(longring);
    delay(longpause);
  }

  // rowA colB for D (-..) ring
  if (digitalRead(colB) == LOW) {
    Ringing(longring);
    delay(shortpause);
    Ringing(shortring);
    delay(shortpause);
    Ringing(shortring);
    delay(longpause);
  }
  
  // rowA colC for J (.---) ring
  if (digitalRead(colC) == LOW) {
    Ringing(shortring);
    delay(shortpause);
    Ringing(longring);
    delay(shortpause);
    Ringing(longring);
    delay(shortpause);
    Ringing(longring);
    delay(longpause);
  }

  digitalWrite(rowA, HIGH);
  digitalWrite(rowB, LOW);

  // rowB colA for Partyline K (-.-) ring
  if (digitalRead(colA) == LOW) {
    Ringing(longring);
    delay(shortpause);
    Ringing(shortring);
    delay(shortpause);
    Ringing(longring);
    delay(longpause);
  }

  // rowB colB for Partyline M (--) ring
  if (digitalRead(colB) == LOW) {
    Ringing(longring);
    delay(shortpause);
    Ringing(longring);
    delay(longpause);
  }

  // row B colC for R (.-.) ring
  if (digitalRead(colC) == LOW) {
    Ringing(shortring);
    delay(shortpause);
    Ringing(longring);
    delay(shortpause);
    Ringing(shortring);
    delay(longpause);
  }

  digitalWrite(rowB, HIGH);
  digitalWrite(rowC, LOW);

  // row C col A for S (...) ring
  if (digitalRead(colA) == LOW) {
    Ringing(shortring);
    delay(shortpause);
    Ringing(shortring);
    delay(shortpause);
    Ringing(shortring);
    delay(longpause);
  }
  
  // row C col B for U (..-) ring
  if (digitalRead(colB) == LOW) {
    Ringing(shortring);
    delay(shortpause);
    Ringing(shortring);
    delay(shortpause);
    Ringing(longring);
    delay(longpause);
  }

  // row C col C for W (.--) ring
  if (digitalRead(colC) == LOW) {
    Ringing(shortring);
    delay(shortpause);
    Ringing(longring);
    delay(shortpause);
    Ringing(longring);
    delay(longpause);
  }

  digitalWrite(rowC, HIGH);
  digitalWrite(rowD, LOW);

  // row D col A for US ring
  if (digitalRead(colA) == LOW) {
    Ringing(USring);
    delay(longpause); // Since pause between rings for US is 4000mS, repeat this
    delay(longpause);
  }
  
  // row D col B for X (-..-) ring
  if (digitalRead(colB) == LOW) {
    Ringing(longring);
    delay(shortpause);
    Ringing(shortring);
    delay(shortpause);
    Ringing(shortring);
    delay(shortpause);
    Ringing(longring);
    delay(longpause);
  }
  
  // row D col C for NZ ring
  if (digitalRead(colC) == LOW) {
    Ringing(NZring);
    delay(shortpause);
    Ringing(NZring);
    delay(longpause);
  }
  
  digitalWrite(rowD, HIGH);
}

void Ringing(int length) {
  count = 0;
  while (count < length) {
    digitalWrite(LED, HIGH);   // turn the LED on
    digitalWrite(ringPin1, LOW);
    digitalWrite(ringPin2, HIGH);
    delay(frequency);                 
    digitalWrite(LED, LOW);    // turn the LED off
    digitalWrite(ringPin2, LOW);
    digitalWrite(ringPin1, HIGH);
    delay(frequency);
    count++;
  }
  digitalWrite(ringPin1, LOW); // ensure both pins are LOW at end of ringing cycle
//  Serial.println("finished ringing");
}

Credits

rudizoon
0 projects • 0 followers

Comments