So I have two programs that are meant to talk to radio's via GPIO pins but need them to talk to each other via GPIO


Program 1 PTT = 12 COS = 16

Program 2 PTT = 16 COS = 12

So basicly when Program 1 keys up its sets Pin 12 high then Program 2 see's pin 12 is high and triggers it.

I get an error saying the device is busy tho when I do it like this.

Any other ideas as they both talk on GPIO pins

Thanks Sonic

  • 1
    I am confused. What do you mean by (1) talk to radio? (2) PTT = 12 COC = 16? (3) error msg saying device busy? It is not clear that if you are using TWO Rpi's talking to each other, or ONE Rpi running a loop with two functions, or ONE Rpi running two multiprocessing processes? – tlfong01 May 29 at 1:49
  • 1) I said they are meant to talk to radios eg GPIO 12 is hooked up to PTT of radio 2) this is an example of the GPIO pins being uses for PTT and COS/SQUELCH 3) Im using 1 pi.. with 2 programs that listen to GPIO and also Write to GPIO When a signal is sent from the radio to the PI the SQL is set HIGH When a signal is sent from the PI to the Radio the PTT is set HIGH to key the radio up. In my situation. See Below Example When Program 1 send Audio it sets GPIO 16 High then I need Program to see that GPIO 16 is high and receive the audio.. Does that make sense now? – Sonic May 29 at 2:08
  • Oh my goodness. So you are talking about amateur radio things! I embarrassingly confess that once upon a time I studied an electronics engineering diploma, and afterwards earned a living doing electronic technician work. I also passed the UK City and Guild Telecommunication Cert, registered at the local telecom authority for a license to play amateur radio. I got a call sign, and at the same day I excitedly went to the shops to get some cheapy gear to proudly start high class radio work, talked to guys all over the planet, and even aliens in other galaxy, / to continue, ... – tlfong01 May 29 at 2:44
  • But then I sadly found even the cheapest ham radio gear in the shops were too expensive for a poor technician like me . In the three years working as a technician, I lived in a youth hostel, 12 guys in a room with six double beds, and only one "public" telephone for 60 residents. I other words, I only had a bed and half under bed space and a 1.5ft by 3 ft to hold my dream ham gear, even if I could afford it. I went to window shopping a couple of times, but still not fulfilled my dream. Fast forward a few decades, I am still a ham radio guy, with a license, no experience. / to continue,... – tlfong01 May 29 at 3:01
  • I never heard of COS/SQUELCH, and even forgot what is PTT! :) But I am interested to catch up. I will now google and wiki a bit, and hopefully suggest something later. – tlfong01 May 29 at 3:04


  1. I have a python program running a loop of two functions "talking" to each other.

  2. Let us call the two functions Function 1 and Function 2, and they are doing similar things as briefly described below.

  3. Function 1 takes care of two Rpi GPIO pins, input pin GPIO In1 is connected (through a 4k7 resistor) to output pin GPIO pin Out2, which is taken care of by Function 2.

  4. Similarly, GPIO In2 is connected to GPIO Out1.

  5. For each loop Function 1 checks if GPIO pin In1 is low, if yes, Function 1 will make GPIO pin Out1 low, so that Function 2 will detect this next loop, ...


I googled a bit and found the question is easier than I thought. It is all about PTT and COS pins. Actually the OP is not talking about the ideas, but the PTT and COS pins, as illustrated below.

ham radio

I found one thing confusing is the the COS pin shares with PL, perhaps that causes confusion.

The python program

Actually I think what the OP needs is the simple program I already briefly described in the question.

Warning to OP

The PTT and COS pins may carry 5V TTL logic signals. Rpi GPIO pins runs on 3V3 logic and are not 5V logic signal level tolerant.

In other words, Rpi might be damaged if the transceiver's PTT/COS pins are directly connected to Rpi GPIO.

Update 2019may30hkt1209

On the other hand, 5V Arduino Uno should have no problems, because they are designed to entertain 5V logical level signals. For Rpi the usual get around is to use a logical level converter to step down the ham radio trasnsceiver's possibly 5V signals to 3V3 signals which are now compatible with Rpi. You can google AdaFruit or SparkFun for their very good newbie friendly logical level converter tutorials.

