=========================================================
                1A2 KSU BOARD - REV-G1 - 2 LINE / 4 EXTENSIONS / INTERLINK
                =========================================================
                erco@seriss.com - 1.0 (REV-G1) Jun 29 2019

                If you find problems in this document, contact: erco@seriss.com

                NOTE: In REV-G1, R28 (10K) and R27 (300/1W) component numbers were swapped,
                      so that now R28 is the 300/1W, and R27 is the 10K.

                      In REV-H, new onboard fuse added, removed JP1 and JP2

                      In REV-J, TIP32 (Q6), R25 and R27 were dropped, and replaced with
                                C8 and C9.


1.0 OVERVIEW OF THE 1A2 BOARD AND FEATURES
==========================================

    This board allows one to attach up to 4 separate 1A2 "6 button" phones
    for up to 2 separate telco lines, and provides these common 1A2 features
    with simple "straight wiring":

        o Up to 4 separate extensions

        o 2 telco lines, each with Hold feature

        o Lamps: o Blink when line is ringing
                 o On steady when in use
                 o Wink when on hold

        o Programmable ringing (ring generator must be supplied by user)

        o Optional 'buzz ringing' which uses buzzers instead of bells to ring phones
          (e.g. if no ring generator is present)

        o Intercom on line 5, with extension buzzing via Touch-Tone or Rotary

        o 2 boards can be linked with a 30 pin ribbon cable for 4 lines / 8 Extensions

        o In a power outage, phones can still be used to dial out

        o Handles remote hangups during hold (CPC signal from CO)

    The intercom line allows a caller to buzz any of the 4 extensions by
    dialing the extension number on either a Rotary or Touch-Tone dial pad.
    This signals the person at that extension to pick up the intercom to talk
    to the caller. Dialing "0" buzzes all extensions.

    The system is also expandable: with two boards, they can can be joined
    with a 30 pin ribbon cable to provide a total of 4 CO lines, and 8 extensions.
    Intercom is also expanded so that one can dial 1 through 8 to buzz any of 
    the 8 extensions, and "0" to buzz all 8.

2.0 (RESERVED)
==============

    This section intentionally left empty.

3.0 (RESERVED)
==============

    This section intentionally left empty.


