Pico C (English) - Part1
Pico C (English) - Part1
Pico C
Please welcome
ATtiny & The Low Picofarads
By Vladimir Mitrovic (Croatia)
Features
• range: <1 pF to 2000 pF (guaranteed); • low-cost, no SMD parts capacitor
2500 pF possible • ATtiny2313 DIP20 microcontroller • microcontroller, board and kit available
• resolution: 0.1 pF • free source and hex code from Elektor
• readout: 2-line LCD • easy calibration with 1000pF 1% reference
24 04-2011 elektor
WorldMags
730333
(a) Philips ‘beehive’ trimmers. Low loss. (b) Ceramic capacitors, lead pitch 5 mm. (c) Ceramic tubular capacitors. High
Ingenious construction ensures linear Pushing the limits of Elektor photography. working voltage (250 V typ.).
response across range(!) The rotor (moving Note the print to indicate value. 12 pF, 39 pF, 320 pF.
part) is usually connected to ground 0.82 pF and 120 pF.
(why?). 5–30 pF adjustable.
(d) Feedthrough capacitors. Low stray (e) Coffin and disc capacitors. Low loss (f) Ceramic trimmer capacitor.
inductance. Ideal for RF decoupling. factor, zero stray inductance. On-PCB 3.5–10 pF adjustable.
200 pF, 470 pF, 1 nF. coupling and decoupling. Fragile devices!
Connect straight to a PCB track and copper
earth plane. 27 pF, 820 pF.
(g) Tubular trimmer capacitors. Unless in (h) Silvered mica capacitor. 500 V working (i) ‘Twister’ is the cheapest ultra-small C
series, the rotor is best grounded. voltage, 1966 NOS. Ebay-able. you can make. Twist the wires to increase
0.3–3 pF, 1-6.5 pF. 470 pF. capacitance, stop and cut off approaching
target value. Okay for use up to 200 VDC.
0.2-1.5 pF adjustable.
Figure 1. Small capacitance does not necessarily equate to small size or small importance.
Here’s a showcase of rare-bird, vintage and DIY capacitors ranging from 0.2 to 1000 pF.
elektor 04-2011 25
WorldMags
730333
LCD1
IC1 +5V
D1 7805
1 3
2 x 16 (DEM16217)
K1 1N4004
2
C1 C2
9V...12V
LED+A
LED-C
VDD
VSS
R/W
RS
VL
D0
D1
D2
D3
D4
D5
D6
D7
E
10u 100n
63V
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
P1
10k
C3
JP1 R2
100n 5R6
20
VCC
1
PA2/RESET
R1 12
2 IC3 (AIN0) PB0 13
PD0 (RxD) (AIN1) PB1
1M
3 14
PD1 (TxD) (OC0A) PB2
1% 8 4 6 15
PD2 (INT0) (OC1A) PB3
VCC R 7 16
7 PD3 (INT1) (OC1B) PB4
DIS 8 17
PD4 (T0) (MOSI/SDA) PB5
IC2 9 18
6 3 PD5 (OC0B/T1) (MISO) PB6
THR OUT 11 19
PD6 (ICP) (UCSK/SCL) PB7
2 TLC555
TR ATtiny2313
CV GND XTAL2 XTAL1 GND
K2 5 1 4 5 10
X1
Cx S1
C7 C4 CALIBRATE C5 20MHz C6
Figure 2. Smart and utterly efficient is one way of describing this circuit, fully realising of course that all the measuring is actually carried
out by firmware running inside the ATtiny microcontroller.
filters, capacitor values really matter and and so determine the value of C x . Fair How it works
specifications like 1% suddenly make sense. enough, but if you want to measure Let’s take a tour of the circuit diagram in
So, for all measurements below 1000 pF very low capacitances, you’re bound to Figure 2. There’s old cronies to be found:
(1 nF) forget about your 3.5 digit DMM and be confronted with parasitic (or ‘stray’) a TLC555, an ATtiny, a 7805 and an LCD
use Pico C instead. capacitances in unexpected corners, as well so this should be fun. Together with R1
as electrical disturbances and many other and C7, the CMOS type TLC555 timer
Devil in the details factors that may affect the measurement. (IC2) forms a 50% duty cycle oscillator
The measurement principle applied in And that’s where commercial multimeters generating a frequency of around 3.2 kHz.
Pico C is well-known and widely used in often fail miserably despite their apparent Do not attempt to use the bipolar (NE)555
other similar instruments: an unknown 1 pF resolution. By contrast, Pico C solves here, you will shoot yourself in the foot. If
capacitance Cx determines the frequency these problems with a simple but carefully you connect your unknown capacitor C x
of an oscillator. Next, a microcontroller designed bit of hardware and cleverly to K2, effectively it’s in parallel with C7 so
goes about measuring the frequency written software. the oscillator frequency will be lowered.
Elektor Products & Services • Firmware and source code (free download): # 100823-11.zip
• PCB artwork: #100823-1.pdf
• Printed circuit board: # 100823-1
• Hyperlinks in article
• Programmed ATtiny-20PU: # 100823-41
• Kit of parts, including Project Case, programmed controller, LCD * First 100 kits with 1000 pF 1% polypropylene capacitor included.
26 04-2011 elektor
WorldMags
730333
COMPONENT LIST
Resistors Miscellaneous
R1 = 1MΩ 1% K1 = 2-way PCB screw terminal block,
R2 = 5.6Ω lead spacing 5mm
P1 = 10kΩ trimpot, horizontal K2 = 2-way pinheader and receptacle,
lead spacing 0.1 in. (2.54mm)
Capacitors JP1 = jumper, 0.1 in. (2.54mm)
C1 = 10µF 63V, axial, lead spacing 2.5mm S1 = pushbutton, SPNO, 6mm
C2,C3,C4 = 100nF 50V ceramic, lead X1 = 20MHz quartz crystal, CL=18pF,
spacing 0.2 in (5.08mm) 50ppm, solder wires
C5,C6 = 15pF 100V ceramic, lead spacing LCD = DEM16217, 2x16 characters with
0.2 in. (5.08mm) backlight, e.g. Elektor # 030451-72
C7 = 220pF 63V 1%, polystyrene, lead LCD connector = 16-way (14+2) SIL
spacing 7.18mm, e.g. LCR Components Figure 3. All the components except the LCD pinheader and socket, right angled, lead
# EXFS/HR 220PF +/- 1% go on this simple, double-sided circuit board. spacing 0.1 in. (2.54mm). See text for
Optional: 1000pF 1% reference capacitor, The LCD is hooked up vertically or horizontally connection of DEM16217 LCD.
polystyrene or polypropylene using the 16-pin connector set. Here, horizontal 20-pin DIP socket for IC3
8-pin DIP socket for IC2
Semiconductors
mounting is used to allow the two boards to be PCB, Elektor # 100823-1
D1 = 1N4004 fitted in an Elektor Project Case. Kit of parts, including Project Case, PCB,
IC1 = 7805 LCD and programmed microcontroller;
IC2 = TLC555 8-pin DIP, e.g. Texas Elektor # 100823-71.
Instruments TLC555CP
IC3 = ATtiny2313-20PU, programmed, Elektor Shop # 100823-41, see [1]
Arguably, to ensure this frequency change and form a unique 25-bit binary counter, LCD backlight disabled — the instrument
is substantial (i.e. measurable) even if Cx has which in turn ensures a high resolution. alone consuming about 20 mA. Diode
just a few pFs to throw in, C7’s capacitance D1 affords a degree of protection against
should be kept low. The rest of the circuit is conventional. The polarity reversal of the DC input source.
ATtiny2313 micro ticks at 20 MHz thanks to Replacing the diode with a wire link, and
However, contrary to this reasoning a rather quartz crystal X1 and loading capacitors C5 the 7805 with a low-drop regulator allows
high value was chosen for C7 (220 pF, 1%) and C6 (see inset). The ATtiny2313 micro Pico C to be powered from four 1.5 V dry
for the following reasons: directly drives an LCD with two lines of 16 cells in series.
characters and LED backlighting you can
• parasitic capacitances around K2 and Cx (optionally) turn on by fitting jumper JP1. Assembly
now have less influence on the oscillator R2 if necessary defines the brightness. The little instrument is built on a printed
frequency; Be sure to adapt its value to match the circuit board designed by Elektor Labs.
• the relation between capacitance and requirements of the LCD you’re using. The component mounting plan appears in
oscillator duty-cycle is not linear for The Elektor supplied DEM16217 LCD Figure 3 and the associated copper track
capacitances under 100 pF. module has an internal series resistor and artwork as usual is a free download from
elektor 04-2011 27
WorldMags
730333
success. separate pin connections and wires shown time and can be repeated at will if you press
Care should be taken to prevent the quartz in Figure 4. When in doubt, consult the pushbutton S1 and keep it pressed until the
crystal case from touching the solder pads LCD’s datasheet. message “Cal:” appears on the LCD (this will
underneath it. That’s why the crystal is take 2-3 seconds). The microcontroller will
mounted either .1 of a millimetre above the Practical use and calibration guide you through the calibration process.
board surface, or with a piece of thin plastic First off, always connect the capacitor under As the first step, you will be prompted to
sheet or tape inserted. test directly to the Pico C test terminals, remove any capacitor from K2 and only then
briefly press S1:
Location C7 on the board
allows capacitors with various Cal: C=0pF (S1)
lead pitches and lead positions
(relative to the case) to be In the second step, you are
mounted. For the prototype prompted to connect the
a bright orange Siemens 1% 1nF/1% reference capacitor and
polystyrene device was used. briefly press S1:
28 04-2011 elektor
WorldMags
730333
Error: C>>
will be displayed. If this happens in
measuring mode, normal measurements
will be restored as soon as the large
capacitor is removed. If you use an
inappropriate reference capacitor, the same Figure 4. Inconveniently the DEM16217 LCD has its connections for the backlight LED(s)
at the pin-1 side of the connector row, forcing the use of two wires and pin connectors to
message can appear during calibration,
connect to the Pico C board.
which will be interrupted for repeating with
a proper reference capacitor.
Accuracy and stability period, without a capacitor attached the and measuring routines are written in
The accuracy of the little instrument readout was seen to vary between –0.1 pF assembler, to have better control over
depends primarily on the accuracy of and 0.1 pF. timing. BascomAVR is pretty wasteful when
your reference capacitor. Immediately If you notice persistent inaccuracies in your it comes to arithmetic with long variables
elektor 04-2011 29
WorldMags