Perhaps I should get a cheapy Motorola M120 from eBay and PTT radio him to clarify! :)

/ to continue, ...


Amateur Radio Future - Network Radio - Zello PTT Apps? 5,452 views

Amateur Radio Guideto Digital Mobile Radio (DMR)

The most important thing about the hobby of Amateur Radio is to enjoy learning new technologies, experimentation, meeting new friends, public service, and to leave the hobby better than when you entered.

The spark gap transmitter gave way to frequency selective transmitters and receivers using CW; CW gave way to AM; AM was largely pushed aside by SSB; FM became the mode of choice for most on the VHF and shorter wavelengths.

The digital ham started at the same humble beginning, CW over spark gap. Over the years, the digital ham’s interests may have included CW, RTTY, then Packet (AX.25), and a whole host of mainstream and experimental digital modes, and even WiFi (802.11). With the advent of faster computer processors and vocoder technology, analog voice moved into the digital age, both on the HF bands and on VHF and higher bands. Vocoder technology merged with packet technology and D-Star took the VHF and UHF bands by storm with the help of a single vendor and the JARL (Japan Amateur Radio League). Yaesu has enter the arena with their proprietary System Fusion.

So What's The COR or COS? - Ric Sohl KK5RIC

The Carrier Operated Switch (COS) used to be called COR.... Short for Carrier Operated Relay.

This is going back to the early days of repeaters in which all the repeaters had tubes in them, and all circuit switching was done by relays. Nowadays most of the repeaters are solid state, except for a few which have tubes in the final amplifier, so now we call it COS or "Channel Busy" or ...

So you ask how does it work and what's the purpose, and where can I find this COS on a receiver? The function of the carrier operated switch is to tell the repeater controller, if the repeater has one, that the receiver squelch is open, and that there is a signal there.

If the controller is set up for Carrier Squelch (CSQ) it then turns on and off the repeater transmitter. If the repeater does not have a controller, the COS simply does the function of turning on and off the transmitter.

The COS signal can be either a set of relay contacts or a voltage that swings high or low to give either a + voltage or ground with the receiver active, (noise or a signal.)

On some receivers the COS uses a relay and that has a dry contact to ground, and you won't see a swinging voltage, a 5k or so pullup resistor connected 12 volts, makes the COS voltage swing.

The squelch circuit rectifies the hissing noise, its the noise that we hear when the squelch is open and no signal is present on the fm receiver. Sometimes this noise is amplified and is applied to diodes to converted to a dc voltage, some other times to a voltage doubler to get a greater level of swinging voltage. That voltage is compared to the squelch pot and if it's greater the squelch stays closed, if it's less the squelch opens. There's another way to get a COS voltage from a receiver, that is with a VOX circuit on the receiver audio output, it does not work properly on a repeater, (if someone has a full quieting signal and there is a pause in the speech the VOX closes) so I won't go in detail with it here.

Some AM receivers have COS's also.. not just the FM ones, the major difference between the two are the FM receivers the COS and squelch works much better and is harder to be fooled by noise....by the way, airports with towers use AM receivers with COS. The COS squelch circuit has been used in repeater receivers for years, long before the tone squelch came to be very popular. Manufactures paid special attention to the squelch circuits in their receivers, Motorola even made a special IC for their MICOR series radios.

/ to continue, ...


Recommended Rpi GPIO pins to use to interface ham radio transceiver

Some Rpi GPIO pins have alternative functions such as I2c, UART, and they might have special pull up/down resistors. So it is usually recommended to use the "pure" GPIO pins without alternative functions, just to make very sure. The GPIO pins with special alternative function is illustrated below. For the radio talking program, I would recommend GPIO GEN_0 to GEN_3.

gpio pin out

Ham Radio Setup

Ham radio setup - Wikipedia

Squelch - Wikipedia

