Measuring a break in

I am trying to create a sensor that will tell me when there is a break in a gel.

I am pulling apart (vertically) a sticky liquid in a vial and I want to stop the linear movement when the gel breaks. I am having some difficulty coming up with the best method to do this.

What I am currently trying is to create a circuit with the gel and passing a current through. When the circuit is broken, stop moving it.

Is there a way to measure the volume of liquid with a "one sided" circuit. (I would measure the volume of the fluid at the beginning and when the fluid pulled a portion of the gel off, the volume would decrease and that would be my "break point")

Any help?

Digital scales or strain guage with a serial output (you need to decide the size) that are stuck down. The reading will start high (full weight of gel) and decrease (possibly going negative) until gel separates and then you will get a sudden weight increase.

Maybe capacitive. The gel connected to one wire would act as small capacitor (the other wire would be grounded), and the gel breaking should decrease its capacitance. Similar to a capacitive touch sensor.

Can only work if the gel is at least somewhat conductive, and the amount is big enough to have a measurable capacitance. Even so, of course I've never actually tried it, so you will have to experiment a bit. You're probably looking at a few pF at most.

The capacitance is related to the volume of the gel: more gel means higher capacitance, so this should give you a measure of how much gel is left.

Usually gels are conductive, they rely on charge-charge interactions in many cases.

Capacitance is more related to area, but either way when the gel fragments there would be a
definite change in the capacitance, or at least in the Q of the system.

Two approaches to measuring capacitance:

  1. use an ac signal to probe the ac impedance. Needs some analog electronics.
  2. Sense the RC time-constant directly using analogRead and a digital pin to pre-charge
    the system. Have the system under test connected to ground through a very high value
    resistor (100M perhaps), and connected to an analog pin.


#define megohms 100.0

void measure ()
  pinMode (pin, OUTPUT) ;
  digitalWrite (pin, HIGH) ;
  delayMicroseconds (10) ;
  pinMode (pin, INPUT) ;
  digitalWrite (pin, LOW) ; // ensure internal pullups are off.

  unsigned long start_time = micros() ;  // record start time
  while (analogRead (pin) > 377)    // wait for RC discharge to 37% (one time constant)
  unsigned long elapsed = micros() - start_time ;  // time in us
  float pico_farads = elapsed / megohms ;  // time constant in us / R in megohms = capacitance in picofarads
  Serial.println (pico_farads) ;

Note that the gel must be well insulated from everything except via the 100M resistor to ground, and
carefully shielded against interference.

100 MΩ is really high a resistance and sensitive to noise - I'd prefer to lower that to 10M or even less and increase the frequency, and with that I mean something to the tune of 10-100 kHz, or the order of 5-50µs discharge times. Timing technique of course has to move away from micros() and the slow analogRead(), though. Too poor a resolution that way.

You can time discharge much more accurately by using a digital input and interrupt. This relies on the Schmitt trigger behaviour of the pin, triggering at a very specific voltage (which that is varies per pin so needs calibration, but otherwise the actual trigger point is irrelevant, as long as it is stable). Then count clock cycles using Timer2 to get to 62.5 ns timing resolution. Start the timer upon full charge, read it in the interrupt.

With the Arduino's 16 MHz 6.25µs would be the low end of what you can time with good resolution (one clock tick is 1%). The same works great on the ESP8266 at 80 MHz, never tried that one at 160 MHz but it should give a resolution of 6.25 ns.