Author Topic: Ideas for fast sample & hold circuit  (Read 7909 times)

0 Members and 1 Guest are viewing this topic.

Offline tom66Topic starter

  • Super Contributor
  • ***
  • Posts: 8135
  • Country: gb
  • Professional HW / FPGA / Embedded Engr. & Hobbyist
Ideas for fast sample & hold circuit
« on: June 18, 2014, 11:29:14 pm »
Related to my Ambilight project. I am looking for a circuit which can sample a VGA signal (capture) at a few pixels wide level. I'm sampling a 1920x1080p 60Hz signal max, which is 165MHz pixel clock. So, I need to take a sample on the order of 50ns long up to every 500ns controlled by a microcontroller. The signal is 0~0.7V, but I have a preamplifier which limits the bandwidth to about 35MHz and an amplitude of 0~2.5V.

My idea was to use a fast analog mux such as ADG719, TS3A24157, etc. The input would be buffered by a high speed op-amp. The mux would connect the opamp to a RC network, the op-amp would charge the capacitor, and a low speed low Ibias op-amp (e.x. TL072) would buffer this.

I have three primary concerns with this idea/design:
 - How well will the op-amp cope with a changing capacitive load? I imagine the output will oscillate on each sample cycle as the op-amp will take a small amount of time to stabilise. I'm not sure how to model this, or what tools or methods to use.

 - Charge injection - I will be controlling the MUX with a 3.3V IO port, which is slew-rate limited to about 8mA. However, I'm not sure how much of an effect this would have on the output voltage given an analog mux is basically a couple of transistors with gate capacitance, it's possible to induce charge onto the output through the mux control pin.

 - I put a snubber on the output, but the more I think about it, I think that is useful for inductive loads, as it is used in audio amplifiers like this. My load is capacitive, so I think I need to change it.

« Last Edit: June 18, 2014, 11:36:03 pm by tom66 »
 

Offline tom66Topic starter

  • Super Contributor
  • ***
  • Posts: 8135
  • Country: gb
  • Professional HW / FPGA / Embedded Engr. & Hobbyist
Re: Ideas for fast sample & hold circuit
« Reply #1 on: June 18, 2014, 11:31:43 pm »
Here is the current idea for one channel, it is repeated for all three colours.  Video signal is terminated by 75 ohm at the input.
 

Online moffy

  • Super Contributor
  • ***
  • Posts: 2676
  • Country: au
Re: Ideas for fast sample & hold circuit
« Reply #2 on: June 19, 2014, 01:33:37 am »
Try: http://www.intersil.com/content/intersil/en/products/amplifiers-and-buffers/sample-and-hold-amplifiers/sample-and-hold-converters/HA5351.html
A fully integrated 70ns Sample/Hold. It will give better performance than a roll your own. Glitch transfer is a BIG problem at high speeds i.e. the switching transients of switches inject significant charge into you sampling cap.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22435
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Ideas for fast sample & hold circuit
« Reply #3 on: June 19, 2014, 02:00:59 am »
Heck, you can use the 75 ohm termination directly, with a moderate performance switch.  Remember, a 75 ohm line terminated into 75 ohms has a Thevenin resistance of 37.5 ohms!  A switch under 37 ohms will keep the total under 75, which charges, say, 100pF in all of 22ns (~3RC).  Who needs buffers? :D  (Aside from the read-out buffer, and yes, a TL072 is probably not bad at all.)

If you're holding analog values for eventual digital conversion, you should probably just use an ADC straightaway.  They all contain S&H -- and *most* of them are nice enough to say what the analog bandwidth and S&H window are.

Example: the common MCP320x series 12-bit ADCs.  SPI interface, SAR type ADC.  The sampling occurs during 1.5 clock cycles, timing specified.  You can reasonably figure that, at the moment SCK rises to end that 1.5 cycle time period, the resulting measurement will consist of the input voltage, averaged by the analog bandwidth (if it's around 1MHz, then the last half a microsecond or so gets smeared together into the measurement, etc.).


What's this all about, anyway?  Are you looking to sample a particular pixel?  Is it okay if it smears a few together?  Or is it desirable that it smears them together -- in fact, is it even more desirable that all the pixels laying between sampling points get weighted uniformly into the same sample?

This is the literal spacial equivalent of Nyquist sampling theory and aliasing.  As such, this only determines what kind of filtering you use before and after the sampler, and what sample rate you should use, relative to the desired (final) sample rate.

Constant weighting would require a "boxcar average" filter response, which is hard to do analog, easy digital.  You'd usually do an analog filter at a somewhat higher frequency (to "take the edge off" and 'smear' over a pixel or two), oversample with an ADC (several samples per analog bandwidth), then filter again digitally (in effect, interpolating the samples that, due to the analog filter, should never be changing (e.g. suddenly reversing) any faster than over several samples' span).  Then downsampling (decimation) as needed.  The difference being, each single (decimated) sample is built using information spanning several [over]samples, which in turn span a semi-continuous period of time around those samples, making each [decimated] sample a much more confident representation of that time span than a single naive (non-filtered) sample would.