In telecommunications, squelch is a circuit function that acts to suppress the audio (or video) output of a receiver in the absence of a sufficiently strong desired input signal. Essentially, squelch is a specialized type of noise gate designed to suppress randomized signals. Squelch is widely used in two-way radios and radio scanners to suppress the sound of channel noise when the radio is not receiving a transmission. Squelch can be opened, which allows all signals entering the receiver to be heard. This can be useful when trying to hear distant or otherwise weak signals, for example in DXing.

Carrier squelch

A carrier squelch or noise squelch is the most simple variant of all. It operates strictly on the signal strength, such as when a television mutes the audio or blanks the video on "empty" channels, or when a walkie-talkie mutes the audio when no signal is present. In some designs, the squelch threshold is preset. For example, television squelch settings are usually preset. Receivers in base stations, or repeaters at remote mountain top sites, are usually not adjustable remotely from the control point.

In two-way radios (also known as radiotelephones), the received signal level required to unsquelch (un-mute) the receiver may be fixed or adjustable with a knob or a sequence of button presses. Typically the operator will adjust the control until noise is heard, and then adjust in the opposite direction until the noise is squelched. At this point, a weak signal will unsquelch the receiver and be heard by the operator. Further adjustment will increase the level of signal required to unsquelch the receiver.

A typical FM two-way radio carrier squelch circuit is noise-operated. To minimize the effects of voice audio on squelch operation, the audio from the receiver's detector is passed through a high-pass filter, typically passing 4,000 Hz (4 kHz) and above, leaving only high frequency noise. The squelch control adjusts the gain of an amplifier which varies the level of the noise coming out of the filter. This noise is rectified, producing a DC voltage when noise is present. The presence of continuous noise on an idle channel creates a DC voltage which turns the receiver audio off. When a signal with little or no noise is received, the noise-derived voltage is reduced and the receiver audio is unmuted. Some applications have the receiver tied to other equipment that uses the audio muting control voltage, as a "signal present" indication; for example, in a repeater the act of the receiver unmuting will switch on the transmitter.

Tone squelch and selective calling

Tone squelch, or another form of selective calling, is sometimes used to solve interference problems. Where more than one user is on the same channel (co-channel users), selective calling addresses a subset of all receivers. Instead of turning on the receiver audio for any signal, the audio turns on only in the presence of the correct selective calling code. This is akin to the use of a lock on a door. A carrier squelch is unlocked and will let any signal in. Selective calling locks out all signals except ones with the correct key to the lock (the correct code).

In non-critical uses, selective calling can also be used to hide the presence of interfering signals such as receiver-produced intermodulation. Receivers with poor specifications—such as inexpensive police scanners or low-cost mobile radios—cannot reject the strong signals present in urban environments. The interference will still be present, and will still degrade system performance, but by using selective calling the user will not have to hear the noises produced by receiving the interference.

Four different techniques are commonly used. Selective calling can be regarded as a form of in-band signaling.


CTCSS (Continuous Tone-Coded Squelch System) continuously superimposes any one of about 50 low-pitch audio tones on the transmitted signal, ranging from 67 to 254 Hz. The original tone set was 10, then 32 tones, and has been expanded even further over the years.

CTCSS is often called PL tone (for Private Line, a trademark of Motorola), or simply tone squelch. General Electric's implementation of CTCSS is called Channel Guard (or CG). RCA Corporation used the name Quiet Channel, or QC. There are many other company-specific names used by radio vendors to describe compatible options. Any CTCSS system that has compatible tones is interchangeable. Old and new radios with CTCSS and radios across manufacturers are compatible.


Selcall (Selective Calling) transmits a burst of up to five in-band audio tones at the beginning of each transmission. This feature (sometimes called "tone burst") is common in European systems. Early systems used one tone (commonly called "Tone Burst"). Several tones were used, the most common being 1,750Hz, which is still used in European amateur radio repeater systems. The addressing scheme provided by one tone was not enough, so a two-tone system was devised—one tone followed by a second tone (sometimes called a "1+1" system). Motorola later marketed a system called "Quik-Call" that used two simultaneous tones followed by two more simultaneous tones (sometimes called a "2+2" system) that was heavily used by fire department dispatch systems in the USA. Later selective call systems used paging system technology that made use of a burst of five sequential tones.


