Monday, June 15, 2020

VFO-BFO with ESP32

I made a circuit  board layout for the ESP 32 based VFO-BFO using the Wemos ESP 32 Mini controller module.  Sent Gerber files off to China and had 10 made up, they arrived in a little over a week with Express shipping. I built one up and found a few minotr errors I had made in some dimensions, but the boards still worked fine.  I decided I would use this with a Bitx 40 board I have laying around.  I think I will use Pete N6QWs method for doing Upper and Lower sideband selection.  That means adding or subtracting the desired frequency from the IF frequency . For the Bitx 40 that means setting the SI5351 frequency to 5 or 19 MHz range depending on the sideband selected. Only tricky part is getting the exact IF frequency, of the Bitx 40.



 The board layout has provisions for a up to 7 pushbutton switches that can be read by a single analog input pin.
I chose to use a double row header so I could add individual switches as desired or a switch array connected through a single ribbon cable.   I also brought out the connections, 3.3v, and ground for use by a rotary encoder with switch.. 

The connector for the SI5351 module is mounted on the bottom, so the boards can be stacked.  Also, a female header strip can be mounted on the bottom for a 1.8" TFT display which  then can also be stacked.  I have provision for an optional 5 volt regulator so you can power the  assembly form 7-12 volts if desired, instead of directly with 5 volts


One thing I like about the Wemos module is that I only have to make connections to the inside rows of header pins.  If I need additional control pins, I can put header pins in the outside rows of connections and just plug onto them.  This means I do not have to worry about those pins in the PCB layout.

After playing around with the options this gives me,I decided to modify the layout to make the small corections in layout positions I found. 
I am also going to bring out some of the pins I had not originally used , and add a couple connectors for additional connections to the I2C and SPI signals.  This will allow me to use the same board as display-controller for several other projects I have been slowly working on.  Now just need to send this off to a board house in China, then wait.

Tuesday, May 19, 2020

An updated version of my VFO-BFO

A couple of the projects I have been working on have been put on hold because of the shipping delays caused by the Covid shutdown in many places.  Looking around for something that only required what I knew I have on hand.   I rembered seeing a YouTube video of a SI5351 based VFO with a small TFT display that very nicely simulated a mechanical dial.  Going back I found the video, and there was a link to the website of JF3HZB, the schematic , and Arduino code for the project.  It uses the same 128 x 160 TFT display I have in my VFO-BFO, and a ESP-32 dev. board.  Looking at what pins are required, the small Wemos Mini I have should work nicely.
I downloaded the software, and got  it to compile without any problem. After looking at the code, I can see where having two 240 Mhz. cores doing the processing is nearly a necesity for something like this.  And also still has plenty of  room and power to addd other features.  I quickly built a simple board to see how it looks, and works . 
After getting the basic software running for the display, I did some modifications to add a couple things I want to have on the display. a LSB/USB indicator and I will probably add a T/R indiator light of some type.  The response of the display is really nice, except for some small jumping around that is coming from the really cheap rotary encoder I used.  I have  a couple better ones that I will use after I get a board designed, now I will see if I can correct with some filtering capacitors.

I plan on using one of the Adafruit SI5351 modules I have, so will have to see what if any changes I have to make to use them with 3.3 volt logic instead of 5 volt.  I have not looked at the 5351 library used with the original  software, so do not know if I will keep it or use the same library I have used before.

Trying to think about what I want to include on the board design. All the pins required are on the inside set of pins on the Wemos module. That means I can just add some header pins to the top of the Wemos module instead of having to route them  on the board. This should allow for fairly easy expansion. 

I like the single analog pin method for monitoring multiple push buttons.  I will probably add the resistor chain and some header pins on the board to make it easy to add several push button controls.  Also thinking of having provision to add a retoary encoder directly on the board, or  a connector for adding an external encoder.
 I will get started on the board layout, then decide if I want to order some from one of the board houses.  They all offer DHL shipping, so should not have to wait too long to get them.

I tried to make a video of the board working, but couldn't find a way to keep the camera steady while operating the encoder.
So here is a link to the original YouTubevideo I watched.
https://www.youtube.com/watch?v=3PV2kLOippY


Thursday, April 16, 2020

Best thing to come from the lockdown so far.

With almost everything being shut down from the virus, there must be something good happening.  I think I have found at least one thing.  Since we can't gather together the ability to hold meetings via video conferencing has been really taking off.  