Or if you have control over the on-screen image, you can take the graphical equivalent: shrink the image to the desired resolution, then stretch back to native screen resolution using a bilinear filter -- a graphical boxcar-averaging filter.

Tim
« Last Edit: June 19, 2014, 02:07:56 am by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline tom66Topic starter

  • Super Contributor
  • ***
  • Posts: 8135
  • Country: gb
  • Professional HW / FPGA / Embedded Engr. & Hobbyist
Re: Ideas for fast sample & hold circuit
« Reply #4 on: June 19, 2014, 08:52:01 am »
Try: http://www.intersil.com/content/intersil/en/products/amplifiers-and-buffers/sample-and-hold-amplifiers/sample-and-hold-converters/HA5351.html
A fully integrated 70ns Sample/Hold. It will give better performance than a roll your own. Glitch transfer is a BIG problem at high speeds i.e. the switching transients of switches inject significant charge into you sampling cap.

That looks like the perfect IC, but I can't buy it in the UK :(. I will need 3 channels and they can send me 2 samples. I might be able to request a few additional samples but it would be awkward.
 

Offline tom66Topic starter

  • Super Contributor
  • ***
  • Posts: 8135
  • Country: gb
  • Professional HW / FPGA / Embedded Engr. & Hobbyist
Re: Ideas for fast sample & hold circuit
« Reply #5 on: June 19, 2014, 09:45:01 am »
If you're holding analog values for eventual digital conversion, you should probably just use an ADC straightaway.  They all contain S&H -- and *most* of them are nice enough to say what the analog bandwidth and S&H window are.

I am using a microcontroller ADC. TM4C123GH6PM. This ADC isn't the best, and one of its major limitations is it requires a very low source impedance (<20R) to sample from correctly.  Its input capacitance is reasonably high (~20pF.)  I thought it would therefore be a good idea to buffer it in some way.

What's this all about, anyway?  Are you looking to sample a particular pixel?  Is it okay if it smears a few together?  Or is it desirable that it smears them together -- in fact, is it even more desirable that all the pixels laying between sampling points get weighted uniformly into the same sample?

What's this all about, anyway?  Are you looking to sample a particular pixel?  Is it okay if it smears a few together?  Or is it desirable that it smears them together -- in fact, is it even more desirable that all the pixels laying between sampling points get weighted uniformly into the same sample?

This is the literal spacial equivalent of Nyquist sampling theory and aliasing.  As such, this only determines what kind of filtering you use before and after the sampler, and what sample rate you should use, relative to the desired (final) sample rate.

Constant weighting would require a "boxcar average" filter response, which is hard to do analog, easy digital.  You'd usually do an analog filter at a somewhat higher frequency (to "take the edge off" and 'smear' over a pixel or two), oversample with an ADC (several samples per analog bandwidth), then filter again digitally (in effect, interpolating the samples that, due to the analog filter, should never be changing (e.g. suddenly reversing) any faster than over several samples' span).  Then downsampling (decimation) as needed.  The difference being, each single (decimated) sample is built using information spanning several [over]samples, which in turn span a semi-continuous period of time around those samples, making each [decimated] sample a much more confident representation of that time span than a single naive (non-filtered) sample would.

Yes, it's OK that I get multiple samples and in fact somewhat desirable.  I am looking at taking the approx average of about 3~5 pixels at a time every 30~50 or so pixels.

The processor I'm using is going to be very busy controlling the LEDs, so I'm not sure how much time I can dedicate to filtering. Controlling 210 RGB LEDs is tricky. So I'd like to do as much in analog as I can. I am already performing averaging on the LED data.

I'm doing this to learn about fast analog design amongst other things. I could cheat and do it in software but that's no fun. And yes, I could also just  control the LEDs from a Windows driver sampling the display directly,  but that would be cheating even more. I've no control over the display resolution.
« Last Edit: June 19, 2014, 09:47:26 am by tom66 »
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 7535
  • Country: nl
