Arduino Whole House Telephone Intercom
Most behavioral requirements have been discussed in previous sections. A brief description of key parameters and code segments should help you understand the big picture quickly.
Interrupt Service Routine: Routine ISR controls the time-critical aspects of manipulating the power supply to create the distinctive ringing cadence. On each pass, it loads its own overflow timer to trigger an interrupt for the next required action. The ringing cadence is defined by array ringPattern. Three rings of 1 second duration, separated by 1 second silences and a 3 second silence to complete the pattern, is the cadence I chose. Based on this and ringFrequency, the routine toggles the power supply at the proper rate to generate ringing pulses, and sets it at 90 V during silence periods. It also monitors loop current synchronously with ringing pulses to detect an off hook event and terminate ringing. When not ringing, it checks ringingStatus every 10 mS to see if ringing should start. The main loop initiates ringing by setting ringingStatus.
Main Loop The first part of the loop measures loop current and line voltages to determine whether local phones are on or off hook. Subsequent logic determines whether hook status has changed since last time through the loop, records the time of hook status changes as necessary to detect hook flashes, and initiates operating modes (Normal, Intercom, Intercom/Hold) as required.
Serial Report: If variable serialReport is set, data describing hook and other status changes is written to the serial port. This is useful for debugging and, as near as I can tell, causes no problems if the USB port is disconnected and the data ignored. The reporting feature is therefore active by default.
To help test and calibrate your newly built circuit, I recommend ATI_Test10.txt.
I hope you find this intercom a useful and practical addition to your home. If you make design improvements, or have suggestions, I would be happy to hear about them. I will plan to publish them (with credits, of course) for the benefit of those who come later.