New to Microcontrollers: Giving a Crude Spectrum Analyzer Some Directions

Discussion in 'The Projects Forum' started by Twigg, Aug 22, 2015.

  1. Twigg

    Thread Starter New Member

    Jul 25, 2015
    22
    1
    Hi all.

    I've been playing around with the idea of making my own dumbed-down 1MHz spectrum analyzer, mostly for educational purposes and to experiment with. I came up with a design I could probably pull off, but it requires that the circuit receive a short set of instructions, which I envision as just a few lines in C. The problem is, I've never ventured far from the analog realm, so I don't know how to actually integrate code into my circuit. I thought the class of products that turns code into electronic actions is what's referred to as a microcontroller, but if I'm wrong please forgive this thread's title. This kind of thing confuses me, and I don't want to spend a lot of time learning up on stuff if it turns out to be a dead end. Could someone point me to a good place to start my search based on the following project description? Thanks!

    Project Needs:
    -a way to enact a for loop governing a handful of clock and DC signals (or just DC signals, I can always add a timer)
    -a way to input two time series as an array or formatted text (e.g., tab delineated .txt file)
    -this data needs to be computer accessible
    -neither inputs nor outputs have to be very fast
    -solution is reasonably intuitive


    Rough Design: I don't have an electrical schematic yet, but I've attached a rough sketch of my idea. It breaks up the spectrum into a number of intervals and scans them one at a time. I'd set the start and end frequencies plus scan rates in the code. I'd limit the input spectrum to a given interval by running it through a switched capacitor bandpass filter with a flat passband determined by the predefined start and end frequencies. Then I'd down-convert the band-limited signal by the interval's start frequency. The reason for this is that I'm hoping against hope that I'll get a bandwidth of 10MHz and if that actually did happen I could save time and money on PCB layouts by down-converting each interval to a low enough frequency to use protoboard. After down-converting each interval to its start frequency, the band-limited input signal gets up-converted with a slow frequency chirp that sweeps the entire interval at its predefined scan rate. I generate the chirp by feeding the output of a slow sawtooth wave generator through a VCO. The period and amplitude of the ramp generator are digitally controlled such that the slope 2*V_pp / T agrees with the predefined scan rate. Following up-conversion the IF signal is put through a reference resonator, which is just a narrow bandpass filter. The result is an AM signal whose envelope encodes the magnitude of the band-limited signal spectrum that overlaps with the reference resonator frequency response. Once that data's demodulated out and saved, I could roughly estimate the band-limited spectral density from the magnitude of the resonator response by dividing by the bandwidth of the resonator, then convert the time series to frequency by scaling by the interval's predefined scan rate and adding the interval start frequency.


    P.S.: Feel free to post any feedback about the analog part of the design or any advice/pointers for this project. I'm still early in the planning stage, so I'd really appreciate any wisdom you can share. Thanks again!
     
  2. tsan

    Member

    Sep 6, 2014
    41
    4
    You mention that this project is mostly for educational purposes. I think it would be good to choose if the idea is to learn analog circuits or microcontrollers. It is possible to reduce analog circuit "blocks" like vco and mixer depending of requirements. You don't mention what dynamic range you want. If about 50-60 dB is enough you could use fast ADC (analog to digital converter) to sample signal directly at the front and calculate spectrum from the samples. Or use ADC on first IF and omit the later stages.

    You could use Arduino as microcontroller for your design sketch. For example very common Arduino UNO fulfills the requirements. It does not have a DAC (digital to analog converter) but you can use filtered PWM to control VCO. Interface to PC is with serial communication (physically via USB port). Arduino has timers included. If you take fast ADC approach it is possible that Arduino is too slow to communicate with ADC or there is not enough memory to store captured samples.
     
    Twigg likes this.
  3. Twigg

    Thread Starter New Member

    Jul 25, 2015
    22
    1
    Whoops, forgot to post my reply.

    Thanks, tsan!! Arduino seems to be exactly what I was looking for. Sadly, I don't think I'll be following through with this project. I don't have a good sense for how feasible it'll be for me to implement and control the band-limiting and down-converting stages with a flat response, and it seems like it would take more time than I have right now. Definitely going to get started learning Arduino in the near future regardless.

    My learning goals originally were to get some experience working with faster signals, get a feel for how spectrum analyzers work, and to see if I could do some interesting stuff messing with the resonator response. I had thought of pairing the analyzer with the a function generator to take the cross-correlation of the response of a resonator under test with that of the reference resonator.

    I had considered the fast ADC route before I came up with that sketch. I thought I'd have better chance of success with a mostly analog design, as that's more familiar to me. I hadn't thought of putting the ADC after the initial down-converter. That seems like the smart way to do this: best of both worlds. Although, the bandwidth would still be limited by how flat you could get the band-limiting filter's response as well as the mixer's conversion loss and matching parameters.
     
  4. Art

    Distinguished Member

    Sep 10, 2007
    785
    61
    Yes, exactly that. A war is easily started over which micro platform to use, but it sounds like a reasonable first program
    so long as you have some programming experience on any old home computer including, but not limited to, the ZX Spectrum.
    It might be a bit much if you were starting from scratch with programming for something with interrupts, etc.
     
    Twigg likes this.
Loading...