Monday, August 6, 2018

SI5351 Signal Generator Test Gadget

I have been spending way too much time playing with the new 3D printer, so have to get back to some electronics.  Since the next CWTD.ORG episode is coming up, I decided to build another 'Test Gadget'.  This time it is a Signal Generator based on the SI5351 clock generator.  I had purchased a couple Chinese versions of the Adafruit 5351 module when I was working on the 'Sweeperino Jr. ' and wanted to see how  well they worked.  


This time I decided to mount the board vertical and only use half of the connections.  Since the module only uses power and the I2C bus this made construction very easy.  And, only using one set of connector pins makes connecting the board much easier.  And also left plenty of room to mount an AD8307 log detector, so I can later use it as a SNA or Wattmeter.

For the software I decided to use some in-line code instead of one of the libraries that are available.  I grabbed the SI5351 code from the uBITX by Jerry , KE7ER , and only had to make a couple minor changes to get it to work as a 3 channel signal generator.  This was just removing a couple things that are specific to the uBITX. This code limits the frequency range from .5 to  just over 100 MHz., but that covers everything I am interested in.  The range can be lowered by a changing a value if desired, but you will have to change that value back to get the higher range again.

The use of a Joystick makes frequency selection very easy.  A horizontal movement changes the increment, while a vertical movement increments or decrements the frequency.  A test of the increment value being changed, sets the color/background of the frequency display for that column.  This makes frequency changes very fast.  A short press on the Joystick button toggles through the three channels and a long press brings you back to the main menu. The code is mainly contained in a while loop , with a couple support functions to 
display the frequency, or display frequency being edited.

 boolean   siggen = true;
 while (siggen) {
    ReadJoyStick();
    if (jstickH < 0) {
      increment = increment * 10;
      if (increment > 10000000) increment = 10000000;
      jstick = false;
    }
    if (jstickH > 0) {
      increment = increment / 10;
      if (increment < 1)increment = 1;
      jstick = false;
    }
    if (jstickV > 0) {
      if (freq + increment > 99999999)
        freq = 99999999;
      else freq = freq + increment;
      freqChn[si5351_ActiveChn ] = freq ;
      si5351bx_setfreq(si5351_ActiveChn,  freq );
      jstick = false;
    }
    if (jstickV < 0) {
      if (freq - increment < 0)
        freq = 0;
      else freq = freq - increment;
      freqChn[si5351_ActiveChn ] = freq ;
      si5351bx_setfreq(si5351_ActiveChn, freq );
      jstick = false;
    }
    if (jstickSW == ShortPress) {
      jstick = false;
      freqChn[si5351_ActiveChn ] = freq ;
      si5351_ActiveChn ++;
      if ( si5351_ActiveChn > 2)si5351_ActiveChn = 0;
      freq = freqChn[si5351_ActiveChn ];
      DrawSigGenScreen();
    }
    if (jstickSW == LongPress) {
      jstick = false;
      siggen = false;
    }
    ypos = 60 + (si5351_ActiveChn * 38);
    tft.setCursor(80, ypos - 10);
    edit_Freq(freq);
    jstick = false;

  }

With the signal generator working, next I want to add an 8307 log amplifier to the board.  I have several circuit boards left from a stand alone AD8307 power meter I did for an article in QQ.  I plan on cutting just the isolated power meter circuit out of this board and attaching it to the test gadget board.  Should be a very easy way to add  power meter functionality to the test gadget.  I will probably write software for use as a Wattmeter, with  a 40 dB. tap to get from the milliwatt range up to around the 100 watts. Also thinking about building a simple high impedance probe to use for in-circuit testing.
After that I can use the nice 320x240 display for a SNA.

1 comment:

  1. Hallo DuWayne aus Deutschland. Hope you are doing fine. I was really amazed about your developments around the Test Gadgets. As my SNA Jr. II is doing a great job in my lab, I would please ask if you could provide any gerbers file for these new projects. So thank you for your feedback. Have a nive day and Happy Nikolaus von sTef - DM5TU

    ReplyDelete