Saturday, April 15, 2017

The SA becomes the SNA jr.V.3 for now UPDATE 4-17

I have been working on the Spectrum Analyzer, and had hoped to get it done in time for the FDIM  'homebrew' contest. Between wrong parts shipped , or not arriving in time, along with software problems it did not look like I could get it finished in time. So on to plan B.  I have gotten great response for the SNA Jr version 2, and even quite a few from people who have built their own version.  The most common requests for changes, are a larger screen, and higher frequency coverage.  I have the nice 2.8" screen and basic display routines from the SA, and I still have a couple Adafruit si5351 modules left from several other projects. The si5351 would give me frequency coverage to over the 2 meter band, but it has a square wave output.  From early experience in a simple K6BEZ style antenna analyzer I built a couple years ago, I had found problems with harmonics from the square waves. 

Looking around the web, I saw some information on an antenna analyzer by IW2NDH.  It used two clocks on the si5351, one at the test frequency, and the second offset by the frequency of a simple crystal filter.  This second clock is fed to a mixer, and the output goes through a crystal filter before being measured by an AD8307 LOG detector. This should remove the harmonic problems I had found with the earlier circuit.  It also had a built in directional coupler, instead of using an external RLB like I used with the SNA Jr II.  I made a few changes and came up with this block diagram.

Looking at the block diagram, I realized by just using the second clock, the mixer and crystal filter, it could also be used as a basic measurement receiver.  This might be adequate for measuring the harmonic output of a home brew transmitter.  

Basic functions to include
SNA  1 to 150 Mhz.
Antenna analyzer (SWR only)  1 to 150 Mhz.
Measurement Receiver  1 to 150 Mhz. there will probably be some unusable area around the IF frequency I select.

Since I still have some problems with some of the libraries for the stm32 board, I will go back to the old reliable Nano.  This will mean adding some level translation between the Nano and the display, and having a slower update on the screen.  But, I will live with that.  I added a couple of relays to change functions and to add a switched input attenuator.  I went with a 3 crystal filter, and added pads for several attenuators that I might need to properly terminate the filter and mixer stages.  I laid out and after a couple of tries I etched a single board that should do the job.  

The software is coming along nicely, I could use most of the display routines I had for the stm32 board, and also pulled in some of the code from the SNA Jr II.  Still going with the joystick instead of a rotary encoder for the input device,  It is much faster and easier to use than the encoder.

Here is a picture of the partially populated board being tested with just the display and si5351 connected.  Things looks fine so far, so I will probably have something for FDIM

UPDATE  4-17-17 

I had a little trouble getting the si5351 library to work after I copied some of my earlier code into this sketch.  The version I had been using is almost 2 years old, and the newer version has some major changes.  After making them most things looked OK except the frequency was off.  My frequency selecting code uses a resolution of 1 Hz., and after re-reading the documentation for the latest version of thesi5351.h file I saw that it has a resolution of  0.01 Hz. Just a quick multiply by 100 from the computed value to the value used to set the 5351 frequency took care of that. 

I needed to make a directional coupler, and used the instructions for making a VNA directional coupler at
Except for the number of turns through the core, this is basically the same as I used in my SWR/Power meter.  After building it, and installing on the PCB, I made some measurements to check how it worked.  
The small AD8307 power meter probe I built last year worked great for the job.   The difference function I added to the software made it very easy to check the coupling loss. I measured a  unloaded output level of around 12 dBm. in the center of the frequency range. Depending on frequency I measured around 15 - 18 dB. coupling loss from the through signal with no load,and around  40 - 44 with a 50 ohm load.  These values look usable, and probably are affected by the harmonics in the square wave, and possibly an impedance miss match on the input to the coupler.  I built in pads on the board for a small attenuator before the directional coupler.  I will solder in resistors for about 6 dB. and see if that makes a difference.
I checked the AD8307 log amp output with a voltmeter, and the values look very similar to what I found with other power meter circuits I have built.  Next to copy some of the code from the SN A Jr 2 software to get that working and do a simple sweep of the output of  the si5351.  Then to build the mixer/filter circuitry and test them