Last Saturday we held the monthly meeting of the North Georgia QRP Club via Zoom.  We had around 25 people show up. Mostly members, but also a couple guests including Hans Summers from QRPLabs checking in from Turkey.  He gave a brief history of the QCX transceiver. and informed us that they are only a couple hundred short of having sold 10,000 kits.  He also spoke a little about the multi mode, all HF band QSX that is in development.  We also heard from some of out local members, and got to see some pictures of their shack, and work bench. Except for a couple little glitches, from not being familiar with the software every thing went quitae well.  Now waiting for the next meeting.

NO this is not the FBI's Most wanted List, or is it?



Last evening I got to attend another meeting.  This one would be a little frather drive from Atlana than the NOGA meeting.  This was with the homebrew group from the Peal Amateur Radio Club located in the Greater Toronto area.   I usually only get together with some of them at FDIM, so this is a plus for me.
This meeting used a different software package, but also worked quite well. Except for also being the first time most of have used it. We had 17 people in the meeting including several that joined in via cell phone. As with the NOGA meeting there was a guest calling in.  He was Rex Harper from QRP ME, and he spoke about the 'Buildithon' project that has been scheduled at FDIM this year.  He is still working on the kits, and is planning on having a virtual Buildithon.  Also heard about the progress being made on the Direct Conversion Receiver, which is to be the club 'Buildithon' this year.

Possibly the RCMP most wanted list ?




With the aid of the video conferencing software we are still able to get together with our friends.  Of course most of us have more time to get on the air, work on projects, or start on the list of things the Wife has been wanting done 'forever'.

My last comment on the matter is something a friend said in one of his e-mails.   " I feel like a teenager again, gas is cheap, and I'm GROUNDED"




















Thursday, April 9, 2020

UHF Version of TinySA

I had started on the TinySA from Groups.io HBTE, but am still waiting on some parts that I had orderd than have yet to show up.  Looking around I found a UHF version that covers 240 to 940 MHz. This only uses a single si4432 transceiver module, which I have on hand. So I will try to do a similar UHF version of the TinySA.  Since this does not need the input LPF, mixer, and a high local oscillator, it should turn out to be a small instrument.

I have previously used a ESP32 development module, but that was quite large.  Looking around aroound I found a Wemos ESP 32 mini that looked like it would do nicely. 
It gets much of its size from having the IO pins as two rows of 2 wide headers .

  Fortunatly the SPI and I2c pins are all located on the inside rows of pins, and there are enough extra pins available for the every thing else I need.
I can also put right angle headers in the outside row of pins and connect directly to them without having to have additional connectors on the circuit board.

I had neen very happy using a joystick for the user input device, but they are a little large for what I had in mind, and also they used 3 IO pins.  I also wanted a couple extra control buttons available for the UI.  I decided to go to keypad made up of a resistor divider string with switches to ground at each intersection.  This can be read using a single ADC input.

Using surface mount components, the entire keypad can be layed out on the top side of the PCB, without taking up any extra space in he cabinet.  I designed and 3D printed a small case, and the buttons for the keypad.


The software to read the keypad is quite easy.  First you have to find out what ADC vlue is returned with no keys pressed and when each key is pressed.  These values are reduced about 10% to prevent false readings.  These values are put into an array.

The keypad function checks to see if a keyis pressed ( reading lower than none pressed value).  If it is a short delay to debounce and another reading is taken ,then simple for loop compares this to the values in the array.  The value of the last array item lower then the read value is returned to the calling program.

int readKeypad() {
  int i;
  int key;
  // analog value for each key press measured and adjusted down about 10% to prevent
  // wrong readings    0 position is no key pressed
  int key_val[] = {3500, 3200, 2900, 2600, 2200, 1700, 900, -1};
  if (analogRead(keyPadPin) > key_val[0])  // No key pressed
    return 0;                     // just return
  else
    delay(5);                   // debounce
  i = analogRead(keyPadPin);         // get pressed key reading
  for (int n = 0; n < 8; n++) { // check to see which key is pressed
    if (i <= key_val[n])         // compare against array of measured values
      key = n + 1;              // bump up so you can use simple if test for a pressed key
  }
  if (key > 7 )key = 0;           // helps to clean up clean up extended switch bounce
  return key;
  delay(25);                     // set max repeat rate

}

This works quite well, except for a little key bounce from the really cheap switches I had on hand.  I put everything in the printed case, and loaded a modified version of the menu system I had used with joystick.  

Now I need to grab some of the si4432 code from the TinySA on the HBTE group  and see if I can get it working in the receive mode, then write some sweep and display functions.

Friday, February 7, 2020

