FT-817 Automatic Loop

April 30th 2012 Update: Version 1.0 Released on Google Code


First things first:

"I live in the US" Legal Disclaimer:
Magnetic Loops are extemely dangerous. The extremely high voltage that develops can cause serious injury or even death. Use Magnetic Loop at your own risk. Actually, you should never use a Magnetic Loop. Please don't. If you do I will not be responsible in any way.
Also CAT interfaces are very dangerous. The undocumented 0xBD command could damage your FT817 in an irreparable way. You should never use the CAT interface of your FT817 in the way presented in this article. Please don't. If you do I will not be responsible in any way.

I really like my portable magnetic loop antenna and I believe it is the best compromise in terms of performance and portability. My Loop for HF is so small and light than I normally transport it on my bike. Some others use their Magnetic Loops as pedestrian mobile.

There is, however, something unpleasant about the Magnetic Loop experience that the user cannot avoid noticing: tuning. If you ever tried one you know what I'm talking about: each time you change the operating frequency - even just by a few KHz - you will have to tune the antenna again. What a nuisance! Wouldn't it be nice to have a loop that magically tunes itself?

Well, here it is! This project is a proof of concept for an Automatic Magnetic Loop Antenna: you press a button and the antenna is ready to be used. Such a loop will be portable, cheap and finally also easy to operate.

Schematic Diagram. Click to enlarge


The project is based upon arduino Arduino, more specifically an Arduino UNO but I think any other variant will be just the same.
The initial idea was to use a SWR directional coupler and use the feedback to drive the logic of an Arduino board. While investigating the various options for the coupler I realized that my FT817 already measured the SWR so started asking myself if it was possible to somehow "read" such information from the outside. Apparently it was possible thanks to an undocumented CAT command (0xBD) that was created by Yaesu just to do that. Moreover, an Arduino CAT library for the FT817 had already been written by VE9QRP and published under GPL.
The necessary Servo to drive the variable capacitor is a Hitec HS-322HD and Arduino has a Library for it that works right off the box. The Servo will position itself within a range of 180 degrees in just a few second. Just add a LED and a pushbutton and you are ready to go.


The VE9QRP library doesn't compile on latest one (Arduino 1.0) so I had to port it.
Then I added the missing 0xBD command that is necessary to read the SWR from the radio. After some debugging (done with a USB / TTL interface and a terminal emulator) I was ready for the actual tuning script.
The first attempt sampled the entire 180 degrees - one degree at a time - and performed an SWR sampling for each step: the lowest SWR sample indicated the position I was looking for.
It worked almost immediately. Then, in order to obtain faster tuning, I modified the procedure: first the capacitor moved in "big steps" of 5 degrees each, then in "small steps" of 1 degree. At the end I opted for yet another solution, which sampled continuously the SWR to determine the arean in which the tuning was possible.

Thanks for reading, best 73's de Alain WW3WW

  • Michael

    Hey Alain, this is beyond cool.


  • Thank you MIchael!

  • Elliott

    Thank you for your right up on this project. I am attempting to replicate the frequency control part of the application. But I am not getting the serial port to work.

    I am using Arduino 1.0 IDE and the Arduino Nano v3.0.

    I have CAT pin 4 connected to Arduino digital pin 8, and CAT pin 5 connected to digital pin 5. Both the CAT TX ground, and the other CAT ground pin are connected to the Arduino ground. I have tried switching the TX and RX pins. I have also tried it without the ground since you do not have your connection grounded in the schematic above.

    The error I get in debug mode is:

    67331280100003timeout on getfreqMode
    sent in: 43218000
    got out: 0
    Rigcomm error: failed setfreqtest

    I am using your FT817 libraries, and the following script:


    #define rxPin 5 // Red wire
    #define txPin 8 // White wire

    FT817 rig;
    long x;
    void setup() {
    SoftwareSerial mySerial = SoftwareSerial(rxPin,txPin);
    rig.begin(4800); // I double checked to make sure that this is the right baud.

    void loop() {

    void testFrequencyChange() {
    x = 43218000;
    for (long i = 0; i < 1000000; i++) {

    Any suggestion is appreciated. Thank you.

  • Elliot,

    let me ask you something: do you see the frequency changing in the radio? Do you have any USB/TTL adapters?
    When I first started trying the commands where going to the radio and executed successfully, however the responses were not being correctly read.
    I did a lot of debugging using a USB/TTL converter that I already had to program my Kenwood TH-F7A. Basically, I sent the commands using the Arduino, and at the same time I read the radio's responses using the USB/TTL converter hooked to a terminal emulator for Mac (Roger Meier's CoolTerm). This is exactly the same advice that I received from the original author for those libraries when I initially run into troubles.
    Anyway, FYI another ham replicated this work in Italy and he got it up and running at first try. He is using another Arduino UNO.

    Let me know how


  • paolo ik2ulb

    Hello Alain , tnx fer your cool project! it's very interesting.
    i announce to you that your tube video is linked on


    The most readed italian forum will be very pleased if you can write us some other information about your well done job!


    Ciao Alain, come butta li?
    Grazie per la bella idea di robotizzare l'accordo di una magnetica... sicuramente il sogno nel cassetto di molti possessori di 817. (me compreso )

    Ti comunico ( non lo avessi gia visto ) che il tuo video pubblicato su you tube è stato linkato sul forum di AriFidenza (credo il piu letto in italia e con parecchi visitatori anche esteri ).


    Sarebbe davvero bello se tu potessi fornire qualche ulteriore spiegazione riguardo alla tua bella realizzazione ( in pratica la pappa pronta piace a tutti....me compreso! hi hi )

    Grazie per il tempo che mi hai dedicato.
    A presto rileggerti.

    72 de ik2ulb, paolo , como -italy-

    • Hello Paolo,
      I have already provided the schematic and the souce code,what else do you need? Please let me know

      Alain WW3WW

      • Giulio Marcato

        hi Alain,
        is it the same code for ft857?
        Giulio IZ3EAW

        • Giulio,

          this project has been successfully tested also on the FT857. (But I have no idea about the FT847, sorry)


  • qrp.gaijin

    Nice project. Does the servo provide enouugh precision to finely tune the variable capacitor? With a narrow-bandwidth loop and a large variable capacitor I guess you need to adjust the variable capacitor with a precision of 0.1 degrees.

  • Hi Alain, congratulations, your project is really smart, read the swr by rtx was a good idea. I'm currently working on my tuner for magnetic loop. I designed it to read the value of the swr from a piece of coax cable in analog way, then using a PICAXE chip i get the value of the previous frequency and after the value of the next frequency and by the program i made the chip can control a DC motor which is keyed to the capacitor. But now, saw your tuner i would like to do something similar, my rtx is a FT847, perhaps do you know if the CAT byte commands are the same between FT817 and FT847 ?
    Thank you.

  • Elliott,

    For what it's worth, I'm having the same timeout problem as well. I'm using a MEGA 2560 and V1.01 IDE. Did you manage to find a solution?

    Paul 🙂

    • Ed de la Rie

      If feature requests are permitted, what about a multiturn version for servo's that make >360 deg. turns. That would be quite valuable when using vacuum C's. Otherwise using a coax-loop as described is very portable, and is the right way to accompany the ft-817. Excellen piece of work !

  • Roberto Sartori

    hello, congratulations for your project, you may contact me at my email that I would like to ask you about a change if possible.THANK greetings robert IZ2ZMW

    roby.s988 @ hotmail.it

  • Mykola Tsarynny

    Hi Alain

    Got problem while replicating your project

    My setup is

    Arduino Uno R3


    Yaesu ft817nd

    Power supply 12 v or 9 v battery

    Got interference problem on push button means arduino think that button is presse time to time

    another problems is that arduino is missin target means SWR 1 always missing my capacitor about 100 pF 5 volts on servo

    Please advice


    • Hello Mykola,

      You should add a 10K resistor between GND and D5 (it should have been in my schematic, sorry). That should fix your button problem.

      As per the resolution issue, its a bit more complicated. You need to make sure the pF/degree ratio this servo can cover is enough for your loop. If the loop needs a higher resolution, you will either have to change the loop or change the servo (and the software as well!).

      The last person who successfully replicated this project is a OM from the Netherlands. If you want I can put you guys in touch.


      • Mykola Tsarynny

        Hi Alain Tnks for quick responce

        Means that i can simply do 5 degrees sampling instead of 10 degreess can it work with that servo? otherwise can you advice which servo i can you for better resolution anoter maker or...
        Curently im on a job far away from home and ards board, mean time can you get me in toch with OM from Netherlands, thats will be great


        Nick de US5FET

        • Nick,

          I am sorry but I am moving to a new apartment and I have been particularly busy these weeks.
          I meant that the loop you use in this project will need to require low precision in terms of pF/degree. If your loop requires precision then this project is not the right one for you...
          This is a quick hack for an low gain magnetic loop... not at all a sophisticated solution for higher gains

        • Mykola Tsarynny

          Hi Alain

          Tnks for quick repply
          Have an idea that we are using almost same loop antena woundering what is the dimentions of yours and capasitor PFs??