Wednesday, March 15, 2017

Spectrum Analyzer display and control board

I gave a lot of consideration to the size I wanted for the finished instrument, and designed and printed a first try at a partially 3D printed case.  It consists of printed sides with guides for the top and bottom , which will be made from circuit board material.  I also added a guide in center for most of the RF part of the S.A. The first thing I need to build is the control and display board.  This will have the STM32 board, the display, a AD8307 power meter, and a Adafruit Si5351 PLL board. This will first be used as a SNA to help in the alignment of the filters in the RF board as it is assembled.  I should be able to use much of the software from the SNA Jr., and later may be refined into a version 3 of the SNA Jr.

The board is double sided, with the top being mostly a ground plane.  I did some playing around with different methods of adding a solder mask to the board. I refined my earlier procedure using IR curable paint, and am very happy with the results I was able to obtain.   This will make it much easier when it comes to building the RF board, which will be some of the  tightest SMD layout I have ever tried.

After assembling the board, and doing a quick functionality test, most everything worked as expected. I did have to add a jumper on the board to bring 5 volts out to the Joystick, and found I will have to make a couple slight changes in positioning some of the connectors on the final board.  But, this will be adequate for testing, and writing the SNA software.
I cutout a opening for the display , and added a cutout for the Joystick in a piece of copper clad board.  Then mounted the board and display, and installed the assembly in the 3D printed case.
Looks like everything will fit, but may have to change some of the dimensions a little and reposition the guides for the RF circuit board.
Now to write the SNA software and do the layout for the RF board.
Shouldn't take too long, unless I spend too much time playing with the 3D printers.

Saturday, January 28, 2017

The problem with gettibg a 3D printer

When I first got my 3D printer, it was with the intention of making parts for my electronics projects. After I found an inexpensive 3D design package, and getting used to it, I was very pleased with what it could do.  Then I made a big mistake, I went to This is a huge repository of different 3D printed projects that have uploaded by3D Printer enthusiasts.  After browsing the projects, and a lot  "That's Neat" or "I should try printing that", I realized that I was hooked and now have another hobby.

My printer worked well for what I had wanted it for.  But since it used propriety software I was not able to change the settings to what I would require for some of the things I downloaded from Thingiverse.  While on one of a 3D printing Blogs I was following, I saw mention of a very small inexpensive printer by Monoprice.  
The Monoprice select mini, is a very small printer, but uses most open source slicers such as  "Cura" or "Slic3r".  It comes fully assembled and with a recent price reduction is less tan $200 including shipping.  That day I received an e-mail with a coupon that would bring the price down to around $185, so I ordered one.  It arrived in 3 days, and I quickly unpacked it.   The  machine is almost all metal, and appears to be very solid.  It came with a sample of filament that is too small to do much of anything, you will have to purchase a full spool to do anything useful. 
Using some filament from my other printer, I printed the sample print that came on the micro-SD card along with a couple different software packages.  The print turned out to be very high quality, much better than I had expected from such an inexpensive printer.  Also the printer is very quiet compared to some others I have seen.
Searching the Web I found a series of beginners guide to the printer and some help on initial setup of "Cura" for the machine.  Also found several useful items to print to make the printer a little nicer. 

 I printed up a filament guide and a couple other simple things to use with it.  This printer has a heated bed, so I could use a "PEI" plastic film to cover the print area.  This gives better adhesion to the print surface, and makes it easier to take finished parts off the bed than the blue printers tape that is usually used.
Printing 5  CW paddles at a time
Since I had full control of all the settings, I could use some of the different filaments that I could not use with the first printer. I could also change layer and print options to make some of the items I had designed stronger.  So far the only drawback to the printer I have found is its print volume.  It is only 120mm x 120mm x 120mm, but most thing I want to print will fit in this area.  This might mean that a print job that made 8 pieces at a time, I had to re do and could only print 5 at a time.  

