Cockscomb (Tygerhoek) Repeater Upgrade 

The "Cockscomb" Repeater is undergoing major rework to add two UHF links, one UHF APRS digipeater and a WiFi base station to possibly serve the isolated community that has hosted this repeater for so many years.

The controller has been developed from scratch, thanks to the pioneering development done by Allan, ZS2R


New Controller Schematic:



(Compiled by ZS2R)



This project was born out of the need to replace existing CMOS logic used, with ageing 24 volt Storno equipment, on the East Cape Repeater Network.  This controller is PIC  based and will be more versatile and can be updated and reprogrammed as the need arises. A facility needed in the changing technological environment. The need was highlighted by Chris Scarr,ZS2AAW, and implemented by Allan Whitehead, ZS2R. Chris provided all the details required of the controller and most have been accommodated. His many years of experience with repeaters has ensured a good working system - the best in South Africa.



The unit has been based on the PIC 16F685 microcontroller and the MC145436 DTMF receiver.  Remote communication with the unit is by DTMF code (full 16 character code). Responses from the unit are by Morse Code, alarm tones and other tones.  The unit has the following inputs on one plug,  that doubles as a serial programming port for the PIC :- door alarm, mains alarm, analogue port, Vcc and gnd. Removing this plug and plugging in the in circuit serial programmer allows the PIC to be reprogrammed in position with all other peripherals attached.


In addition the following are provided for:- an audio output, a PTT controller and  a busy line monitor. There are 6 control channels that can be interrogated and switched on/off remotely. An analogue to digital converter is also available as a 0 to 30 voltmeter or as a remote thermometer. On interrogation the unit will send a CW message indicating the potential difference in volts, to the nearest 0.2 volts or the temperature in degrees Celcius.


Each control channel and each alarm port can be simply programmed to have a five character identity (ID) code. These codes cannot be remotely changed. A link needs to be inserted on the board to facilitate code programming. Should the board lose power, the current states of all control channels and alarms are retained in the EEPROM and will be restored on power up. The channels or alarms can be remotely locked on or off by the system manager using the unique code programmed at initialisation.


If more than 6 control channels are required another unit can be placed in parallel. Each channel would have its own ID code.


All software has been written in assembler and the author has attempted to keep it simple, so that others might later easily modify the code.

The full program is on the accompanying  CD as ďrepeater controllerV2.asm"

No attempt has been made to minimize the program memory used so  the program contains a lot of simple routines repeated for each channel.


Of special note to any person wishing to modify code is the fact that the 16F685 has 4k program memory, which is divided into two pages. Whenever a page is crossed the necessary page bits must be set or cleared. I used the" pagesel"  instruction in MPLABASM to do the necessary.


The unit's six control channels can be remotely controlled by DTMF signalling. Each channel has a unique five character code. By sending the code followed by a * the channel can be switched on, while the code followed by a # will switch the channel off. By sending the code only, the status of the channel will be sent back by the unit. One long beep is sent to indicate the channel is switched on and a number of short beeps to indicate it is off. This convention is used through out.


The door alarm latches on when pin 19 goes low, if positive logic is set or when pin 19 goes high if negative logic is set. The alarm will sound as soon as possible and again every 20 minutes. The state of the busy line is ignored. The alarm sound will be an emergency fire engine alarm  followed by a CW message of the alarm's ID code. The status of the alarm can be checked  at any stage by sending the alarm's ID code only. Alarm sounding can be turned on/off by sending the code plus * to turn on or # to turn off. Software latches the alarm. The latch can only be removed by switching the alarm off. The alarm will latch but not sound if it is turned off. Interrogation of the alarm, by sending the ID code only, will reveal whether it has latched on or not since having been turned off. To remove the latch the alarm must be turned off (even if it is off !) or the unit must be reset.


The analogue port is used as a 0 to 30 voltmeter. The potential on the pin must be between 0 and 5 V, so the external circuit must provide the necessary attenuation, low pass filter and calibration facilities. When the temperature mode is selected the potential on the pin must again be between 0 and 5 V and the unit will respond with a temperature value between 0ļC and 50ļC. The port has a unique programmable five digit code. If this code is sent the unit will respond with a CW message indicating the potential difference in volts followed by a V, or the temperature in C as programmed during setup.  The * and # characters after the code will be ignored in this case.

The mains alarm is sounded when pin 18 is pulled low (or high for negative logic) and again after 20 minutes, should the condition prevail. Software does not latch this alarm. Should pin18 go high (low for negative logic) and low (high for negative logic) again the alarm will resound immediately. The alarm can be turned off by sending its ID code plus # and on by sending it's code plus *. Since the alarm will sound every 20 minutes the status  can be interrogated by sending the DTMF ID code only, at any time. The alarm sound will be bee - baa repeated 5 times followed by a CW message of the alarm's status and id code. If the alarm is turned on and the mains is re-established a CW message "mains onĒ & alarm's ID will be sent.


The system manager can lock or unlock any port or alarm by sending his programmable 4 character code and  the port or alarm reference number as the fifth character and a * to lock or # to unlock the port or alarm. Once a port or alarm is locked it cannot be switched by normal methods. To revert to normal operation it must be unlocked.


