[Open_electroporator] culture shock ADC and DMA

John Griessen john at cibolo.com
Wed May 9 15:20:06 UTC 2018


On 05/08/2018 03:37 AM, Nathan McCorkle wrote:
>  docs report 210kHz with no dropped samples from 2 ADCs. -- So that seems to be about the best we're 
> going to do in a C loop reading the ADC in an ungated situation (i.e. as fast as we can 
> go, since faster than this they were not getting the expected number of readings).

Sounds good for using micropython code without getting into C language except for some register writes
and using DMA.

On 05/08/2018 03:37 AM, Nathan McCorkle wrote:
 > maybe a simple control loop like "voltage is above set-point -> increase pulse-period" and "voltage is below set-point, 
decrease > pulse-period" will work fine... so that's what my focus will be.

A straight feedback control could overshoot a lot and fry the machine.  It can be made safe by using a low low gain, but then
it will only be able to climb slowly.  Probably more than bang-bang set point control is needed.

Since the pulses come in discrete steps, and the fastest they can go is set by our other code, (essentially how many interrupts
are needed per pulse fills up the time between pulses -- 10 usec), and it's about 10 microseconds or 100kHz, the ADCs doing about 
the same may use up all the available interrupt response time.

I think a pseudo PID loop with a non-linear start could work with very little overhead.  The integral part of the "PID"
is easy and is partly done in analog capacitance already.  We just add a little virtual capacitance in code -- averaging is all
that is.  For a start, you do a first pulse that is not going to go over volt just to see what the load is like -- how high the 
volts shoot, and use the pulse measurements of volts and current to get the load's impedance.
The next 4 or 5 pulses after the first are with foreknowledge of the load resistance and come from a lookup table.
Then you're up to maybe 3/4 of the target volts, and switch to feedback control with a moderate gain and averaging to the input so 
it goes up moderately and to the average level that has been set.  Another way could be to use peak detecting and even better save 
the machine from itself.  Over 3kv at the output and it fries itself, much less the sample under test.



More information about the open_electroporator mailing list