I found a fairly active Facebook Group that covers this printer, and have been finding some useful information on possible modifications I will probably make in the near future.  All in all after less than  a week I am very happy with the little printer.  If someone wants to try 3D printing this would be a inexpensive option to try.
DARN now I have to find time for the electronics projects that are stacking up.

Monday, January 23, 2017

Back to working n the Spectrum Analyzer UPDATE 2/4/17

Now that the BITX is nearly finished, I decided to get back to the Spectrum Analyzer project.  I had did some work on the display and controller using a Arduino Mega and a  3.2" , 320 x 480 display.  It worked well, but was quite large, and the display covered most of the pins on the Mega.  I found a little smaller  2.8" .320 x 240 display that uses a SPI interface instead of a parallel interface.  I wired this up with a Teensy LC micro-controller and started writing some graphics routines.
I decided to keep the waveform display as 300 x 200 to give room for text and cursor values.  The 300 pixel width will work well to give overlapping display ranges in a 1,3,10,30 format.Since the overall range will be around 100 db, using 200 vertical pixels will make it easy to display wave-forms to a .5 dB resolution.
Because I want to have various sweep widths available, I will store the acquired data in a large integer array of 900 elements.  Using this format I can allocate data as one large sweep, or several smaller ones.  Then by designating the starting point in the array and number of points per sweep, I can store multiple sweeps in the same array.  The wave-form drawing routines will work the same way, specify starting point in the array and number of points to display.
 I will be using the same basic data format for storing the acquired data as in the SNA Jr.   The AD8307 log detector has around a 90 dB. dynamic range, and I want to have a 0.1 dB resolution.  I store the data as the dB. value times 10, so all the display routines can work on integer values.  Since I want to have several switched  10 dB attenuators in the system, this will make it very easy to correct the data values.  Just add or subtract 100 to the value to adjust up or down 10 dB. as attenuators are switched in or out.

video To test out the drawing routines, I initialized the array with a triangle wave with values equivalent to 0 to -100 dB.
Then in a loop I display several wave-forms based on that data. These wave-forms start at different points in the array, and display different sweep widths. I am very happy with the display speed I get using the 48MHz. 'Teensy LC', compared to what I had with the Nano in the SNA Jr.  Next to work on the basic controls and menu system.

UPDATE 2/4/17

Did a little work on  the waveform drawing routines to limit to waveforms to the 200 x 300 pixel drawing area.  I plan on using a cheap joystick for the input device instead of a rotary encoder.  Re-wrote a joystick routine I had been working on.  It reads the joystick pots and switch, then sets a flag if a change has occurred. 
It also sets some global variables with the values of these changes,
I use + or - 1 for horizontal and vertical movement depending on direction.  Also set values for either a short or long press of the push button.  I found this to give much faster and easier control than I had with a rotary encoder.
I had been using a 'Teensy'instead of the Arduino Mega that I had started with. I recently bought several cheap stm32 boards I purchased on eBay.  I wanted to see how this ~$3 board compared to a $13 'Teensy'. Speed at 72MHz. is more than adequate for my needs.  It has 8K of SRAM and 65K Flash memory, also enough for my needs.  I pulled out the 'Teensy' and wired in the stm32 board ( usually called the 'blue pill' on the stm32 blogs).  It is just a little bit larger than the Teensy, but brings out more I/O pins.  As they come, they do not have a Arduino compatible boot loader installed.  Programing must be done through a serial converter or a STlink programmer, about $3.  I used the STlink method, and found it very easy and fast.  I changed the Adafruit graphics driver to one modified for the STM processor.  Everything worked as well or better than with the 'Teensy'.  I wrote a little display test routine to scroll through the initialized data buffer.  Scrolling was very smooth with no flicker or hesitation.  By changing the increment I used to step through the data, I could change the rate of scrolling.

All in all I am very pleased with the results, and looks like I will be using the 'blue pill' instead of the 'Teensy' 

A picture of the bread-board using the 'blue pill' with the display running. The stm-32 'blue pill' is just a little bit bigger than the Nano  on the other side of the bread-board.    For about the same price and much more powerful, this might be my choice for any new projects.