DCS (Digital-Coded Squelch), generically known as CDCSS (Continuous Digital-Coded Squelch System), was designed as the digital replacement for CTCSS. In the same way that a single CTCSS tone would be used on an entire group of radios, the same DCS code is used in a group of radios. DCS is also referred to as Digital Private Line (or DPL), another trademark of Motorola, and likewise, General Electric's implementation of DCS is referred to as Digital Channel Guard (or DCG). DCS is also called DTCS (Digital Tone Code Squelch) by Icom, and other names by other manufacturers. Radios with DCS options are generally compatible, provided the radio's encoder-decoder will use the same code as radios in the existing system.

DCS adds a 134.4 bps (sub-audible) bitstream to the transmitted audio. The code word is a 23-bit Golay (23,12) code which has the ability to detect and correct errors of 3 or fewer bits. The word consists of 12 data bits followed by 11 check bits. The last 3 data bits are a fixed '001', this leaves 9 code bits (512 possibilities) which are conventionally represented as a 3-digit octal number. Note that the first bit transmitted is the LSB, so the code is "backwards" from the transmitted bit order. Only 84 of the 512 possible codes are available, to prevent falsing due to alignment collisions.


XTCSS is the newest signalling technique, and provides 99 codes with the added advantage of "silent operation". XTCSS-fitted radios are purposed to enjoy more privacy and flexibility of operation. XTCSS is implemented as a combination of CTCSS and in-band signalling.


Squelch was invented first and is still in wide use in two-way radio, especially in the amateur radio world. Squelch of any kind is used to indicate loss of signal, which is used to keep commercial and amateur radio repeaters from continually transmitting. Since a carrier squelch receiver cannot tell a valid carrier from a spurious signal (noise, etc.), CTCSS is often used as well, as it avoids false keyups. Use of CTCSS is especially helpful on congested frequencies or on frequency bands prone to skip and during band openings.

It is a bad idea to use any coded squelch system to hide interference issues in systems with life-safety or public-safety uses such as police, fire, search and rescue or ambulance company dispatching. Adding tone or digital squelch to a radio system does not solve interference issues, it just covers them up. The presence of interfering signals should be corrected rather than masked. Interfering signals masked by tone squelch will produce apparently random missed messages. The intermittent nature of interfering signals will make the problem difficult to reproduce and troubleshoot. Users will not understand why they cannot hear a call, and will lose confidence in their radio system.

Professional wireless microphones use squelch to avoid reproducing noise when the receiver does not receive enough signal from the microphone. Most professional models have adjustable squelch, usually set with a screwdriver adjustment or front-panel control on the receiver.

/ to continue, ...

  • i don't know if that is an answer to the question, but i'm giving you an upvote for the passion – jsotola May 29 at 4:33
  • @jsotola Thank you very much for your upvote. My "answer" is not yet an answer, because I need the OP's confirmation that I have not misunderstood anything, and my modification of his question is more or less OK, before I can move on to give the real answer. What I have been writing is sort of memoir to convenience myself and visitors that I should be able to suggest an answer. And even eventually I could not provide a real answer, I hope other visitors might help towards a better answer. – tlfong01 May 29 at 4:47
  • mmm thanks way off track but anyways.. Ignore this question.. – Sonic May 29 at 5:00
  • Really? I am interested to know where I have misunderstood. Perhaps I should get a second hand transceiver from eBay to learn to try to understand where I misunderstand, and then come back to answer this question I misunderstand. – tlfong01 May 29 at 6:14
  • I skimmed through some PTT (Push to Talk) and COS (Carrier Operated Swttch), and now have clear picture of what is going on. Actually "PTT = 12 COS = 16" confused me in the beginning, because it is short for "PTT (pin/signal)= #12,and COS pin/signal) = #16. Very likely it is something like output signal from transceiver #1 triggers input signal to transceiver #2. Or more specifically GPIO pin 1 goes low sets GPIO pin high, and GPIO pin 4 goes low triggers GPIO pin high. There can be two separate programs to run indepentently, or one program looping two functions. – tlfong01 May 29 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.