The busy line is checked (and debounced)  before every  transmission except for the alarms. If the line is low the unit will wait a maximum of 2.5 minutes for the line to go high. If the busy line is low for longer than 2.5 minutes the transmission will be abandoned. In the case of an interrogation of a channel while the busy line is low (in TX) the controller will wait for 1.25 minutes then send a CW message "PSE   QRT"  (please stop transmitting)  wait  until the busy line goes high, then send the status report. Should the busy line remain low for a further 1.25 minutes, a status message will be sent, regardless of the busy line status. The unit will respond to the first DTMF signal sent (e.g. switch on/off or interrogate)  immediately,  but to no others during this waiting period of maximum length 2.5 minutes.


For all transmissions the PTT is set then a delay of one second is applied before the transmission begins.


The only way to reset the device is to power down and power up again.



PROGRAMMING  (or initiallising)


The  logic levels for the ports are as follows:-

When any of the ports are switched on the corresponding output will go high. This is called positive logic. If an opposite level is required on any of the ports then the logic must be set to negative as indicated below (# after the 5 ID characters).


The logic levels for the alarms are as follows:-

The alarms are normally triggered when the appropriate pin goes low. If it is required that the alarm trigger when the pin goes high, negative logic must be set on that alarm as indicated below (# after the 5 id characters).



When initially programmed, the ports and alarms will have the following codes and reference numbers.


PORT                         REFERENCE  NUMBER                DTMF  CODE      

1                                  1                                                          10001

2                                  2                                                          20002

3                                  3                                                          30003

4                                  4                                                          40004

5                                  5                                                          50005

6                                  6                                                          60006

door  alarm                7                                                          70007

analogue                    8                                                          80008

mains alarm               9                                                          90009

system manager       0                                                          0000   only 4 zero's


The reference numbers are embedded in code and cannot be changed except by changing the device's code.      


To program a new code for a port, the steps 1 to 7 must be followed precisely.


(1) set the link on the circuit board to pull  RC7 (pin 9)  low.


(2) enter the  port reference number (0  to  9)  via DTMF. A successful and valid entry  will  cause the channel LED  of the appropriate port to flash at freq. 2 Hz. for 3 seconds. In the case of the door alarm LEDís for channel 1&2 will flash together. For the analogue port LEDís 3&4 will flash together, for the mains alarm LEDís 5&6 will flash and for the system manager all six LEDís will flash .


(3) wait for the flashing to stop.


(4) Now enter the new 5 character code for the port or alarm, followed by a # if negative logic on this port or alarm is required. A  4 character code is entered  for the system manager. Any of the 16 DTMF characters may be used. A successful and valid entry will cause the appropriate LEDís to flash continuously. In the case of the analogue port, enter the new 5 character code followed by a # if temperature in degrees Celcius is to be sent , else a voltmeter reading in volts will be sent by default.


(5) remove the link on the circuit  board once the  port LEDís start flashing. The LED's will stop flashing when the link is removed.


(6) test the new code by setting the port on  and off.


(7) set the port, channel or alarm on or off as required.


No channels, ports or alarms must be given the same ID code.


During the initial programming it might be best to unplug the ports 1 to 6 as they would be pulsed when the LEDís flash.


There is a jumper that can be removed to turn the LED's off



Special Versions

Cockscomb Controller.


 The mains alarm has been changed in the following way.

1) An A to D converter has been configured on the alarm pin, pin 18.


2) Software monitors the voltage and sends an alarm and message, "battery low", when the voltage drops below 2.04V. If the voltage rises above 2.3V the alarm and message is cancelled. If the voltage drops below 1.94V an alarm and message, "load disconnect imminent", is sent The alarm and message will be cleared when the voltage rises above 2.3V. Should the voltage drop below 1.9V all six control channels will be disconnected,  due consideration being made for each channel that might have been set for negative logic. If a channel is disconnected, it will remain so.  A reconnect is made when the voltage rises above 2.3V and will restore the conditions prevailing before the disconnect.


The alarm will resound after 20 minutes and send a message indicating the voltage level at that time. The messages "battery low, "load disconnect imminent" or no message if the voltage is between 2.04V and 2.3V at that time.


The alarm can be interrogated at any time and messages as above will be sent.


3) If the alarm is turned off, ID code #, software will still operate as above but no messages will be sent.


4) If a load disconnect has occurred, individual channels can still be switched as usual.


5) A load disconnect will override any system manager locks, but the locks will be    reapplied when a reconnect occurs.


6) The analogue port, pin 3, must be programmed by the user to match the hardware connected to the pin. Voltage 0 - 28.3V or temperature 0 - 50 C. Due consideration for the connection to an A to D converter must be taken. The 5V supply is used as a reference and should be as stable as possible. Noise on the input pin should be considered. The signal source must have an internal impedance less than 10k. See note on A to D input.


Note on A to D  input



For the ADC to meet its specified accuracy, the charge holding capacitor (CHOLD) must be allowed to fully charge to the input channel voltage level. The source impedance (RS) and the internal sampling switch (RSS) impedance directly affect the time required to charge the capacitor CHOLD. The sampling switch (RSS) impedance varies over the device voltage (VDD), The maximum recommended impedance for analog sources is 10 kΩ. As the source impedance is decreased, the acquisition time may be decreased. After the analog input channel is selected (or changed), an A/D acquisition must be done before the conversion can be started. To calculate the minimum acquisition time, consult the PIC16F685 data sheet.