06/02/2018 at 14:02 •
This project has been silent for quite a while now but it is not due to lack of interest. I just don't have as much free time as I used to.
I'm not sure if this is appropriate as a new log entry on the old SNA project or if it should be its own new project as it's undergone some pretty drastic changes!
FIrst off, here is a shot of the new version of the board:
The keen observer will note several changes:
- It's tiny -- the new board measures about 40mm X 40mm.
- I moved from a DDS sine wave generator to a Si5351 clock generator as the source.
- It's not an Arduino shield -- the processor is now an STM32F042K6T6.
So a bit about the new design. I have wanted to learn about embedded USB devices so I ripped off the bandaid and forced myself to learn how to make one by giving this board no other connectivity. (That being said, I haven't actually gotten this communicating over USB yet...) The microcontroller is the second cheapest ST part that has USB built in (there is a cheaper package of the STM32F042 with 20 pins but I2C and USB use the same pins and therefore cannot be used concurrently) and costs around $2.50 in single quantity.
I jumped to the Si5351 as my signal generator because I wanted to see if it would work. It is much cheaper than the DDS chips (about $1 vs $20) and contains three outputs. It is also capable of outputting between ~10 KHz and 200 MHz. Since it has multiple outputs, I chose to use two of them. As seen in the picture, they are both running through zero ohm jumpers into a switch but there are pads placed to populate a filter or an attenuator on each output. The output of the Si5351 is 50 ohms so that is convenient for RF work. It's referenced off of a TCXO running at 27 MHz so it should have decent frequency stability. Coincidentally, this also feeds the microcontroller and can be used to spin the PLL up to 48 MHz (divide by 9, multiply by 16) -- perfect to drive USB!
The detector is still the AD8307. Since the board is powered via USB which is regulated down to 3.3V, the amp between the AD8307 and the microcontroller ADC is now just a buffer, no extra gain, so as to not saturate the ADC.
Overall, I think this could be a great little board but I won't know until I get some USB communications implemented. I did some basic testing with the multimeter and proved that everything was at the correct DC voltages and then put together a blinky program using ARMs online editor/compiler thing (Note -- if you care about code size or speed, don't use that. A simple LED blinking program produced a binary file over 10KB in size!) so I know the board works. Now just to program it...
08/17/2016 at 14:50 •
After using this a bit, it works decently well but there are some areas that could use improvement:
- The software can use some general polishing, most likely adding a state machine to avoid the error where decreasing the sweep size basically causes a seg fault.
- The two transistor amp could probably use some rework. A high speed op-amp may be more suitable. Just be wary of the DC biasing...
- I don't remember which specific inductors and capacitors I selected for the filter, but 72 MHz might be beyond their self resonant frequency. That's something I should have checked before ordering/soldering them.
All in all, I am quite pleased with how this works. It's a phenomenal tool for measuring crystals for selection/characterization for use in crystal ladder filters. I haven't tested it with amplifier circuits or other frequency selective things but I suspect that below 30 MHz it's great and over any 1-2 MHz bandwidth it is quite flat. It's only when the response is taken from 1-72 MHz that you see the lack of flatness, but it's still quite usable (especially since I added the calibration feature)!
03/09/2016 at 01:03 •
I uploaded the Gerber files for the project as well as the KiCad files. I wasn't sure how to get the KiCad project in there so I just zipped up everything that was in my KiCad project directory.
If there is a better way to post the KiCad files, I'm all ears (eyes...?).
03/05/2016 at 20:50 •
The inspiration for this software came from Alexander Frank (http://www.changpuak.ch/electronics/Arduino-Shield-TOBI.php) who got it from Rich Heslip (http://rheslip.blogspot.com/2015/08/the-simple-scalar-network-analyser.html) who got his from PA2OHH (http://www.qsl.net/pa2ohh/11sa.htm). I made some pretty substantial modifications and in fact started over at one point but it's not my original idea so that's the history as best I know it.
I wrote it in Python 3 (using Anaconda, which contained most of the packages, except PySerial, which I had to download separately) . Here is a screenshot from my Network Analyzer running:There is no option to select a port when it's running, you just have to know the port of your Arduino, edit the port name in the python file, then run the program.
Also, if you decrease the samples there's a chance it will stop running due to an array index out of bounds error.
All the controls are self-explanatory, I believe, with the exception of "Calibrate". When you click on Calibrate, it will complete a sweep at the current settings and save that trace as a reference. Ideally, this is done when you directly connect output to input. Then once the reference is created, connect the device under test to get a relative power reading. It moves out of relative mode back to absolute mode when either the frequency settings are changed or the number of samples per sweep are changed.
There are some magic numbers in the code where it converts from the ADC readings to power levels. I roughly calibrated the power detector by using my oscilloscope to observe the peak-to-peak voltage of the signal at the detector inputs, then converted those to dBm. I adjusted the potentiometer to lower the signal strength and made another observation. I plugged the readings into a spreadsheet and then did a best fit line to get the equation. That's where the magic numbers came from.
On the Arduino, the code is very simple. It parses a serial input for commands. If there is a number between 1 and 72,000,000, it sets the output frequency to that number. If it's anything else, it takes a power reading.
When taking a power reading, it reads the ADC 16 times, adds the conversion results together, then bit shifts right twice. This oversampling and decimating does two things: it averages out noise and it effectively adds two more bits to the converter (going from 10 bits to 12).
The sweep moves relatively quickly until the number of samples per sweep move up to 500 and 1000. At 1000 samples per sweep, it takes about 4 seconds to sweep the whole frequency range.
Here is a sweep of a 10MHz crystal on the Network Analyzer:
And here is a narrower sweep of the same crystal:
Look for the full Python and Arduino code in the files section.
03/05/2016 at 18:38 •
There are several similar designs out there (most notably Alexander Frank's: http://www.changpuak.ch/electronics/Arduino-Shield-TOBI.php) which I only found after having designed my shield.
The AD9851 takes in a 30MHz reference clock which it multiplies by 6 to get its internal 180MHz clock. It takes I2C commands to control it's output frequency. It's a current output whose maximum current is set by a resistor. I went with a 3.92k resistor to give a max current of 10mA. My sine wave is then centered at 5mA and swings from 0-10mA.
I needed to filter out the aliased signal (basically 180MHz-desired output frequency) so I used a 7th order Butterworth LPF (because a flat passband is important here). I designed it for an input and output impedance of 100 Ohms. This way, the DDS sees essentially two 100 Ohm resistors in parallel (input and output resistors) giving a 50 Ohm impedance and converting my 0-10mA current into a 0-0.5V voltage swing. I was aiming for an output of 0dBm which is a 0.632V swing so I was a little short. I also wanted a buffer so that the DDS wasn't directly driving the output/load.
Enter the two transistor amplifier. It's a common emitter followed by a common collector with feedback. The design came for this came from Rich Heslip (http://rheslip.blogspot.com/2015/08/the-simple-scalar-network-analyser.html).
The schematic of my DDS/Filter/Amplifier is shown below:I added the 1K potentiometer to give some control to the output signal level. Turned up to 1K, the output is very small as it basically works as a voltage divider (it appears in series with the amplifier input impedance which is about 70ish Ohms). Turned down to zero, you get horrible distortion as the amplifier goes into saturation. In between though, you can finely tune the pot to give a nice 0dBm output sine wave.
The input goes straight to a 51 Ohm resistor (no input filtering) to provide a broadband match. This means that the power detector is more sensitive to noise and such but also means it can be used as a power detector up to 500MHz. The output of the Analog Devices AD8307 (logarithmic power detector) goes to an Op Amp. This buffers the signal before it goes into the Arduino's ADC and also multiplies it by 2 so more of the ADC's range is utilized.
Look for the complete schematic on the main project page in the files section.
I made the circuit on a four-layer board. RF traces run on the top layer and the I2C signals run almost entirely on the bottom layer. The board was made by Elecrow.
Elecrow did a great job and even though I only ordered five boards, they shipped me nine. All had been tested (I could see the probe marks on the pads). I think it was ~$25 for the boards and I paid the $20 for 3 day shipping (otherwise, it would literally take the slow boat from China). For around $50, I had nine four-layer boards that were 5cm x 5cm in my hands nine days after I clicked the button to submit my order.