KiwiSDR antenna switch extension [and BeagleBone Black/Green GPIOs]

edited March 21 in KiwiSDR Discussion
I have been working with KiwiSDR antenna switch extension. You can now choose different backends. Currently available backends are MS-S7-WEB controller and Beaglebone GPIO's. You can also write your own backend for controlling your own antenna switch box. If you are already running older version of KiwiSDR antenna switch extension, please uninstall it before installing a new version.

New version is available now on Github:



  • Hi All,

    Kari has performed some excellent work with his new extension.

    I've had the GPIO switching configured on my KiWi for the past week and it's working really well.

    Thanks again Kari :-)


    Martin - G8JNJ
  • HI All , as I am quite new in the Linux world, where can I read more about the GPIO switching board ?
    Phil IC8POF

  • Hi Phil,

    There isn't a switching board as such.

    The software toggles some of the spare GPIO (70 -76) pins of the P8 connector on the Beagle. 

    When the switch software is used and an antenna is selected the appropriate GPIO pin goes from 0v to 3.3v.

    This can then be interfaced via a suitable value of resistor (typically 10K) to an NPN transistor driver that is in turn used to operate an external switching relay.

    Details of the software patch and WEB operated switch can be found here


    Martin - G8JNJ

    Beagle GPIO.png
    1366 x 1025 - 193K
  • Kari, many thanks for this great piece of work!!

    I have a couple of Teledyne relays on my kiwi, driven from the GPIOs. One selects an inline attenuator, the other switches between 2 antennas (or one antenna and a dummy load at the moment). I had control from ssh, but I never got around to fiddling with the software end.

    Dave G1TVL
  • Many of you will know this, but be careful about the Beagle GPIOs. They are NOT 5V tolerant (3.3V only). Also, some of the pins on the Beagle headers which appear to be GPIOs are configured by the Beagle to drive on-board devices like the eMMC flash memory. Others have a weak pull-up/down interpretation at power-on time to select the processor boot mode. You don't want to conflict with those. See the Beagle system reference manual for details.

  • edited March 16
    Hi John,

    Thanks for this information.

    I have looked at the Beagle system reference manual but to be honest I couldn't find the relevant part.

    Kari's GPIO switcher uses P8 GPIO pins 70 -76 - do these conflict with anything else ?

    I have found that using 10K resistors from these pins to drive transistors does occasionally prevent the Beagle from booting up. To get around this I simply unplug the GPIO interface box (connected via 9 way D type socket mounted below the GPS antenna connector).

    However in my next version of interface I intend to use 1M ohm resistors and Darlington transistors to further reduce the loading on the GPIO pins.

    Which GIPO Pins are safe to use in order to avoid conflicts with other devices ?


    Martin - G8JNJ

  • edited March 16
    Hi All,

    OK looking through the document in more detail I think I have determined which pins are the ones to be avoided.

    Page 54 and page 74 of the Beagle system reference manual - assuming I'm looking at the correct one ? 

    The Antenna Switching GPIO extension currently uses spare pins on connector P8 (40 to 46) which as John has indicated are also associated with the Boot sequence.

    39 - GPIO 2_12 - SYS_BOOT6
    40 - GPIO 2_13 - SYS_BOOT7
    41 - GPIO 2_10 - SYS_BOOT4
    42 - GPIO 2_11 - SYS_BOOT5
    43 - GPIO 2_8   - SYS_BOOT2
    44 - GPIO 2_9  - SYS_BOOT3
    45 - GPIO 2_6 - SYS_BOOT0
    46 - GPIO 2_7 - SYS_BOOT1

    So all of these are possibly not the best choices for this use.

    The only other pins that are not used for Boot or by the KiWi are:-

    U8 27 - GPIO2_22
    U8 28 - GPIO2_24
    U8 29 - GPIO2_23
    U8 30 - GPIO2_25

    U9 27 - GPIO3_19
    P9 42 - GPIO0_7


    Do you know which of the Boot pins are actually used on power up ?
    Can you say which pins are being used by the KiWi cape ?  
    Is it possible to use any of the GPIO ports that are within the range used by the KiWi ?

    Ideally I'd like to be able to switch up to ten ports as I wish to add something like a shared apex array which can cover eight of the compass points plus two other antennas.

    Maybe it would be necessary to use an external BDC decoder in conjunction with four GPIO lines (GPIO2_22 to GPIO2_25) in order to achieve this ?


    Martin - G8JNJ

  • This is a little table I made during development that summarizes the situation. Basically, it's safe to use the pins in the "kiwi" column marked "e" or "ok". Some of the others could be used but there are special considerations and you don't really need to worry about that unless you're looking for a lot of pins for some reason.

  • Hi John,

    Thanks for this it's very useful. Assuming I'm understanding the designations correctly and that any pins with an X against an orange background are not used.

    It looks like these are the best - listed in order of least conflict first.

    P8 27 - GPIO 2_22
    P8 28 - GPIO 2_24
    P8 29 - GPIO 2_23
    P8 30 - GPIO 2_25

    P9 25 - GPIO 3_21
    P9 28 - GPIO 3_17
    P9 29 - GPIO 3_15
    P9 31 - GPIO 3_14

    P9 30 - GPIO 3_16
    P9 27 - GPIO 3_19 (Okay as Beagle input or output)

    P9 26 - GPIO 0_14 (Also wired to FPGA input)

    P8 26 - GPIO 1_29 (Also wired to FPGA input)

    Does this seem sensible ?


    Martin - G8JNJ

  • jksjks
    edited March 17
    No, the first two groups you have listed are specifically not okay because of device conflicts with the Beagle.

    P8-27..30 are setup as outputs and driven by the LCD controller on the Beagle to the HDMI framer chip. The window system in not enabled on Debian, but you have no way of knowing how the pins are being treated by the device driver. So they are out.
    Similarly P9-25,28,29,31 are HDMI control outputs.

    P9-30 is okay and should have been marked as "ok" in my table.

    Only use the pins makes "e" or "ok" in my table for best results.

  • Hi John,

    OK - good job I checked as I'd misunderstood the meaning of the x.

    So just to double double check.

    In order of preference.

    P8 11 - GPIO 1_13
    P8 12 - GPIO 1_12
    P8 13 - GPIO 0_23
    P8 14 - GPIO 0_26
    P8 15 - GPIO 1_15
    P8 16 - GPIO 1_14
    P8 17 - GPIO 0_27
    P8 18 - GPIO 2_1
    P8 19 - GPIO 0_22
    P8 26 - GPIO 1_29

    On other connector (if ever required)

    P9 11 - GPIO 0_30
    P9 13 - GPIO 0_31
    P9 23 - GPIO 1_17
    P9 26 - GPIO 0_14
    P9 27 - GPIO 3_19


    Martin - G8JNJ
  • Hi Kari


    Thank you for your great
    antenna-switch-extension for the kiwi-sdr! I installed a

    MS-S7-WEB in my lan and can reach it via
    browser and do all the switching. I changed the ip of the switch to and adapted the config-file of your extension to that ip and rebooted the beagle. Unfortunately I can't control the switch
    out of the kiwi and there is no feedback from the switch. Any idea what could
    be the problem?


    73 de Mark HB9AZT

  • Found the problem, the modification in the web-backend is not sufficient, I had to create the ETC-config-file too, now it works fine...
    According to the instructions you could do one modification or the other, but both are needed...

    73 de Mark, HB9AZT
  • Hi,
    I would like to do a simple antenna switch to kiwisdr(ANT and GROUND). Could you describe how did you make it?
    How did you connect wires do Beagle? By connector or soldering?
    73, Mariusz SQ5M
  • edited June 22
    Hi Mariusz,

    I used a short screened multicore cable (but you could possibly use ribbon cable if you don't transmit nearby) ) with a 9 pin female D socket as a flying lead from the KiWi and carefully soldered to the pins on the reverse of the board. 

    I used a 0v  ground connection as common (also connected to D connector shell and multicore screen) and took 8 signal outputs from the appropriate GPIO pins.

    I then ran a short screened multicore cable from a 9 pin male plug to a separate circuit board with the relay drivers. The board was powered from a separate 12v supply.

    Each GPIO pin feeds the base of an NPN transistor via a 33K resistor. The transistor emitter goes to the common (ground) connection and the collector has the relay coil connected to it. The other side of the relay coil goes to the 12v supply (or whatever voltage you choose to use).  The relay coil as a protection diode connected across it (cathode to 12v side anode to transistor side) and also 0.1uF capacitor (to help prevent rf noise pickup). 

    I also connected a 0.1uF capacitor between the transistor collector and emitter to reduce noise or RF pickup by the transistor from the connecting cable.

    I used small signal relays and built it on stripboard. 

    You can add LEDs with series resistors if you want to see which antenna is selected.

    Picture of my 10 port (for possible future port expansion) version attached.


    Martin - G8JNJ

    GPIO switch box.png
    382 x 205 - 142K
  • Hi Martin,
    Thank you very much for this information which is valuable for me. I will try to make something similar device like yours but much small. I belive that the programm by OH1KK will manage my small device.

    Best Regards
    Mariusz sq5m

  • I just noticed a small error in my last posting - it should read:-

    "I also connected a 0.1uF capacitor between the transistor collector base and emitter to reduce noise or RF pickup by the transistor from the connecting cable."


    Martin - G8JNJ
  • ok, there is another error, 33k resitor should be 3,3k I think, isn't it?

    Mariusz sq5m

  • Hi Mariusz,

    I chose 33K (to minimise the current draw to <100uA as the original GPIO ports I used were shared for other purposes), but yes you are correct.

    To be on the safe side the max current the Beagle GPIO ports can source /sink should be less than 4mA. 

    So using 3K3 will limit the current draw to less than 1mA which is ideal and will work with even quite low gain switching transistors (or directly drive some opto-isolators).


    Martin - G8JNJ

  • HI..iC8pof...As per my knowledge the software toggles some of the spare GPIO (70 -76) pins of the P8 connector on the Beagle. 
    When the switch software is used and an antenna is selected the appropriate GPIO pin goes from 0v to 3.3v.This
    can then be interfaced via a suitable value of resistor (typically 10K)
    to an NPN transistor driver that is in turn used to operate an external
    switching relay.
Sign In or Register to comment.