Saturday, July 18, 2015

Si570 revisited - flexible Arduino controller


Back in 2009, I did a blog post about my then new Si570 synthesizer board being controlled by my then new Arduino MCU board.  I got a surprising number of requests for my source code, which was a little embarrassing because my programs mainly sent pre-calculated register values to the Si570 to program discrete frequencies.  At best, one program used the "ratio" method to tune plus or minus 30 kHz or so from the programmed center frequency, as is allowed by the chip design.

I wanted to do an "any frequency, right now" control scheme, but doing that on the Si570 is much more difficult than it is on the AD9850 family of DDS synthesizers.  The Si570 uses one 3-bit divider register, one 7-bit divider register  and one 38-bit divider register plus the crystal frequency to program its output.  And it's not deterministic -- multiple sets of register values will work and many others will not work, in accordance with rules defined in the data sheet.  Whew!  It's fairly simple to crank out a set of registers for a given frequency "off line" and send them to the chip.  It's quite another thing do to it in real time as fast as you normally turn a rotary encoder knob.

A new Arduino Si570 control program

The best way to approach a programming problem is to find someone who has solved it before.  Craig Johnson AA0ZZ did a very nice Si570 control program for the PIC16F88 MCU and described it in a July/August 2011 QEX article. His is all done in assembly language. The methodology is very important to the solution.  Craig found sets of two of the three registers that would work in each of 24 "bands" from 10 MHz to 157 MHz and saved them in tables.  The actual crystal reference frequency (see "Calibration") was used with those register values to  create another band table of pre-calculated constants.  Now, much of the heavy number crunching needed for a frequency change is already done, although there is plenty of 64 bit integer math left that must be done efficiently for each frequency change.

Anyway, using Craig's article, the data sheet, and my HP48G calculator, I was able to eventually grasp all the nuances and program an Arduino Nano to do essentially the same task: Take a frequency as input, generate the six registers required and send them to the Si570 board via the I2C bus.

My program right now

I decided to put on the brakes at the point where I have all the Si570 control routines working, but before I began to "personalize" the program with menus, LCD display, rotary encoder control and so on.  I'll add those things and publish the source shortly (?), but I want to put out the basic "kernel" of functions right now for readers who are programmers and want to add their own bells and whistles and user interface schemes.

Right now the program is functioning in a "demo mode".  It does a calibration, then goes to 14.025 MHz and tunes up and down in ten 10 Hz steps forever.  That's so a user can hear that it is working (changing frequency) without having to tune the receiver to follow it.

Routines in place are the all important one that accepts a frequency to 1 Hz resolution, calculates the registers, and send them to the Si570.  Also included are step size functions and step-up and step-down functions.

Invisible to the user but important are functions to detect band change (so the correct values will be selected from the band data tables) and to detect movement more than 3500 PPM plus or minus the last center frequency.  When this happens, the Si570 requires a "freeze" operation to load a new "center" frequency.  This is all automated in the software.

Also in the program are some serial routines to allow it to talk to the PC via the Serial Monitor in the Arduino IDE.  That's mostly for troubleshooting and development so you could delete all the serial stuff and save some memory.

Currently, the calibrate() routine sends a bunch of information to the user over the serial link.  After uploading the program, press control-shift-M to open the serial monitor and see start-up registers, crystal frequency and so on.

Calibration

This is not like the calibration you are accustomed to with AD98xx synthesizers where you calibrate to an external standard. Silicon Labs custom calibrated your Si570 at the factory and stored values in all the registers to cause it to start up on the frequency specified at purchase time.  This is to correct for expected small variations in the 114.285 MHz internal crystal reference.

So when the Arduino does its calibration, it is expected to "know" the specified start-up frequency.  Then it downloads the register values programmed into non-volatile memory by Silicon Labs and uses those to "back calculate" the actual value of the reference crystal, which is then used to generate the constants in the band tables.

My software currently calibrates every time it starts up.  Craig's software does it if you hold in a button when powering the PIC up. I can see why you might want it to be "dealer's choice" so I will make it an option in my full featured version.

Some hardware notes

Connection between the Arduino and Si570 is pretty simple - two wires plus ground.  But it can't be quite that simple if you have a 3.3 V Si570 and 5 V Arduino.  You need bi-directional logic level shifters between the two. I used two BS170 MOSFETs plus two resistors as Craig showed in his article.  You can get the same on a tiny board from eBay if you want to go that way.

Another hardware issue I encountered was unexpected - RFI.  When I first tried the program with the hardware, I got a lot of errors in I2C transmissions.  When I plugged the RF output from the Si570 into a power meter with 50 ohm input, most of it went away.  So it seems that reflections from the output can cause problems - terminate your RF output!  I also added a 4.7 uF tantalum capacitor from my 3.3 volt reference on the MOSFET shifters to ground. That may have helped a bit.

I'm getting out about +14 dBm, BTW.  That's a lot of RF and I'm glad to have it.

Speaking of hardware issues, the Si570 is a pretty clean RF source with low phase noise.  Generally better than most AD98xx units and better than the new Si5351 part, although I have and use both of those.

Another hardware caveat:  I've been burned a couple of times by inaccurate Arduino Nano documentation.  This time I spent half a day troubleshooting I2C communications before finding that SDA and SCL are actually on pins A4 and A5, not D4 and D5 as shown on some drawings.

What about that startup frequency?  That's important to the calibration.  I lot of Si570 boards out there were bought with the Sotfrock project in mind.  In those circuits, the VFO operates at 4x the operating frequency and a lot of Si570s were purchased with a startup frequency of 14.080 MHz in mind, meaning they start up at 56.320 MHz.  Mine is one of those.  Others, possibly taking the default start-up frequency, may start up at 10.000 MHz.  If you don't know, power up your Si570 and check it with a frequency counter.  If it's other than 56.320 (or thereabouts), change this line in the source code to suit:

  #define STARTUP_FREQ 56320000UL

Finally, where do you get those Si570s mounted on a plug-in board?  I see several people (mostly hams) on the web offering them.  Mine was made by WA6UFQ. You might start your search from a Softrock site.

Regarding power the Si570 ... It uses more than 100 mA so don't use a 78L05 regulator and I wouldn't try to have the Arduino supply the power either. I used a 78M05 with a small heat sink.  it's rated at 500 mA. Why am I talking about 5 V regulators? My Si570 board has a 3.3 V regulator on it and wants 5 V to the board.

Let's wrap it up

Where's the source code?

Right here:

http://pages.suddenlink.net/wa5bdu/Si570_New.ino

I won't be revising this file except to fix any errors that may be lurking in it.  Later I hope to add a link to a version with LCD, rotary encoder and so forth.

Here's a link to Craig Johnson's page, which includes the QEX article:

http://www.aa0zz.com/

If you don't want to fight through creating an Arduino based controller, Craig's PIC based card works very well and allows LCD, rotary controller and so forth.  (I have one.)

73-

Nick, WA5BDU

kennnick@gmail.com



Wednesday, April 22, 2015

Q - steel wire at RF

Some discussions we had on the QRP-L list March 4 through 13th of 2015 on the subject of RF resistance of steel conductors merged in well with my recent attempts to improve my ability to measure coil Q.

In order to compare copper with steel and also Copperweld, I'd need to wind some coils that were physically identical and test them.  I have a ceramic form I picked up at Dayton last year, which has grooves for the conductor, assuring constant spacing and diameter.  I also need to have the same diameter and type (solid conductor) samples for a good comparison.

Below is my coil with ten turns on it, bright steel #18 bare wire:


And below is the same coil with #18 solid copper, insulated:


OK, I'll skip photos of the other two since they all look the same.

