The KiwiSDR 2 online store is open for orders! Please visit kiwisdr.nz

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

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: https://github.com/OH1KK/KiwiSDR-antenna-switch-extension

G8JNJg1tvl
«1

Comments

  • 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 :-)

    Regards,

    Martin - G8JNJ
  • HI All , as I am quite new in the Linux world, where can I read more about the GPIO switching board ?
    73
    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 https://github.com/OH1KK/KiwiSDR-antenna-switch-extension

    Regards,

    Martin - G8JNJ




    Attachments:
    https://forum.kiwisdr.com/uploads/Uploader/63/46a2ac3ce09d6c4a5f544af5b18f26.png
  • 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 2017
    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 ?

    Regards,

    Martin - G8JNJ


  • edited March 2017
    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

    John, 

    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 ?

    Regards,

    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.


    image

    Attachments:
    https://forum.kiwisdr.com/uploads/Uploader/cf/ea84d15c350c12688d9f6fcc9cbf63.pdf
  • 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 ?

    Regards,

    Martin - G8JNJ







  • jksjks
    edited March 2017
    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

    Regards,

    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
    192.168.1.24 and adapted the config-file of your extension to that ip
    192.168.1.24 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 2017
    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.

    Regards,

    Martin - G8JNJ








    Attachments:
    https://forum.kiwisdr.com/uploads/Uploader/1d/4d2c5bc70730bc0a9a1c219a69d1b1.png
  • 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."

    Regards,

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

    BR
    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).

    Regards,

    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.
  • Is there a simple way to define the default antenna, that is selected, after the KiwiSDR has booted?

    Not every remote user knows, that he has to select an antenna if he doesn't receive anything ...

    //Dietmar
  • Trying to get the OH1KK antenna switch extension installed on my KiwiSDR using GPIO pins to control relays. As far as I can understand the back-end code, it assumes that each antenna is controlled by a separate GPIO pin. In my hardware, I have the antenna relays arranged as a binary tree. This means that I can select one out of eight antennas using only three pins (pins 11, 12 and 13 on p8). Has anyone else tried to modify the code for similar purpose?

    Any assistance appreciated as I have some interesting antennas to share.

    Regards,

    Mauritz / SM2BYC

  • Hi Mauritz,

    I wouldn't bother editing the code.

    The solution is quite simple.

    Build a normal transistor interface for each of the eight GPIO pins.

    Then use a matrix of diodes to form a simple logic routing system.

    This is how I have done it:- 

    GPIO output 1 has nothing connected so all relays are de-energised and this is the default routing position when output 1 is selected or "all antennas grounded".

    GPIO 2 has a diode to relay 2 so just this relay operates when GPIO 2 is selected.

    GPIO 3 has a diode to relay 3 so just this relay operates when GPIO 3 is selected.

    GPIO 4 has a diode to relay 2 and another diode to relay 3 so both these relays operate when GPIO 4 is selected.

    GPIO 5 has a diode to relay 2 and another diode to relay 4 so both these relays operate when GPIO 5 is selected.

    GPIO 6 has a diode to relay 3 and another diode to relay 4 so both these relays operate when GPIO 5 is selected.

    By building a simple 'binary tree' of steering diodes you can route the antenna as required.

    By adding more diodes to each GPIO output you can select which combinations of relays you want to operate for each GPIO selection.

    If you want to change the configuration at a later date, you just add or remove diodes as required.

    I hope this makes sense. If not send me an email and I'll draw you a diagram.

    Regards,

    Martin - G8JNJ

  • Martin:

    Yes it is always possible to solve a software problem with hardware and doing as You suggest is an option. Presently I only have wires soldered to pins 11, 12 and 13 on p8, so I would have preferred a software solution. Modifying the OH1KK code was not as easy as I thought, lots of weird issues with "permission denied" trying to run parts of the script code. So if I don't find a software solution, I will build your suggested diode matrix so I can use the software unmodified.

    Regards,

    Mauritz / SM2BYC

  • Hi Forum

    I found one issue with this extension. After restart of the Kiwi server (for example after FW update) the extension isn't working. You have to reboot the beagle bone to get it working.

    Has anybody also discovered this problem? Has someone a solution for this?


    //Dietmar

  • edited September 2017
    Hi,

    Mauritz - if you look at the LZ1AQ control interface shown on page 13 of this document http://active-antenna.eu/tech-docs/2_ActiveAA_Mount_21.pdf

    You will see that the required control signals are even simpler than you may think at first glace.

    The control line that is used to select the combined loop mode actually uses two diodes on the control board to activate both Loop A & B simultaneously.

    If you want to make use of this mode, you can omit this control line completely and just select the A & B loop control lines together.

    There is also another document that shows a PC serial port interface and control software http://active-antenna.eu/tech-docs/pc-control-active-antenna-amp.pdf

    Dietmar - Yes this is an issue as the GPIO ports do not get enabled unless the KiWi and Beagle are rebooted.

    Set the 'After update' option in the Admin Update page to 'Reboot Beagle' and that should fix your problem.

    I sometimes find that my KiWi / Beagle 'forgets' the GPIO configuration for no apparent reason (usually if the SDR has been running for a few days without an automatic update and full reset. If this becomes a major problem, I'd consider using the 'Daily restart' option on the admin interface 'Control' page which I think will also initiate a Beagle reboot if the 'After update' option is set to 'Reboot Beagle' - but maybe John can confirm that this is the case ?

    Regards,

    Martin - G8JNJ










  • Martin: thanks for the additional information. I gave up on trying to fix the software and followed your advise using a diode matrix. Only issue so far is that one antenna direction is hidden under the ground all antenna button. The KiwiSDR antenna input is fed via a diplex filter with a crossover frequency of 3 MHz. The antenna switch I have installed only affects frequencies below 3 MHz. Over 3 MHz I have an active vertical based on information from your WEB site (PGA-103+). It seems that during winter many users are interested in receiving MW and below probably due to my location in northern Sweden. Will be interesting to see how it works tonight when these frequencies come alive

    Regards,

    Mauritz / SM2BYC
    .
  • Hi Mauritz,

    I just had a play with your SDR and its's very good - looks like I now have some serious competition :-)

    Just as a matter of interest, what size whip are you using with the active antenna ? It's working quite well but I'm a bit surprised that it doesn't seem quite so good as you get further up to the HF end of the spectrum.

    Regards,

    Martin - G8JNJ


  • Hi Martin,

    the whip used over 3 MHz is about 1.5 meters long and about 10 meters above ground level. It produces enough signal to cause overload of the Kiwi, so I have 3 notch filters to attenuate some of the worst BC bands. Over 20 MHz, I have in stead some additional amplification. You can see that the background noise level ramps up towards 30 MHz. I doubt there is anything wrong with the upper part of HF spectrum sensitivity. Seems to be as sensitive as other antennas / receivers I have tested.

    Regards,

    Mauritz / SM2BYC
  • Hi Mauritz,

    Ah OK I see what you are doing, I had wondered about the increase in noise around 30MHz - I do the same but I was keeping it to myself as my secret weapon :-)  

    What's the GP antenna - that's really good on the NDB band.

    Keep up the good work.

    Regards,

    Martin - G8JNJ
Sign In or Register to comment.