A one way repeater for ham radio - will my code work? :)

Hi folks

I designed a one way repeater for controlling a hf radio from a vhf radio in such a way that it can retransmit the sunday WIA news received on the VHF radio onto the HF band. This is a fairly simple concept, but I wanted to also have manual control of my radio when not rebroadcasting the WIA news (those of you unfamiliar, the WIA is the wireless institute of australia, a mob whom represent amateur (ham radio) operators in australia.

Heres what my project should do:

Interrupts on pins 2 and 3 are both looking for a low signal.
When either goes low, it closes a relay (activates the HF transmitter) and also lights the transmit LED.
If the cross band repeater switch is on, the transmitter rebroadcasts whatever is heard on the vhf radio PROVIDED its squelch is open (i.e. the signal has the correct tone and is strong enough to break through the squelch gate. The vhf radio has a handy connector that goes low or high (I forgot which way but either will be suitable for driving the opto). Once the transmission ceases and the squelch gate closes, the output from the radio stop, the optocoupler goes open and the transmit relay is de-energized, which in turn ceases transmission from the HF radio. This also lights an LED to indicate the cross band repeater is in operation.

Pin 2 is connected to a button and a switch (Press to talk and press to talk lock). When this pin is pulled low it keys the hf radio. When the button is released, it dekeys the radio.

One additional extra is the roger beep - also known as a courtesy tone (to let someone receiving my transmission know that I am finished talking and I am off the key, thus its their turn to key up and speak.). This tone will only sound if pin 10 is low (roger beep switch). it will also not sound when the cross band repeater is enabled.

when the roger beep sounds, it outputs a selectable frequency tone, with selectable duration on pin 8 before de-keying the transmitter. It also illuminates an LED to indicate the roger beep is being played.

Thats about it. its a fairly simple application, and I'll be using the ATMEGA328P IC's standalone - the arduino board is too dear and too big for these, when a prebootloaded chip will do and a handful of parts :slight_smile:

the code is in the attachment and VERY WELL documented, as such it exceeded the maximum post size of 9500 characters LOL! Will it work as intended?

Thanks for looking at my code folks :slight_smile:

Roger_Beep.ino (8.17 KB)

I would suggest that your use of LOW in that attachInterrupt command leaves one suceptable to problems that would be better met using the FALLING mode.

attachInterrupt(0, TX, LOW); // Transmit button on pin 2
 attachInterrupt(1, COS, LOW); // Carrier Squelch sense pin 3

Would be more reliable if:

attachInterrupt(0, TX, FALLING); // Transmit button on pin 2
  attachInterrupt(1, COS, FALLING); // Carrier Squelch sense pin 3

While I my not be able to articulate why this is better/more reliable, It's my believe it would be.

Good luck;
Lefty WA6TKD