You see my shunt measurement "fixture" (BNC tee with receptacle on 3rd port) and a silver mica capacitor chosen to resonate in the vicinity of 7 MHz.

I had two kinds of iron or steel wire, one bright and shiny and the other dark in color.  The shiny one may have been galvanized but I doubt it.  I used the dark one as well because I'm sure it's not coated in any way.  However, it was a standard increment smaller in diameter.

I also wound one coil with #18 Copperweld.  I was glad to have that form because that stuff is super springy and fights you every step of the way.  I probably got this piece from Burstein-Applebee back in the 60s:


Wow, 250 feet for $1.89!  That's a lot of dipoles.

Results:

In the table below I list the results for each sample.  The coils took about 8 feet of wire, so I extrapolated the effective resistance out to 100 feet.  I also show the ratio of RF resistance for each sample to that of copper.



What should we make of this?  Well, I'd say iron or steel conductors aren't good for antennas (especially long ones) or inductors.  (Unless "broadband" is your thing.)  We probably already knew that.  

One thing that kicked off this study was data from a web site showing huge RF resistances for steel.  The calculations were based on skin effect and the effect of permeability in making the skin depth very thin.  I wondered if the permeability of these materials remained high even at RF.

Interpolating from the data on the web site, the ratio of steel to copper RF resistance at ~7 MHz is 33.3.  I got ratios of 13 and 15.  So, somewhat less but still pretty damning for steel conductors at RF.

What about Copperweld?  One alarming potential outcome of RF resistance being primarily determined by permeability was that the skin layer of Copperweld might be very thin as well, resulting in high RF resistance, despite the copper cladding.  This didn't turn out to be the case, with Qs almost equal to copper and RF resistance only 24% higher for Copperweld.

Another observation ... with the steel samples the inductances I measured with my AADE meter were 10% or so more than values calculated from the resonant frequency with a known capacitor.  No doubt this is due to the low measurement frequency of the AADE.

I was a bit surprised that the darker steel (iron) wire had about the same Q as the bright shiny wire did, despite having a smaller diameter.  Maybe the bright stuff was alloyed with something that raised its resistivity as happens with stainless.  I don't think this wire would be classified as stainless though.

Error Factors:

I don't know the composition of either of my steel or iron samples.  (I called the dark colored one "iron" just to differentiate the two.) Both strongly attracted a magnet.

I think my Q measurement methods are reasonably accurate these days.  But this isn't NBS work by any means - just the efforts of an amateur experimenter.

It would have been useful if I'd measured the DC resistance of the samples, but I wasn't geared up at the moment for accurate small resistance measurements.

Nick, WA5BDU
4/21/2015

Links:

http://ve3efc.ca/wire_ohms.html

http://www.g3ynh.info/zdocs/comps/part_1.html

Wednesday, April 8, 2015

Q measurements with shunt fixture

In the previous post I discussed both shunt and series connected unknown circuits and formulas for each, but the results I showed were only for my 1-ohm fixture and series connected unknowns.

Here I'm showing some results for shunt connected unknowns.  BTW, in both cases the unknown is a series connected L-C circuit.

Recall that I discovered that my 1-ohm fixture had enough loop reactance (from inductance) to affect the measurement significantly, but in the series configuration it could be calibrated out.  For the shunt case it wasn't so simple. So the "fixture" for shunt measurements needed to minimize the loop created by connection of the unknown.  The simplest seemed to be just a BNC Tee with a BNC receptacle connected to the open end.


The two female ports go to the PHSNA DDS and the AD8307 measurement circuit.

I made some measurements with the type 2 and type 7 toroids again and with the molded choke, and I also added a couple of air wound B&W type coils - one small and one quite a bit larger.  In all cases I selected resonating silver mica capacitors to give resonance around 7.5 to 8.5 MHz.  Just for consistency and to be somewhat "midband HF".  I also added series resistances in several instances, to see if my measured Rx would increase by the amount I added, as a method of checking accuracy.

BTW, there are no transformers or minimum loss pads here, so this is a 50 ohm environment.

Below are some results from my spreadsheet.


If the data table doesn't fit the column, click it to make it full size.

I feel like I'm getting pretty decent results here, consistent with my expectations.  

BTW, elsewhere in my spreadsheet I enter my dBm measurement with the unknown port open and again with the unknown network connected to give me the attenuation caused by the unknown.  I also enter the environment resistance (50 ohms), and it gives me Rx, the series resistance of the network, presumed to belong mainly to the inductor.  

I also enter the measured inductance of the coil and the resonant frequency and my spreadsheet gives me the Q of the circuit.

NRK 4/8/2015


Wednesday, April 1, 2015

Q measurement with PHSNA

[Edit #1:  Some of my images (graphs & schematics) shrunk to fit the column width.  Just click on images that seem to be truncated to see them full sized.]

Measuring Q is an interesting challenge.  With the PHSNA (a DDS calibrated source plus AD8307 RF power measurement instrument plus analysis software), it seems like it should be a piece of cake.  I'm already doing it with crystals, after all.

But then I remember that Qs of 100 to 200 or more, even with toroids, aren't unusual, and inductors with reactances in the 50 to 200 ohm range are common in RF / HF designs. Do the math and you see that we may be measuring fractional ohm loss resistances.  A bit of a challenge in a 50 ohm system.

One way to increase sensitivity is to put the component being tested in a lower resistance fixture, for example, 12.5 Ω is typical for crystals.  Going to extremes, a 1 Ω fixture does a lot.  A problem is that two 50 to 1 Ω minimum loss pads back to back have a combined attenuation of 45.9 dB.  So we need a strong source or sensitive detector or both. My PHSNA system has about 0 dBm RF output and the detector should go down to say, -60 dBm without much trouble.  So I probably don't need an amplifier in line.

I also got into looking at Q measurement methods in EMRFD (page 7.36).  Typically, one puts a series resonant circuit for which Q is desired in series between the source and detector.  In this example, the test circuit is put in the shunt configuration between source and detector.  I wondered how that differs in sensitivity form the series method.  So the first thing I did was do the math to solve for loss resistance in both configurations.


I derived the formula in general terms for source (and detector) resistance Rs instead of just for 1 Ω.  Rx is the value of the loss in the coil (or coil + capacitor).  For attenuation A, I get:



The ultimate purpose of this exercise though is to find Rx.  So solving the above for Rx for the shunt configuration:



The procedure is to measure power to the detector without the tested circuit installed, then measure it again with it installed in shunt (to ground, between source and detector).  'A' is the dB difference in the two measurements and here is it is a negative value.

To compare this method with the series method, I need to derive the equations for that configuration.

Series configuration:


and solving for Rx:


I was somewhat surprised when this result didn't look like the equation I've been using for crystal Rloss measurements. I finally realized it was because my math began with attenuation as a negative number but the other equation entered it as positive.  So they are equivalent.
I put the equations into an Excel spreadsheet and plotted the attenuation A against Rx for both configurations.  My thought is that the method that produces the greatest change in A per ohm change in loss resistance is the more sensitive.

Below:
1 Ω test fixture
Rx on horizontal axis
dB attenuation on vertical axis


From the above, the series method seems better for "all around" measurements, but the shunt method looks like it would be better for high Q / low loss resistance items.  In a one ohm environment.

I repeated the above plot for a 12.5 ohm fixture and again for a 50 ohm fixture and present results below:

12.5 Ω test fixture
Rx on horizontal axis
dB attenuation on vertical axis

Above, the series configuration gives a fairly constant slope of about 0.3 dB per ohm.  The shunt configuration gives much better sensitivity, up to the source resistance of 12.5 Ω which is the crossover point again.

Finally for the 50 ohm fixture case:
Below:
50 Ω test fixture
Rx on horizontal axis
dB attenuation on vertical axis


(Above) Again the change per ohm with the series method is constant but it’s down to 0.08 dB/Ω.  With the series method, much more sensitivity is achieved with about 8 dB/Ω at 1 Ω, decreasing to 0.36 dB/Ω at 15 Ω.  It's clear that with higher source / detector resistances, the shunt method is better.
It just occurred to me that if you already have a 50/50 system, by using the shunt method you don't have to go to the trouble of building a lower resistance jig.  So EMRFD rules again.
Some practical results:
I wanted to go with the 1 ohm fixture first.  Below is a schematic of one I got from Bill Carver, W7AAZ.  It uses SMT precision resistors from Mouser. Also shown is a 3 dB attenuator.  Cut off at the right is matching to the HYCAS amplifier.  Bill was showing me how to use it to measure crystal parameters.

And below, we have it in physical form:


An unexpected problem!

I did some series method measurements with the tested item installed (as shown) and with a short across the two alligator clips.  What a shock to find, in some cases, more power measured through the tested device than with the short. Negative attenuation!

This baffled me for a while but I began to suspect the inductance of the loop formed by the two alligator clips and the shorting wire between them.  I measured the attenuation of a loop about that size on my AADE L/C meter and get somewhere between 0.045 and 0.075 uH.  At 8.2 MHz, that’s 2.5 to 3 Ω of reactance.  And in a 1 Ω environment, that’s significant.  Using LTSpice, it seems to add about 7 dB attenuation over a “real” short.

But when I have my series L/C circuit under test installed, the small loop inductance gets absorbed into my test coil’s inductance and cancelled when I find the resonant peak.  That’s why the circuit under test actually has a higher power value than the so-called shorted fixture.
I saw a couple of ways around this.  One was to resonate out the stray inductance when I did my "shorted fixture" measurements.  It's best to do this reasonably close to the measurement frequency, so I needed about 5800 pF.  That worked -- I was able to see the peak and measure available power with strays cancelled out.
Another method would be to assume the calculated 45.89 dB attenuation of the fixture is accurate, measure power with source plugged right into detector, and take 45.89 dB off of that for my "shorted fixture" power.  The method of resonating out strays seemed to give slightly better accuracy.
Oh, I did use a lowpass filter following the generator.  The DDS-60 is pretty well filtered, but notes on measuring Q emphasize the need for very good harmonic suppression.
Now some measurements.  I had a couple of iron power toroids wound with turns as noted.  One was a T68-7 and the other a T50-2.  I measured inductance with my AADE meter and chose a resonating capacitor (silver mica) to resonate at something over 8 MHz.
I made a measurement of the L/C resonant circuit and a second one with some series resistance added, to see if the delta came out close to the resistor value.  I also tested a type 61 toroid and a miniature molded choke, just to do some samples with lower anticipated Q.  I plug the attenuation and source resistance values as well as inductance and frequency into an Excel spreadsheet and have it crank out loss resistance Rx and Q.


The method is  to measure the shorted fixture power as discussed above, then hook up the test specimen and do a response sweep with PHSNA.  It finds peak and minimum values.  In this case, I want the peak.  I take a peek at the plot just to make sure it's not a "false peak".  Take the difference of the two dBm readings to get dB attenuation.
So I think my accuracy is probably decent, but could be improved.  That may be my next post.
What about the shunt method?
I decided not to try that with the fixture I have now, because dealing with the stray inductance is not so simple.  It will not be absorbed into the test specimen's inductance but instead will combine with it in a more complex way.  Probably making another fixture with minimal strays is a good solution. Also, based on the graphs, the 50 ohm method might be the best overall for the shunt method.
Notes:
EMRFD is the ARRL book Experimental Methods in RF Design
PHSNA can be found at:
https://groups.yahoo.com/neo/groups/PHSNA/info
... and in an article in the spring 2014 QRP Quarterly magazine.
Nick / WA5BDU
4/1/2015