Sat May 17 20:23:16 EDT 2014
20mA is too much
If we drop an order of magnitude in current, from 2mA - 2uA, the
LM324N leakage current (0.045uA) is still small enough. Discharging
the cap with an 2N7000 will go 10x faster (6 instructions instead of
60) making the code simpler.
I tried to get the reference voltage using a diode but that doesn't
seem to be a good idea. Just use a 2N3904 as a diode.
So trying in the order of 1mA (charging 47nF cap through 2k2 from
3v3). The discharge is pretty fast: spot on 0.5uS as expected. The
buffer is slew-rate limited to 12uS.