SMA Torque Wrench for the NanoVNA (uncalibrated)

I have been using SMA connectors on most of my projects, and have occasionaly gotten a slightly different reading than I had expected.  Using the NanoVNA, this has shown up a little more often.  After a some checking, it appears that having the connectors  'finger tight' is not quite good enough for getting consistant readings. After watching several Youtube videos and reading soome instruction manuals on much more expensive VNAs , I decided I need some form of torque wrench to help eleviate the problem.  

Looking around I found that even the cheapest torque wrench for SMA connectors cost nearly as much if not much more than the NanoVNA.  I wondered if it would be possible to 3D print someting that would be usable.  I looked around Thingiverse.com, and found a couple examples of torque wrenches that looked easy enough to model one on for SMA connectors.   Looking as the specifications for SMA connectors, I found that they shold be tightened to 5 in. pounds of torque.  For my use it would be adequate to have it somewhere near that value as long as it was consistant.

SMA connector nuts are 8mm. across the flats, so I went 8.2mm. to make it easier to get on and off.  I also put a wide enough slot in the end of the wrench to allow it to slide over cables easily.  While I was working on the design I decided to taper the other end of the wrench so it could be used as a stylus for the touch screen.  I also added a small hole 2" from the center of the wrench opening, so you can use a small luggage scale to compute the actual torque.

I printed a couple with different printer settings and tried them out.  Just place over the connector nut and turn until the wrench slipps around to the next flat. I measured how much force I had to apply for this slip to happen. Then by adjusting the number of top and bottom layers, along with number of perimiters I got the torque to be somewhere around 4 in. pounds.  With this value I appear to be getting more consistant readings than I hade before, and have a handy stylus for the touch screen.  It also makes it easier to get the cables on and off than just using my fingers.

My settings for the print is for PLA filament.  Three perimiters (wall line count), four top and bottom layers, and 40% infill.
The .stl file is located at.  
https://www.dropbox.com/sh/qt816x30fujt3kl/AABbUj5DdeNC5n3VE0RyJD9ra?dl=0

Not sure how long these wrenches will last, but only take 15 minutes to print and use about 3 grams of filament.




Wednesday, January 29, 2020

HackRF One case

When I first started working on a Spectrum Analyzer design I needed some way to check the sweep ranges of the local oscillator, and output of stages.  Since some of these were in the 100s of MHz., my oscilloscope would not be enough, and my frequency counter could not follow the frequency when doing a sweep.   I had used one of the inexpensive RTl_SDR dongles before, and they had worked fairly well.  I recently saw an ad for a 'HackRF One' on AliExpress with a TCXO for under $70.  This unit covers from 1MHz. to 6GHz., can do 20 Million Samples per Second, and can be used as a transmitter as well as receiver.  I have seen it available bundled with a selection of antennas, accessories  and in a case for over $300.  


 Delivery time was only about two weeks. Looking at the board I was impressed with the quality. and I liked the fact that it used SMA connectors for the antenna, and oscillator in and out connectors.

The one from AliExpress was the board only, so I would need to make a case for it.  After some quick measurements, I modified one of my standard case designs to fit.  
 I decided to use a one piece design with guide slots for the circuit board.  I have found this to be very solid, and makes mounting circuit boards very easy.  I printed it using some Carbon Fiber filled filament I had on hand.  Don't think the Carbon Fiber pieces in the filament are long enough to do any shielding, but it sure looks nice.  


 Next I designed and printed a front and back for the case.  After putting it all together it makes a very nice looking unit.  A little taller than the ones I have seen with  some of the complete units, but still a very nice case that will give good protection to the board. Still in the process of trying several of the different SDR software packages that support the HackRF.  Will write up something on them a little later.

For anyone interested, I have the .stl files available at
https://www.dropbox.com/sh/gi3tbny3le8hhhx/AAAJN17G9Nq0jLIntIF3wk88a?dl=0

Meanwhile still waiting on some of the parts needed for the 'TinySA' to arrive.  I think the Chinese holiday delayed everything. 



Monday, January 20, 2020

Small update to the Step Attenuator

When I first built the step attenuator,  I wanted it to check  linearity of amplifier stages.  I only needed a relative change in the insertion loss of the attenuator.  Recntly I was able to use my NanoVNA to measure the actual insertion loss across the total frequency range I am interested in.  I also received some questions about showing the actual insertion loss instead of the relative value,

Because of this I made a change to the code to switch the display value from relative to actual by a long press of the encoder knob.


       
 First I added some definitions and variables

