How To Ring A Telephone

People who read my telephone intercom article often ask what's so hard about ringing a telephone bell. The trouble is that you need AC at 20Hz and 40-90VRMS. That's not exactly the sort of AC that's easy to generate. If you do it at low voltage, you need a special transformer to transform it up -- a regular power transformer is no good at 20Hz -- and if you do it at high voltage, you need dangerous supply voltages and high-voltage components.

Someone wrote me an email asking me the age-old question: How do you make a telephone ring on a theatre stage? Without the benefit of a real phone jack, or a small PBX system or suchlike that is. I thought about this. What's the most easily scrounged device that can put out over 40VRMS at 20Hz? A stereo amplifier! The old 125W/channel one that I have has +/- 50V supply voltage inside, so it can drive a 200V peak-peak or 70VRMS AC signal with the outputs bridged.

Good so far. What is the most easily scrounged signal generator that can emit a 20Hz signal, preferably sinusoidal? Answer: A CD player. So I offered to make the theatre people a CD. With Linux this is easily done. First to generate the file of raw audio samples with this program:

#include <math.h> #include <stdio.h> typedef struct { short left; short right; } sample; main() { sample s; double y; int ns = 11; // make room for initial 44 byte .WAV header int i; int cycles = 740; while(cycles--) { s.left = s.right = 0; while(ns--) fwrite(&s,sizeof(sample),1,stdout); ns = 4*44100; // 4-second pauses between rings for(i=0;i<88200;i++) { // 20Hz = 44100/20 samples per cycle y = sin((float)i/2205*2*M_PI); s.left = (int) (y*32767); s.right = -s.left; fwrite(&s,sizeof(sample),1,stdout); } } } Run this and direct the output to a file. It will be a CD-length file with alternating 2-second bursts of 20Hz sinewave and 4-second silence intervals. To make it palatable to a CD burning program, I use my handy dandy "wavify" utility to overwrite the first 44 bytes with a .wav header.

#include <stdio.h> typedef unsigned long dword; typedef unsigned short word; struct WAVEheader { char ckID[4]; /* chunk id 'RIFF' */ dword ckSize; /* chunk size */ char wave_ckID[4]; /* wave chunk id 'WAVE' */ char fmt_ckID[4]; /* format chunk id 'fmt ' */ dword fmt_ckSize; /* format chunk size */ word formatTag; /* format tag currently pcm */ word nChannels; /* number of channels */ dword nSamplesPerSec; /* sample rate in hz */ dword nAvgBytesPerSec; /* average bytes per second */ word nBlockAlign; /* number of bytes per sample */ word nBitsPerSample; /* number of bits in a sample */ char data_ckID[4]; /* data chunk id 'data' */ dword data_ckSize; /* length of data chunk */ }; main(int argc,char **argv) { FILE *fd; int length; struct WAVEheader w; if(argc!=2) { fprintf(stderr,"Syntax: %s rawfile\n",argv[0]); exit(999); } fd = fopen(argv[1],"r+"); if(!fd) { fprintf(stderr,"Could not open %s for modification\n",argv[1]); exit(999); } fseek(fd,0,SEEK_END); length = ftell(fd); printf("File is %d bytes long.\n",length); w.ckID[0] = 'R'; w.ckID[1] = 'I'; w.ckID[2] = 'F'; w.ckID[3] = 'F'; w.wave_ckID[0] = 'W'; w.wave_ckID[1] = 'A'; w.wave_ckID[2] = 'V'; w.wave_ckID[3] = 'E'; w.fmt_ckID[0] = 'f'; w.fmt_ckID[1] = 'm'; w.fmt_ckID[2] = 't'; w.fmt_ckID[3] = ' '; w.data_ckID[0] = 'd'; w.data_ckID[1] = 'a'; w.data_ckID[2] = 't'; w.data_ckID[3] = 'a'; w.fmt_ckSize = 0x10; w.formatTag = 1; w.nChannels = 2; w.nSamplesPerSec = 44100; w.nAvgBytesPerSec = 4 * 44100; w.nBlockAlign = 4; w.nBitsPerSample = 16; w.ckSize = length - 8; w.data_ckSize = length - 0x2c; printf("Overwriting first %d bytes of it with .wav header\n",sizeof(w)); fseek(fd,0,SEEK_SET); length = fwrite(&w,1,sizeof(w),fd); if(length!=sizeof(w)) { fprintf(stderr,"Error writing to file\n"); exit(999); } fclose(fd); } Now we just burn the .wav file onto an audio CD (or if a computer is handy anyway, just play it). Pipe the output into a stereo amplifier. Connect the phone across the output terminals bridged, that is across the two red terminals (which are driven out of phase). Crank it. If the receiver is reasonably powerful the phone should ring. I have a 50W/channel receiver here by my computer, and it rings the phone at about 9 on the volume control.

It is essential to have about 1K of resistance in the loop for current limiting so the phone earpiece isn't blown to bits if the phone is picked up. See here for the instruction sheet that I drew up for the theatre people.

You can download the programs here.

Back to my projects page