So the idea is to measure a capacitive sensor by transmitting 555 events (actually the newer 7555 CMOS version) to charge and discharge a capacitive sensor and measure those events with the AVR capture hardware. I started by using the discharge pin with a pull-up to signal the MCU, which worked fairly well on short wires, but signals got nasty as the wires got long. I simulated ways to send these events over a current loop but had some false starts. ^0 of this board arrived from OSHPark a few days back and probably counts as a partial false start, but I have managed to hack it into working shape. This is sort of a big deal, cause it means I can put four sensors on a CAT5 run, and daisy-chain to each sensor junction box where I can open the CAT5 cable and cut the pair I want to splice into.
Eurgh, horrible background image under text, makes it unreable - stop it at once!
Seems a very complicated way to communicate - although I've not tried power and data
sharing a twisted pair myself.
Could you not just use brief pulses to short the input wires, deriving local power via an
RC circuit with time-constant >> pulse width? If the power is fed via 100 ohm resistor
from the mcu node then you have 100 ohm matched transmission line and signals should be
clean.
So perhaps 100 ohm / 10uF for the supply (and matching the line at sensor end), and use
10us pulses (a switching transistor capable of 100mA is needed).
Receiving end feeds power via 47 ohm resistors on both wires (to balance the signals), and
perhaps comparator circuit to detect the pulses reliably (as one wire will be dropping from ~5V to
2.6V, the other rising from ~0V to 2.4V or so).
Its important to balance the signal on long runs which you are not doing, so there's a big common
mode signal flying around. My scheme seems simpler and balances the signal...
Eurgh, horrible background image under text, makes it unreable - stop it at once!
Ha... thanks for the vote. I rather like the background but perhaps you are right.
UPDATE: pushed some very light backgrounds to the server, is that better?
matching the line at sensor end
ideally, there would be a termination resistor at the sensor end of the transmission line, SPICE shows it helps, but SPICE also shows a 10nF capacitor at the sensor decoupled the reflected power (well that is how it looked to me anyway), and that meant I could skip the transmission line termination in the sensor (and its voltage drop)
brief pulses to short the input wires, deriving local power via an
RC circuit with time-constant >> pulse width?
Is this what Chirp* is doing? I like how that works but the sensor starts at the point the RC circuit begins. With a 555 the sensor is actually remote, and moisture will not affect the current loop used to send the 555 events. An RC circuit can be used at the 555, as is shown on the HS1101LF** datasheet. However with the dual mirrors I have used in place of an RC circuit, I can charge and discharge with a different source and sink, one is a fixed resistor and the other is a thermistor. The duty ratio can then be used to find the thermistor value, and thus temperature. So the event timing has two values inside, one is from the capacitive sensor, and the other is from the thermistor.
I agree this is true, and I need to do more testing but on the 555 sensor side the 10nF seems to do the trick and on the MCU side the 100 Ohm is to ground and the loop DC source (also to ground) is effectively a short to AC but I will add a capacitor to my schematic to make sure it is clear.
This is a link to a simulation in EveryCircuit (runs on Chrome's NaCl):
It shows the basic idea but is simplified. I've included four transmission line elements (each has a 4.4 Ohm, 12.3uH, and 1.23nF part) this should add up to 100 meters of a CAT5* pair. The 10nF is shown in the simulation, and its value can be changed (e.g. 100pF) to see the reflections caused by improper termination.
A transmission line isn't accurately modelled with discrete components, but with the Heaviside
differential equations for distributed capacitance, resistance, inductance and di-electric loss.
In practice you just terminate with roughly the right resistance and it will just work - of course
with UTP or STP the signal must be differential for it to "just work". You still have to worry
about the attentuation being dependent on frequency.
transmission line isn't accurately modelled with discrete components
Which can definitely be seen when using SPICE elements, for example, the four I have shown start to have problems somewhere above 100kHz (I forget now), but as more elements are added by splitting them into smaller and smaller sections, correct behaviour can be seen at higher and higher frequencies. I don't think the higher frequencies are going to be in play on this loop so the four elements should be enough though I could be very wrong. Everycircuit has major limitations (hell it runs on a cell phone), and no accurate line model, so it is not good for anything complicated.
I think the UTP type cable will be good enough for this 10mA current loop. It is somewhat unusual I guess. The current loops I have seen are slow changing currents that get measured with an ADC connected to a sense resistor (near the MCU). I am fairly sure they would have problems with what I am trying to do since I am after an event time, not an analog voltage or current level. With that said I think sending the event as a step pulse (3mA to 10mA) through a transmission line is a reasonable choice.
I have a half spool of CAT5, I looped the pairs so the signal goes down brown/white then back on green/white and down orange/white and finally back on blue/white. Shorting one end of the pair I measure the wire resistance to be about 100 Ohms (had to double check that a few times cause it was not expected), at 17.6 Ohm per 100 meters that gives 568 meters (1860ft). Which sugest the total cable is about 142 meters (465ft, bumer I though there was more on the spool).
Ignore the step in the reference voltage (green), it is caused by the drop on the negative side of the pair because I have grounded the scope at the termination resistor (the step from 10mA to 3mA over 50 Ohms of wire is .35V).
The damp cloth was in place for about a minute before the image was taken.
Pulse Width ratio:
Dry: 29.26uSec to 105.49uSec, so duty is 27.8%, thermistor = 1.5Meg * duty = 417k
Damp: 31.80uSec to 114.51uSec, so duty is 27.8%, thermistor = 1.5Meg * duty = 417k
So the temperature didn't change enough to see with an oscilloscope.
The thermistor is a 5% part so now I know its room temperatrue value.
+Width Capacitive Discharge Time: set with a current mirror and 1.5Meg resistor
C = itime/V
i = the discharge current mirror which is set with a 1.5Meg resistor, is about 2uA.
V = the voltage over which the ramp time occures, which is 1/3 of the 555 Voltage
Dry: 2uA105.49uSec/1.19V = 177pF, datasheet shows this is about 45% RH
Wet: 2uA*114.51uSec/1.19V = 192pF, datasheet shows this is over 95% RH
Trying Liquid Tape, and after drying a few days it is nearly back to the original operation. The sensor capacitance shifted a little for a while but I think it is mostly due to the volatiles, and once they are gone the plastic has less impact on the sensor circuit (I'm just guessing and it is a highly biased guess, cause I want it to work).
When the HT pulse is at 10mA it biases a transistor that pulls the ICP1 pin low on the RPUno board, thus the pin low state is when the sensor timing ramp is discharging (flipped when looking at the termination resistor signal). Timer1 is running at 16MHz. Using Timer 1 Input Capture Unit (ICP1) on an RPUno board which has a 30ppm crystal I get the following results.
To record a Linux terminal session that gathered the JSON data I used
script -f -c "picocom -b 115200 /dev/ttyUSB0" HT^1,capture.log
/0/capture? icp1,15
Finally I opened the cvs with LibreOffice Calc and made the above graph
Evaluation location and setup
This evaluation was done near my garden misters, I turned them off at dusk when the temperature was falling 95F and then turned them back on in the morning when the temperature was about 85F. The mist moves around randomly and sometimes gets near the sensor. I guess what I'm trying to say is everything in the data looks reasonable to my eyes. This has not been calibrated in any way, I am just assuming nominal NTC values and Capacitive sensor values.
UPDATE: Python script now includes the bias voltage of base to emitter used for the current mirror that discharges the capacitive sensor. Also corrected an error that caused the first data point to be skipped and the first data point of the following sample to be aggregated into the present sample.