A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Capacitance meter (1)

Whilst I was looking at the ATmega168 datasheet to see if I could improve the NewSoftSerial library speed I came across the analog comparator – this takes a reference voltage at digital input 7 and a voltage to be compared at digital input 6. Any time the voltages are equal (rising or falling – you choose) you can get an interrupt. Even better it will trigger a snapshot of Timer 1 (a 16 bit timer/counter), the spec calls this a Capture.
I started thinking about a capacitance meter using this.
Capacitors charge up with a time constant of T=RC, by measuring the time to charge to 63.2% of the supply voltage and knowing R we can caluate C. This has been used before to produce an Arduino Capacitance Meter. The span and accuracy of such meters has been limited by how accurately they can measure the time. Using the Analog Comparator and Timer 1 should enable me to get a much more accurate measure. Using a prescalar the input to Timer1 can be 16Mhz, 2Mhz, 250Khz, 62.5KHz or 15625Hz – on a 16bit counter this gives a large number of possible ranges.
I decided to go with 4 ranges (based upon a minimum count of 30 and a maximum count of 60000 – to get enough resolution and not get too close to overflow).
R=2M2 Timer1=16Mhz Range 0.8pF – 1.7nF
R=2M2 Timer1=62.5Khz Range 218pF – 436nF
R=1K Timer1=250MHz Range 120nF – 240uF
R=1K Timer1=15625Hz Rage 1.9uF – 3840uF
The meter will be auto ranging – I will use the Timer 1 Capture interrupt and the Timer 1 Overflow interrupt. I have built a proof of concept and it all seems OK so I will be building the meter over the next few weeks (as I get time).

Comments are closed.