float InsertionLoss = 2.6;  //insertion loss of attenuator at 0 dB 
int InLossMode  = 0;       // actual insertion loss or relative
#define ActualLoss  0   // display  value selected actual +                                  //insertion loss 
#define RelLoss     1   // display just value                                                //selected without insertion loss

The code to read the button push was modified to also check for a long press if you want to change display mode to show the actual insertion loss.
  // check button for display mode and step size
  read_btn();
  if (button) {
    if (button == SHORT_PRESS ) { //  toggle step size
      if (AttenStep == 1) AttenStep = 10;
      else AttenStep = 1;
      button = 0;
    }
    else {         // toggle insertion loss display type
      if (InLossMode == ActualLoss) InLossMode = RelLoss ;
      else InLossMode = ActualLoss;
      button = 0;
    }
  }

The display routine was modified to show th display value depnding on the InLossMode variable,

  if (InLossMode == ActualLoss) {    // show actual insertion loss
    display.setTextSize(1);
    display.setCursor(20, 15);
    display.print("Actual  ");       // indicate type 
    display.setTextSize(3);
    display.setCursor(10, 30);       // clear last value
    display.print("       ");
    // update display
    display.setCursor(10, 30);
    display.print( (AttenValue + InsertionLoss), 1) ; 
  }
  else {
    display.setTextSize(1);        // show relative value
    display.setCursor(20, 15);
    display.print("Relative ");    // indicate type 
    display.setTextSize(3);
    display.setCursor(10, 30);
    display.print("       ");      // clear last value
    // update display
    display.setCursor(10, 30);
    display.print( AttenValue, 1);
  }
  // display "dB." 
  display.print( " ");
  display.setTextSize(2);
  display.setCursor(80, 38);
  display.print( " dB.");
  display.display();


Updated code is available at 
https://www.dropbox.com/sh/lwy52lqi0g0ms7g/AAChK1tqW8M4hmUUf_dutwP2a?dl=0


        

Wednesday, January 15, 2020

Starting on a Tiny Spectrum Analyzer

I have been playing with building a simple spectrum analyzer for a couple years now.  I have tried several different versions, and have ran into similar problems with all of them.  For what I want I need several different resolution bandwidth settings. For more than two band-widths  the overall complexity becomes greatly increased. I have tried several different approaches, but have not been happy with anything I tried.  I had joined the Homebrew Test Equipment group on Groups.io ( https://groups.io/g/HBTE) , when it started.  Recently there has been a series of posts on a Tiny SA that has most of the features I would like to have.  It has a interface to a PC application for control and display.  I plan on adding a TFT dispalay to make it a stand alone instrument.  I have several STM-32 'Blue Pill' modules that I purchased a year ago. I think one of them should work well for this project.

This SA uses a pair of inexpensive SI4432 wireless ISM transceiver modules.  For use in a SA the important features of the SI4432 transceier is a frequency range of 240 to 940 MHz. at up to 20dBm output, variable receive bandwidth using DSP technology, and a Receive Signal Strenth Indicator signal with  .5 dBm. resolution down to about - 120 dBm. Complete modules with all the support components needed are available for less than $5 through the normal sources.

There are two different filters in the SA that I needed to design for a circuit board.  The first is the input low pass filter.  I decided a range of up to about 200 MHz. should be more than adequate for what I need.  My favorite design tool for filters is Elsie, with it  I can quickly design various types of filters, and tune the circuit to use standard value components.

For the low pass I decided on a 7th. order capacitor input filter. Playing with the program and values I have on hand, I came up with this circuit.

 This should give a frequency response similar to this, depending on the actual components used.

I had some circuit boards made by one of the Chinese board houses and, built and tested the LPF.  I used some SMD capacitors I had on hand from an assortment I purchsed a while ago.  Using a online calculor I designed and wound some air core inductors that are close to the values needed. (http://www.circuits.dk/calculator_single_layer_aircore.htm )
   I used some 24 guage silver plated wire wound around a 3mm. screw as a form.  Four turns for the first inductor and five turns for the other two. 
 Connecting the circuit to the NanoVNA using one temporary SMA connector, and with a little reforming of the coils I was able to come up with  a filter with the following response.


I had to settle for a little bit lower cutoff frequency than the original design to reduce the passband ripple but will be fine for the frequency range I want.  It also gives me the option of using a 315 MHz. first IF frequency if I want to try instead of the 432 MHz. in the original Tiny SA.
The next filter I need to build and test is the first  IF bandpass filter,
This will use a pair of  432 MHz. SAW filters.