Wednesday, December 14, 2016

Building the BITX 40 v 3 A SI5351 VFO update 1/22/17

Between getting ready for the Holidays and a couple things i need to do around the house, I have not been spending much time working on the BITX.  Except for the drift issues I still have not been able to get resolved, I am very happy with the performance so far.  The simple AGC seems to be working well, and makes listening much more comfortable.  I took a look at the output of the detector on the AGC board, and it looks like it will be usable for a signal strength meter.

With the drift problems, and desire to add a signal strength meter I decided to go ahead and build up a digital VFO. I have a 9850 module left from the SNA Jr.  and a couple  Adafruit SI5351 modules from earlier projects. I had ordered 2 of the BITX boards, and had planned on making the second one into a multi-band rig.  With this in mind I decided to go with the SI5351, because I could use a second clock in the multi-band version for side band selection.

Over a year ago I had built a 5351 based VFO for use with Frog Sounds 40 Meter CW transceiver.  I called it the Canned Frog, because I put it in a canned meat can.

I had used a separate clock for the receiver and transmitter LOs, so had about everything I needed in the board I had laid out for it.  This VFO used a Arduino Nano, and a small OLED display.  This will be fine for the single band version, but want a larger display when I get around the the multi-band version.  I used the basic layout I had, and brought out most of the Arduino pins for use with a different display, and other options I am thinking of adding.  When I did the original VFO. I found the regulator on the Nano got quite warm when running on 12 volts.  So, I added a 9 volt regulator to the board to keep the Nano cooler. 
I also changed most of the passive components on the board from leaded to SMD versions, that will be mounted on the back.  I have started to try to use SMD components where ever possible.  Drilling holes is the most tedious problem of making my circuit boards.  Only problem with home made PCBs and SMD components is watching out for solder bridges.  I have been playing around with UV curable solder mask, and have gotten the process down to something fairly easy with consistent results.  So after etching and tinning the board, I added a solder mask before drilling.   Everything looks very nice, now to build the board and modify the existing sketch to take care of a IF offset.

12/18/2016 board and software mostly finished

Finished getting most of the board populated except for the filter and attenuator circuits, and the basic software working.  Now I can try setting different levels and filter values on the board to see what values work best.    The software is basically what I had used for the 'Canned Frog', with the CW keyer and CW offsets, and RIT removed.  Since this used a direct conversion receiver, the signal output was on the transmit frequency. The BITX is a super-hetrodyne, and has a IF  frequency around 12M Hz. Therefore the VFO signal must run at a different frequency.   Because you are receiving the Lower Side Band  the exact frequency used is the BFO frequency. Basically the VFO frequency is the BFO frequency minus the operating frequency. 

 For the 7 Mhz. band this is around 4.7 Mhz. to 5 Mhz. The original software used the actual operating frequency for display and setting the si5351.  I measured the frequency of the BFO and used that value in computing the required VFO frequency. This value was used to set the si5351 clock 0 output.

After making the changes to the software, I ended up spending an hour or so trying to find out why the frequency was not changing when I turned the rotary encoder.  I finally looked at signals with a scope, I found I had a bad rotary encoder.  After changing that everything worked the way I expected it to.  

Update 1/2/17

I spent most of the holidays visiting relatives, and did not have much time to work on any of the projects I am working on.  I did bring my laptop along and had some timeto work on a BITX front panel that will work with the SI5351 VFO and Display.  The original front panel was designed to work with a small counter and had a grill opening for a small speaker.  After trying the BITX  receiver, I found that even with an AGC circuit added, the audio sounded much better with a larger external speaker.   This version has a built in bezel for the display, mounting posts for the circuit board. 
I also had to include a recess to provide room for the stacked Display and Adafruit SI5351 board.  To center the display, I had to move the microphone and volume control to the opposite side of the panel.  

 Update 1/22/17

I 3D printed the new design front panel and tested the VFO out when connected to the BITX board. I found some of the same kind of receiver noise I had at first with the frequency counter.  It looks like the BITX board  is very sensitive to any noise on the DC supply line.  I had a reverse polarity diode on the board, that I replaced with a 10MH. choke and added a 100 uF. capacitor across the input to the regulator on the board.  With this I could not hear any noise unless I turn the volume all the way up and disconnect the antenna. 

 The recess I put in the back of the front panel helps keep the display and si5351boards in position, along with reducing the overall depth in the case.

Just a little more work on the software to make sure the RIT is working correctly and possibly add a  S-Meter

Wednesday, November 30, 2016

Building the BITX 40 v 3, receiver portion

12/2/16   Added link to Eagle files for making AGC Board

A couple of things came up and I was delayed in building Farhan's SMD BITX 40.  With the availability and price point on the board, I decided I will stop work on the version I was designing and building.   I will instead spend my time on trying some modifications to enhance the board from Farhan.  
For those who are building with this board, there is a website devoted to different mods for it.

Since I haven't gotten around to build a si5351 VFO yet,  I installed a 10 turn tuning pot.  This made it much easier to tune, but I found there was quite a bit of drift during warm up.  Looking over the bitxhacks blog, one of the first mods I made was to change some of the resistor values in the bidirectional amplifiers.  Changing them from 100 to 220 ohms reduces current in those stages,  should reduce heating of that part of the circuit board.  I also coated the VFO coil with several coats of clear nail polish to prevent  coil winding movement.

Another change I made was to cut the short trace going from  switched 12 volt to the  U2 (VFO  9 volt regulator) input pin. Then I ran a wire from the input pin of U2 to un-switched 12 volts.  I also added a .1 uF capacitor from the regulator input pin to ground, and a 47uF and .1uF  from the output to ground.  This keeps the VFO circuit on at all times, and hopefully further reduces warm up drift. 
After all of this it is much better, but I still have some drift, up and down in frequency even after warm up.  Ordering some NPO capacitors to use in the VFO and will see if this helps.

With much of the drift problem solved, I next looked at the audio.  Since the BITX does not have AGC, having to adjust audio level when going from station to station can be aggravating.  Farhan posted a simple AGC circuit on the bitxhacks blog, and I decided to add it to mine.  

I took his hand drawn schematic, and input it
to Eagle and laid out a simple board that can be built as mostly SMD or Muppet style. 

After etching a couple boards, I built up one of each to give a try.  For the SMD version I also added a solder mask to make assembly easier.  Adding the AGC board to the BITX took care of leveling the audio, but the added circuitry reduced the audio level.  Replacing the 1 uF. capacitor from pins 1 - 8 of the LM386 with a 10uF. brought the gain back up to where it was.

Link to Eagle files and a .pdf with mirrored top layer image for making toner transfer boards.

Next to add the frequency counter.  With a little change to the gain on the counter pre-amp I had it reading correctly.  Using the setup function on the counter, I measured the BFO frequency, and set the counter mode to subtract the VFO for proper frequency display.  There was some noise introduced on the audio output.  A 220uF capacitor across the counter power supply leads, and a 10mH. choke in series with the positive  supply lead took care of that.

Except for a small amount of frequency drift the receiver portion of the BITX is working.  Now to wire up the microphone and test the  transmitter.  It is starting to look like a transceiver.

Saturday, November 19, 2016

Some nice words about the SNA Jr.

I have been following Paul M0XPD "Shack Nasties"  Blog for quite some time.  This year at FDIM, Paul gave one of the seminar presentations.  I was pleasantly surprised when he mentioned my early version of the SNA Jr. in his presentation.  Later, I had a chance to speak with him about some of our common interests and projects.  I also gave him one of the extra SNA Jr II boards I had had made.  
A week or so ago I received an e-mail from him with a picture of the SNA Jr. that  he had just finished building.  Today I saw that he had updated his blog with a very nice write up about the SNA Jr II.  I want to thank him for his kind words.
If you have not read his blog before, it is one you should follow.  I know I always find something interesting and informative in each post.