Re: Ideas for fast sample & hold circuit
« Reply #6 on: June 19, 2014, 09:11:01 pm »
Can't you just use a 2 diode sampling gate?
 

Online moffy

  • Super Contributor
  • ***
  • Posts: 2676
  • Country: au
Re: Ideas for fast sample & hold circuit
« Reply #7 on: June 20, 2014, 02:16:07 am »
That looks like the perfect IC, but I can't buy it in the UK :(. I will need 3 channels and they can send me 2 samples. I might be able to request a few additional samples but it would be awkward.

I would ask anyway. They can be pretty generous sometimes.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22435
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Ideas for fast sample & hold circuit
« Reply #8 on: June 20, 2014, 04:26:23 am »
Speaking of which, I would be more impressed by a full analog solution.  Or at least something partial.

You could (almost trivially) mux the LEDs with the video and scan signals, but because the luminosity is orders of magnitude less than a good high voltage CRT, you'll be lucky if the image is viewable even under dim lighting.

If, instead, you used a S&H that maintains the illumination of each LED for the duration of a scan line, you could get a passable image.  I think one possible arrangement could involve, sampling an entire line, then lighting it while the next line gets sampled, and so on.

- The LEDs are wired in a matrix (as usual)
- Each matrix row is driven by a high side switch to +V; rows are selected using a full width decoder (or tree of smaller decoders) and a row counter
- Each column gets a current amp
- Each current amp is driven by an analog transfer gate (like a bucket brigade device, the analog equivalent of a D flip-flop)
- The transfer gates are, in turn, supplied from the analog input through a full width mux (bidirectional mux/demux, the analog switch kind; like the decoder, this can use a tree of smaller devices), and the column counter (pixel clock'd)

This sounds very insane, so let's save cost in an equally insane way.

- Ideally, the current amps are FET or CMOS op-amps, with a current source output (using a BJT or MOSFET in the usual circuit).  Cut out the op-amp and use a single 2N7002 with series source resistor.  Or, who even needs a source resistor?  Get rid of that too.  Use just the transistor.  (The low input bias requirement will become obvious shortly.)

- The analog transfer gate should behave like so: the output voltage remains constant and unchanging, until the clock switches, at which point it should instantly take on the value at the input.  The traditional way to do this in digital (if you look inside the structure of a D flip-flop) is two storage bits (RS flip-flops) which are switched, one from the other, and the other from the input, on opposite clock phases.

One possible analog implementation could use two capacitors, where one is connected to the input voltage, the other to the output voltage; then when the clock changes, the input and output get swapped to opposite capacitors (make-before-break).  This requires four analog switches (e.g. sections of a CD4066), which isn't hard or anything, but still pretty tedious.  We should be able to do better.

Suppose instead, we allow that the clock event can be a short sampling pulse.  If the input is low impedance, we can use a single switch to momentarily "bump" a sampling capacitor to the new voltage.  As long as the clock pulse width is a few time constants, it'll settle accurately, and as long as that total pulse width is significantly less than the scan line period, it won't get in the way of anything.  Great.

Further cheapening option: dual diode.  Yeah, serious.  Use a BAV99 or other series dual junction diode (not schottky -- low leakage will still be worthwhile).  Connect the analog input to the cathode end, the sampling capacitor to the middle, and the cathode to GND.  To sample, drive the "ground" end of all the sampling caps to -5V (the diode to GND holds the "top" end just below GND, so all the caps get precharged uniformly to about +5V), then drive to +5V (the excess charge is pushed out of the input terminal, which is fine because it's a low impedance), then return to 0V.  The capacitors remain charged to the input voltage minus 5V.

Note that the sampling strobe voltage needs no DC offset (it's cap coupled!), so it can also be 0, 5 and 10V, or -10, -5 and 0V, or whatever.  Or 5 and 12, or...

- This works for sampling an entire row at once, but a low impedance is needed.  Instead of a whole column worth of op-amp samplers, we'll use a capacitor again.  That's not a very low impedance, you might think.  In fact, the value doesn't matter; we can fix the loss by adding extra gain at the front end! 

So, as each column demux switches in turn, the first sampling cap gets charged to the input voltage.  At the end of a line, the second sampling cap gets strobed down, up and back, taking on a voltage corresponding to the sampled voltage.  Now the whole column stays at the same level (more or less) for the duration of a scan line, and we can continue sampling pixels in the background without interference.



Now, we've introduced a whole lot of shittiness into the system.  Low gain samplers.  Leakage.  Drifty current sinks -- not even current sinks at all, they're just naked transistors!  What the hell!

Here's where the magic comes in.  We only have to do it once, for the whole system, so we can spend a whole lot more money and space doing this.

The most awful part is the dependency on gate characteristics of the column "current sink".  Vgs(th) and transconductance are poorly defined both from manufacture and from thermal drift and aging.  No way you're going to have a trimpot per column -- besides, where would you put a resistor divider in a low-leakage (charge transfer sampling) circuit?  So instead, here's what we will do.

Once all the visible rows have finished scanning (there's always plenty of blank scanlines for retrace), reserve a couple for calibration.  This involves some address decoding and special purpose logic, but nothing crazy I think -- still doable in discrete (MSI).  The principle is this: during a retrace scanline, light up only one pixel, and calibrate the voltage offset and gain of that column.  Since we're in retrace, the actual row being worked should be invisible -- it could be an N+1th row, loaded with regular silicon diodes instead of LEDs.

Each time this calibration line is engaged, set the input to zero, except when lighting the pixel, in which case connect the input to a DC bias.  (Use a "calibration address" counter to select the pixel -- increment each scan, so eventually all columns get calibrated.)  When the line strobe fires, measure the current draw on the calibration row: only one column is lit, so exactly that current flows.  Sample the result, perhaps with an ADC (it can sample at any time during the subsequent scan line -- remember, the row stays charged for an entire scanline), and store the result in RAM.

What gives with the DC bias?  Ah, well remember that we've stored a number in RAM; suppose we hook a DAC to the same address, so that when the pixel is lit, it gets lit with "what we think" it should be illuminated at (say for some "gray" level of intensity).  When it propagates through the scan circuitry and gets lit, the resulting current draw gets stored in RAM: if we use an op-amp to subtract that from what the current should be (say, 1mA), the value stored is the error voltage.

The secret is this: the RAM is always being addressed by the column address counter (asynchronous SRAM would be good for this), and the DAC is always converting its data value.  While drawing normal pixels, for each column address, the error corresponding to that column gets added into the input voltage, so that it gets lit at -- hopefully -- the correct intensity.  If it's not quite the right intensity, the process repeats, until it converges on the correct value.

The number of refresh lines is limited (20-50 for VGA I think?), but the calibration process could be done for pretty much all of them.  In this way, after a few dozen full frames -- less than a second -- all columns get re-calibrated.  This should pretty well take care of thermal drift, even fairly rapid drift.  The settling time of the error system will depend on the loop gain, which depends on the transistor gain.  This procedure also only accounts for voltage offset; however, if every other cal cycle (be it every other line, or every other complete pass) is performed at a higher current (say 100mA "full white"), and those results stored into an additional RAM; likewise, a second DAC produces the "full error" value, and an op-amp or VGA at the input resolves this into a proper two-point (offset and slope) calibration.

Damn, I kind of really want to build one of these now, but fuck if an array isn't going to be expensive.  If I build it myself -- assuming I even keep at it -- a 160x100 array (nary a quarter of old school VGA's 320x200 mode) takes 16 thousand tricolor LEDs, 480 columns, and with 3/8" pitch, spans a whole 5 x 3 feet.  If it takes me two seconds to trim the leads of an LED, I need ten whole hours just to trim them all!  Let alone build the matrix: that requires 1/3rd of a mile of hookup wire and over three pounds of solder, not to mention some sort of mounting base.

The drivers wouldn't be terrible, at least: the rows could be served by seven 74HC154s, a hundred gate driver chips, and a thousand ~2A P-FETs (ten acting in parallel to cover each row).  The columns would need thirty 74HC4067s (ten per color, plus one 'HC154 to select banks), 960 capacitors, 480 dual diodes and 480 2N7002s.  (In contrast, the auto-cal circuitry could be some digital logic or an FPGA, plus a few op-amps and stuff, on a small board supplying the signals to the matrix.)



...Now where were we?  Oh, I've written a novel again.. drat..

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 18746
  • Country: us
  • DavidH
Re: Ideas for fast sample & hold circuit
« Reply #9 on: June 21, 2014, 07:26:55 pm »
There are a number of sampling ADCs which support bandwidths considerably in excess of their maximum Nyquist frequency so no external sample and hold would be neccessary.  An LTC1402 for example which only supports sample rates up to 2.2 MSamples/second has an 80 MHz input bandwidth:

http://www.linear.com/product/LTC1402
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf