Monday, April 6, 2015

Multi-Featured VFO

Download MultiFeaturedVFO.ino
Download Rotary.Zip (click on Down Arrow at top of page)
Jason's Arduino Si5351 Library (click on Download Zip) and install it directly into the new Arduino IDE as mentioned in my last post.
Hardware Layout for this program can be found here.
**4/17 Jason has a new library
You can download a corrected version of MultiFeaturedVFO.ino here:

//------------------------------- Set Optional Features here --------------------------------------
//Remove comment (//) from the option you want to use. Pick only one
#define IF_Offset //Output is the display plus or minus the bfo frequency // this line will be used
//#define Direct_conversion //What you see on display is what you get
//#define FreqX4  //output is four times the display frequency

You can output frequencies up to 160Mhz. Keep this in mind when you use the 4X frequency option.
You can also tune in 1Hz increments if you so desire.
Also, I use clk0 for VFO output and clk2 for BFO.

Jason's latest library has a calibration sketch that can be accessed by:

You can easily adjust the frequency correction using the Serial Monitor and the keyboard. Make note of the offset and put it into si5351.set_correction(); in the VFO sketch. The correction is no longer stored in the board EEPROM so do not comment out the set_correction line as I had mentioned in the past. Also when using the current hardware setup, nothing will change on the LCD while adjusting the frequency - only on a frequency counter.
Looking at the above screen you will notice three Si5351 libraries in my "user libraries" folder. The Adafruit_Si5351 is not a problem since the header file uses a different name. The "Si5351" and "Si5351Arduino-Jason" share the same header file name. I did get an error that said something like "multiple libraries were found for si5351.h files - you must die". Both were Jason's newer library but the one, "Si5351Arduino-Jason" had all the newer upadates and examples so I deleted the "Si5351" folder.


  1. Hello Tom! I see you've implemented my request in Multi-Featured VFO code.Manny thanks!
    I changed something into (instead of 16x2 lcd, put 20 x4), etc.Just little things HI!!
    However, I do not know something, that's how with the frequency change LCD displays band.
    Example: When the VFO on 3.500.000Hz-3.800.000Hz, LCD shows: band "80m",on the 7.000.000Hz-7.200.000Hz shows: "40m" and so all HAM bands.In the case, when VFO is not in HAM band , lcd display: "OUT OF BAND"
    Please do these changes implement in Multi-Featured VFO! That is one step more to the standalone RTX!
    I was just finishing SDR RTX planned UT3MK, so that the HW almost over.
    I have dozens of times looked at the video of NT7S, and what it can do, but that in his code just does not ??
    All the best to you!
    P.S. I visit SQ9NJE site,put his sketch for Si5351 SDR ,but have bunch of error?

  2. hallo...
    i have problem when upload.. error mesages says sketch too big.. i am using uno


    1. problem solved.... i am try new version of arduino. arduino ver 1.6.4

  3. Hello Tom thanks for putting the sketch together, works great!
    i added from Ashhar Fahrans Sweeperino sketch a DBm meter to your compilation.
    I could not get the sweeperino to work with an encoder, Still trying though!
    With your code and the 8307 meter working together i can play with filters now!
    one question? what should the output of the si5351 from clk0 read in dbm?
    Im trying to calibrate it and dont have a scope.
    Mike kd7ura

  4. This comment has been removed by the author.

    1. Hi mike,
      This statement which only needs to appear once in setup() sets the power output of the si5351:
      si5351.drive_strength(SI5351_CLK0,SI5351_DRIVE_8MA); //you can set this to 2MA, 4MA, 6MA or 8MA
      As measured into 50 ohms with a spectrum analyzer at 10Mhz,
      clk0 outputs:
      8ma = 9.8dbm
      6ma = 7.5dbm
      4ma = 4.1dbm
      2ma = -1.7dbm

  5. Hi Tom! I know this is an older project, but wanted to let you know that I've adapted this code to work on several different HB rigs (on #4 now!). Thanks for sharing it with the community!

    73 - Steve N8NM

    1. Glad you could you could get something out the post. Thanks for your comment.
      Tom, ak2b

  6. Hi Tom,
    I'm just reading the sketch and see the interrupt enabeling is different from the Arduino manual. The Arduino manual uses 'attachInterrup( interrupt#, ISR, CHANGE). The sketch as given compiles without problem for an UNO bus does not compile for an Arduino DUE or an Arduino M0 pro. Do you know an easy way to make de Arduino sketch to be compiled for the Arduino DUE or an Arduino M0 pro.

    Best regards
    Jan Mulder (PA0DMM)

  7. Hi Tom
    If I want vfo - bfo output on one band and bfo -vfo output on other band, is it possible ?
    How can I do it ?
    Best regards

  8. Cant seem to get around this error message.
    Arduino: 1.6.11 (Windows 10), Board: "Arduino Nano, ATmega328"

    //initialize the Si5351
    si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0); //If you're using a 27Mhz crystal, put in 27000000 instead of 0
    // 0 is the default crystal frequency of 25Mhz.
    no matching function for call to 'Si5351::init(int, int)'
    My direct email is

  9. here is the error report. this time used IDE 1.6.5
    Arduino: 1.6.5 (Mac OS X), Board: "Arduino/Genuino Uno"

    MultiFeaturedVFO.ino: In function 'void setup()':
    MultiFeaturedVFO:161: error: no matching function for call to 'Si5351::init(int, long int)'
    MultiFeaturedVFO.ino:161:49: note: candidate is:
    In file included from MultiFeaturedVFO.ino:3:0:
    /Users/robertholsti/Documents/Arduino/libraries/Si5351Arduino-master/src/si5351.h:283:7: note: void Si5351::init(uint8_t, uint32_t, int32_t)
    void init(uint8_t, uint32_t, int32_t);
    /Users/robertholsti/Documents/Arduino/libraries/Si5351Arduino-master/src/si5351.h:283:7: note: candidate expects 3 arguments, 2 provided
    MultiFeaturedVFO:176: error: no matching function for call to 'Si5351::set_freq(long long unsigned int, long long unsigned int, si5351_clock)'
    MultiFeaturedVFO.ino:176:74: note: candidate is:
    In file included from MultiFeaturedVFO.ino:3:0:
    /Users/robertholsti/Documents/Arduino/libraries/Si5351Arduino-master/src/si5351.h:285:10: note: uint8_t Si5351::set_freq(uint64_t, si5351_clock)
    uint8_t set_freq(uint64_t, enum si5351_clock);
    /Users/robertholsti/Documents/Arduino/libraries/Si5351Arduino-master/src/si5351.h:285:10: note: candidate expects 2 arguments, 3 provided
    MultiFeaturedVFO.ino: In function 'void loop()':
    MultiFeaturedVFO:221: error: no matching function for call to 'Si5351::set_freq(long long unsigned int, long long unsigned int, si5351_clock)'
    MultiFeaturedVFO.ino:221:76: note: candidate is:
    In file included from MultiFeaturedVFO.ino:3:0:
    /Users/robertholsti/Documents/Arduino/libraries/Si5351Arduino-master/src/si5351.h:285:10: note: uint8_t Si5351::set_freq(uint64_t, si5351_clock)
    uint8_t set_freq(uint64_t, enum si5351_clock);
    /Users/robertholsti/Documents/Arduino/libraries/Si5351Arduino-master/src/si5351.h:285:10: note: candidate expects 2 arguments, 3 provided
    no matching function for call to 'Si5351::init(int, long int)'

    This report would have more information with
    "Show verbose output during compilation"
    enabled in File > Preferences.

  10. Jason has a new si5351 library that changes a few parameters. One of them involves the statement:
    si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0,0); //If you're using a 27Mhz crystal, put in 27000000 instead of 0
    You can see that an additional 0 is added (the third parameter) that is the correction factor of the crystal.
    The set_freq method has also changed and it removes the 2nd parameter requiring only the frequency and the clock.
    It is very simple to do a search on "set_freq" and just remove the middle parameter and its comma. i.e.
    si5351.set_freq((vfo * SI5351_FREQ_MULT) + bfo, SI5351_PLL_FIXED, SI5351_CLK0);
    si5351.set_freq((vfo * SI5351_FREQ_MULT) + bfo, SI5351_CLK0);
    You need to go to and view the README.
    You can download changes at:

  11. Thanks Tom, I have it compiling right now but ran into another problem . Direct conversion setting and X4 setting fails to compile. The error referenced long long and I remember reading something about that but have to look for it.

  12. fixed direct conversion. I was not completed. pleases check this to make sure it is correct.
    #ifdef Direct_conversion
    volatile uint32_t vfoT = vfo;
    si5351.set_freq( vfo, SI5351_CLK2);

  13. Just a heads up, I have been playing with the code and have made some changes. I changed the LCD to a I2C 1602 connected it in parallel with the Si5351 freeing up a lot of IO pins, updated code to work with new si5351 library and a few other minor changes and corrections. I have the code working in all 3 modes. I'm working on adding band change switches so i can jump from band to band quickly and want to add outputs to change band filters. I know this is a old thread but though i would throw it up here in case anyone was interested. Bill N7OQ

  14. que bomestes projetos waldir muito obrigado amigo!!!!

  15. MultiFeaturedVFO_4_24_17.ino: In function 'void setup()':
    MultiFeaturedVFO_4_24_17:178: error: no matching function for call to 'Si5351::set_correction(int)'
    MultiFeaturedVFO_4_24_17.ino:178:30: note: candidate is:
    In file included from MultiFeaturedVFO_4_24_17.ino:15:0

    i have error like above... any suggestion for me?

  16. Tom,
    Can one use this sketch to simply set two clocks for use in a FT8 20m TX? I only need one for the LO and the other for the BFO. Adjusted for the IF frequency, of course. I don't need a rotary encoder of even a LCD display.

    Thanks, Jack

    1. Yes, you could just set the freq in setup and pretty much ignore everything else.

  17. Do you have a pc board layout for the vfo? If so, does it happen to have a lpf or bandpass filter to convert the SI5351 to a sine wave?

  18. Arduino:1.8.18 (Windows 10), Płytka:"Arduino Nano, ATmega328P (Old Bootloader)"

    C:\Users\Maciek\Desktop\MultiFeaturedVFO_4_24_17\MultiFeaturedVFO_4_24_17.ino: In function 'void setup()':

    MultiFeaturedVFO_4_24_17:178:30: error: no matching function for call to 'Si5351::set_correction(int)'

    si5351.set_correction(13475); //**mine. There is a calibration sketch in File/Examples/si5351Arduino-Jason


    In file included from C:\Users\Maciek\Desktop\MultiFeaturedVFO_4_24_17\MultiFeaturedVFO_4_24_17.ino:15:0:

    C:\Users\Maciek\Documents\Arduino\libraries\Si5351Arduino-master\src/si5351.h:292:7: note: candidate: void Si5351::set_correction(int32_t, si5351_pll_input)

    void set_correction(int32_t, enum si5351_pll_input);


    C:\Users\Maciek\Documents\Arduino\libraries\Si5351Arduino-master\src/si5351.h:292:7: note: candidate expects 2 arguments, 1 provided

    exit status 1

    no matching function for call to 'Si5351::set_correction(int)'

    Ten raport powinien zawierać więcej informacji jeśli w
    File -> Preferencje zostanie włączona opcja "Pokaż
    szczegółowe informacje podczas kompilacji"

  19. For you all - that will try this project in 2022 and upward,
    You must using Si5351a Jason's Library version 1.0, or you will get headache because you get errors when compiling,
    above library linking from Tom is not update anymore, trust me, i tried dozen times and not work.
    how to do this library instal is:
    Open your Library manager, your PC must connected to internet,
    Wait until updating is completed,
    Then search for "si5351, you will pointed to Jason mildrum Library.

    Dont do automatic install
    Dont do latest version install,
    DO Choose the version 1.0. (in this early version, only 3 examples exist).

    my youtube channel :