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 https://github.com/etherkit/Si5351Arduino
You can download a corrected version of MultiFeaturedVFO.ino here:
https://drive.google.com/file/d/0B7yCOxNJVhR5UE9OQS14djI0anc/view?usp=sharing

//------------------------------- 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.

18 comments:

  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!
    Željko-9a3ru
    P.S. I visit SQ9NJE site,put his sketch for Si5351 SDR ,but have bunch of error?

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

    thx

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

      Delete
  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

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
    Replies
    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

      Delete
  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

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

      Delete
  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)

    ReplyDelete
  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

    ReplyDelete
  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 rholsti@icloud.com

    ReplyDelete
  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.

    ReplyDelete
  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);
    becomes
    si5351.set_freq((vfo * SI5351_FREQ_MULT) + bfo, SI5351_CLK0);
    You need to go to https://github.com/etherkit/Si5351Arduino and view the README.
    You can download changes at:
    https://drive.google.com/file/d/0B7yCOxNJVhR5UE9OQS14djI0anc/view?usp=sharing

    ReplyDelete
  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.

    ReplyDelete
  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);
    #endif

    ReplyDelete
  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

    ReplyDelete