4.0 ELECTRICAL DESCRIPTION
==========================

    This section describes the electrical design considerations.

    Refer to separate schematic and circuit board for actual circuit layout.

    4.0 Design Approach
    --------------------

    When desiging this 1A2 control circuit, I started with the circuits
    that interface with the telco line:

        o Detect ringing (for 1A2 lamps and ringers)
        o Detect if a line is in use (for 1A2 lamps and hold)
        o Remote hangup detection: "Calling Party Control" or CPC signals
        o Holding a call

    NOTE IN THE FOLLOWING:
    * Since the Line 1 circuit is exactly the same as Line 2's circuit,
    * to keep the circuit description simple, we focus on just one line,
    * Line 1's components and signal names.

    Let's start with the Detect signals first.

    LDA-110 "AC input" optocouplers are used for detecting both
    Ring Detect and Line Detect. These optocouplers have AC input LEDs
    and darlington transistors with an open collector output, which makes
    them perfect for this purpose.

        4.1.1 "Ring Detect": Detects Ringing
        ------------------------------------
        An optocoupler connected across Tip and Ring can be used to detect
        the presence of AC ring voltage. An R/C filter was used in earlier
        versions of the board to remove noise during zero crossing of the
        AC ring signal, but this hardware was removed in the PIC chip versions
        of the board, implementing the equivalent in the PIC firmware.

        As soon as a valid ring signal is detected, the firmware detects
        ringing and passes the ring generator's current to the 1A2 phones
        programmed for ringing via the SW2 diode matrix.

        4.1.2 "Line Detect": Detect Line Use
        ------------------------------------
        The telco's Tip and Ring wires are monitored for current flow via
        the Line Detect optocoupler, wired in series with the telco's "Ring" wire.
        When the extensions are all idle for the line, there is no current flow
        through Tip/Ring.

        When someone picks up the line, current flows through the extension's
        network hybrid/voice circuit, powering the earpiece and microphone.
        This current flow turns on the optocoupler, grounding its output,
        which signals the PIC's firmware the line is in use. 

        Or, if the line is on Hold because the Hold relay (K1) is energized,
        this shunts the Hold resistor (R1) across the line, keeping current
        flowing across Tip/Ring, keeping the Line Detect optocoupler engergized.

        When the line is idle, the optocoupler is OFF, and its open collector
        output is pulled high to +5V by one of the 5.6K resistors in RN1,
        causing the PIC chip to see the signal as logic 1 when the line
        is idle.

        When the line is in use or on Hold, the optocoupler is ON, and its
        output is pulled to ground, causing the PIC chip to see the signal
        as logic 0 when the line is in use.

        The PIC chip uses this signal to manage the extension lamps
        and the hold condition for the line.

        4.1.3 CPC Detection
        -------------------
        When the central office detects the remote caller hung up,
        it briefly opens the Tip/Ring circuit for about 1/2 a second.

        If this happens while a line is on Hold, the Line Detect circuit
        no longer sees loop current, causing the PIC chip to see no line
        current, and drops the call out of Hold, automatically freeing up
        the line for new calls.

        4.1.4 Holding A Call
        --------------------
        The CO detects a line is in use the same way we do; detecting
        current flow across Tip and Ring.

        To put a call "on hold", one only needs to shunt a low value
        resistor across Tip and Ring so that when the extension hangs
        up, the CO still sees current flowing through the resistor, 
        keeping the call active.

        Once on Hold, the KSU flashes the lamps on all extensions for 
        that line, holding a 60 ohm 1 watt resistor (R1) across the line
        via the energized Hold relay (K1).
        
        The description of how the Hold button is detected is described below.

    Next, the circuit design should consider 1A2 phone inputs and outputs.

    4.2 Phone Outputs
    -----------------
    The phones only have one "Output" signal to the KSU:

        4.2.1 The A Lead ("A Sense")
        ----------------------------
        A 1A2 phone's only output signal to the KSU is a simple switch closure
        for the A lead.

        When any extension's line button is down and the phone off hook,
        the A lead for that line will be shorted to ground. So for each line,
        the wires connected together would be:

            line #1: pins 27 (W-O) and 2 (O-W)
            Line #2: pins 30 (W-G) and 2 (O-W)
            Line #3: pins 33 (R-G) and 2 (O-W)
            Line #4: pins 36 (BK-BL) and 2 (O-W)
            Line #5: pins 39 (BK-BR) and 2 (O-W)

        Since the 25 pair 1A2 extension cables can be quite long (up to 1000 feet)
        and has the potential to pick up ring currents, line noise and various 
        other unwanted interference, we isolate the A lead from the PIC chip's
        input port with an optocoupler (IC5).

        When no extension has the line selected, the A Lead is an open circuit
        (floating). Since it's directly connected to the A1 optocoupler (IC5),
        the optocoupler is OFF. The optocoupler's open collector output connects
        directly to the PIC chip's RC5 ("L1 A SENSE") input, which when off is
        open (floating), and is pulled high to +5 by one of RN1's 5.6K resistors.
        The PIC firmware sees this condition as logic 1.

        When someone at an extension picks up the line, the A Lead is grounded.
        This turns on optocoupler A1, its darlington output goes to ground,
        causing the PIC chip to see this condition as logic 0.

        When someone puts a call on Hold or hangs up, the A Lead opens.
        To tell the difference between Hold or Hang Up, the PIC chip compares
        the A Lead and Line Detect inputs:
            
            * On Hold, when the user presses the Hold button down, the A Lead immediately
              opens first, while Tip and Ring continue to be connected to the phone's hybrid,
              keeping the Line Detect sensing current. In the short interval before the user
              releases the Hold button (causing the line buttons to release), the PIC chip
              needs to detect this condition and energize the Hold relay (K1) to shunt the Hold
              resistor across the line to put the call on Hold, so by the time the user releases
              the Hold button (causing the line button to release, disconnecting the phone's
              hybrid from continuing to draw current across Tip/Ring), the Hold resistor now
              keeps the line drawing current so the call doesn't drop.

            * On Hang Up, both A Lead and Line Detect optocouplers turn off simultaneously.
              The PIC sees both "A SENSE" and "LINE DETECT" in the idle condition, turns
              off the lamps for the line, and resets the line to being idle.

        So the A Lead sensing, in combination with Line Detect, is used to control 
        these conditions:

            1) Directing the Hold relay to be either on or off
            2) Directing 1A2 lamps to be on, off, or flash

    So that covers the phone's only output.

    4.3 Phone Inputs
    ----------------
    The phones have several inputs:

        * 4.3.1 - Lamp (Visual)
        * 4.3.2 - Bell (Audible)
        * 4.3.3 - Buzzer (Audible)

    The on board PIC chips control these signals to the phones by way of a ULN2803
    darlington transistor array to boost the PIC chip's output current. These signals
    control power transistors and relays to interface to these 1A2 devices:

        * An IRF9530 power transistor (Q1) drives the Line #1 lamps
        * The relay K3 drives bell ringing for Line #1
        * The TIP125 power transistors (Q7-Q10) drive the buzzers for the 4 extensions

    4.3.1 Lamps
    -----------

    The line lamps in 1A2 phones are all wired in parallel. A single IRF9530 transistor
    (Q1) controls the Line #1 lamp in all extensions, lighting them simultaneously to
    indicate if a line is in use, or flashes the lamp for incoming calls or calls on Hold.

    When the KSU wants to light the Line #1 lamps, the IRF9530 power transistor (Q1) is
    energized by control of the PIC firmware, providing a strong +12V signal to power
    the lamps.

    The PIC output RA0 ("L1 LAMP") drives a ULN2803 darlington transistor to actually
    turn on the IRF9530 transistor. When flashing is needed, the PIC firmware handles
    the timing of turning the transistor on and off.

    4.3.2 Bells
    -----------
    The bells are used for ringing phones when there's an incoming call on a line.

    The bell in each extension needs between 70 VAC and 105 VAC to ring. The AC frequency
    is usually 30Hz for a 1A2 systems, but can also be 20 Hz for a 'calmer' sounding ring.

    The bell ringing voltage and frequency is NOT supplied by the KSU circuit board; 
    this must be provided by an external "Ring Generator" (or "Frequency Generator")
    that the KSU circuit board simply switches as needed to ring the bells.

    When the PIC chip senses an incoming call on Line #1 via the Ring Detect optocoupler (IC1),
    it turns on the "L1 RING RLY" output, which by way of the ULN2803, turns on the coil of
    "L1 RING" relay (K3), which switches the ring generator's power out to the exensions
    programmed for ringing by SW1's diode matrix. A current limiting 300 ohm 1 watt resistor 
    (R27 in REV-G, R28 in REV-G1) is connected in series with the ring current (recommended
    for most ring generator configs).

    The PIC chip also energizes Q4 whenever ANY line is ringing, providing 12 volts to 
    power any low voltage ring generator devices (like the PowerDSINE or BlackMagick),
    so that these devices only receive power during ringing, and are off the rest of the time.
    This 12 volt output can also be used to drive an external relay to switch 115 VAC power
    for AC powering ring generators, such as the 118A, so that the device is only on 
    during ringing.

    4.3.2.1 Programmable Ringing
    ----------------------------
    Making "ringing programmable" was one of the design goals.

    Ringing for each extension is programmable by the SW1 diode
    matrix, allowing the installer to configure which extensions
    will ring for each of the two lines.

    1A2 phones have a separate wire pair just for the 70-105 VAC ringer
    (pins 20/45) and a separte pair for the 10 VAC buzzer (pins 17/42).

    Since we are in charge of ringing, the "ring detect" circuit needs
    to do at least two things:

         1) Flash the lamps for the line that's ringing, so the caller knows
            which line to answer

         2) Ring the appropriate extension phone's bells (or buzzers)

    The Bell System Practices (BSP's) recommends diodes be used to
    "program" ringing, so that different extensions can ring depending
    on which line is ringing.

    In our case, we provide a full diode network, and use DIP switches
    to control the 70-105 VAC ring signal. A similar arrangement is
    used to control which buzzers are used during ringing, such as if
    a ring generator is not present, but audible signaling is needed.


    4.1 GENERAL BOARD LAYOUT
    ------------------------

    The board is broken out into discrete sections, so that each can be
    separately populated and debugged easily.

    To access all feautures, 2 separate power supplies need to be provided:

        12 VDC - for board logic and phone lamps
        70-105 VAC / 30Hz - for phone ringing

    Components for unused sections can be left unpopulated if need be.
    Examples:

        LINE 2
        ------
        If a Line2 isn't needed, all components can be left out of the
        "LINE 2" section of the board:

             o The Hold relay
             o The two LDA110 optocouplers
             o The 160 ohm Hold resistor
             o The IRF9530 "L2 LAMPS" transistor (Q2) and related resistors R9 + R11
             o The "LINE 2 STATUS" led and resistor R10
             o The 4 telco line conditioning components R12, R13, C3, R14.

        90 VAC RINGING
        --------------
        90VAC ringing is optional, since "ringing" can also be provided
        by the buzzers using the BUZZ CALL section.

        If 90VAC ringing won't be used, all components can be left out
        of the "BELL CALL" section of the board, namely: the "90VAC
        RINGER POW" connector, 8 diodes and 8 position DIP switch.

        INTERCOM
        --------
        If intercom features aren't needed, all components can be
        left out of the "ICM VOICE BATT" and "INTERCOM DIALING" sections.

        BUZZERS
        -------
        If buzzers won't be used at all, either for intercom notifications
        or incoming calls ("BUZZ CALL"), then you can leave out:

            * All the TIP125's under "BUZZERS"
            * The ULN2803 (IC12)
            * The 10K resistor network  (RN2)
            * The four diodes D22-D25
            * The 10 LED bar graph (IC13)
            * The 8 position DIP switch (SW1)


### I YAM HERE ###