This is only a preview of the October 2007 issue of Silicon Chip. You can view 40 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Oscar: Electronic Noughts & Crosses Game":
Items relevant to "PICProbe: A Versatile Logic Probe":
Items relevant to "Rolling Code Security System; Pt.1":
Items relevant to "Simple Data-Logging Weather Station; Pt.2":
Purchase a printed copy of this issue for $10.00. |
Try your hand at a surface-mount-device project...
PICPROBE
A versatile PIC-based logic probe that fits inside a Biro case!
T
HIS PROJECT CAME ABOUT
through the recent trend in
electronics towards lower operating voltages. If you look around
at the latest chips being offered from
semiconductor manufacturers you will
see that most are designed to operate
on 3.3V or lower.
Having done a few recent designs
with 3.3V circuits, I discovered that my
old favourite test tool, the Logic Probe,
wouldn’t operate below 5V. I looked
around my usual electronic suppliers
but couldn’t find anything that would
work on anything less than 5V. So I
thought I’d build design and one.
The first requirement I had was to
make it work over as wide an operating voltage as I could so that it could
be used on the old legacy 5V systems
and down to some of the latest processors at 2.8V. The second requirement
was low cost.
I took a look inside the existing
probes I had, only to discover them to
be full of analog components, some of
which were now obsolete.
32 Silicon Chip
The quickest and easiest approach
seemed to be to build something out of
a small microcontroller, so I went on
the hunt for anything that was small,
cheap and worked on a wide supply
voltage.
Where I ended up was at the Microchip website looking at our old friend,
the PIC.
One of their latest additions to the
ever-expanding family is the 10F20x
series which are available in DIP-8,
SO-8 or SOT-23-6 packages. The SOT23-6 was my choice as these are tiny
and easy to put inside some type of
pen as a housing.
My next mission was to find a housing for the design. Having built a Logic
Pulser from a magazine article many
years ago into a white board marker
pen, I decided to check out the local
stationery shop for ideas. If I could find,
from an original
by Ross Purdy
say, a pen moulded in clear plastic, I
wouldn’t need to drill holes to view
the LEDs. This would not only make it
easier to build but it would look pretty
cool as well!
I found a 10-pack of ballpoint pens
that looked about right and cost only
$2.00, making for a very cheap case
– including an end cap to protect the
pointy bit. The pens were a bit on the
small size, allowing for a PC board only
about 5mm wide and 100mm long,
but it was the height that I was more
concerned with.
I cut out a dummy piece of circuit board and glued a few bits on
and found that the micro and LEDs
would fit easily down the barrel of
the pen.
With the micro and housing sorted
out, I next concentrated on the functionality required.
First and foremost was a good sharp
tip that you can use to probe tiny pitch
devices that were/are becoming increasingly common. A sewing needle
seemed to fit the bill quite nicely here.
siliconchip.com.au
This photo shows the first prototype without
the extra components added for higher voltage
operation or input protection. Don’t forget to
keep the pen cap – it can save some nasty stabs!
Also note the S1 access hole in the pen body.
I also wanted to have a pulse stretching or latching function to view and
change very quick pulse transitions so
a switch would be required to change
modes and clear the pulse latch when
required.
Modifying the design!
You will see from the schematic
(Fig.1) that there isn’t much to the
design. However, this has some differences to the author’s original circuit
and project, with SILICON CHIP making
a number of changes.
First, SILICON CHIP added provision
for a 5V regulator on the PC board,
since there would be a lot of hobbyists
who might want to use the probe for
testing devices with higher voltages.
This involved including the pads and
tracks for a 5V SMD regulator (78L05,
REG1). Due to the miniscule power
drawn by the circuit, the regulator
should be quite happy working up to
its maximum input voltage of 30V.
If you only want low-voltage operation, the regulator can be left out and a
link added to connect the DC in and DC
out pads (where the regulator would
be). The regulator input and output
filter capacitor can remain – they won’t
do any harm and may even do a bit of
good in decoupling a supply.
We’ve specified 100nF capacitors
because we have found these are the
easiest to get in SMD and in small
quantities. But there would be some
benefit if one of the two “downstream” capacitors (ie, between the
siliconchip.com.au
regulator output and ground) could
be larger – in fact, as large as you can
get in SMD.
The second change was in the input
circuitry. The PIC only has six pins,
two of which are the power supply.
GP3, the probe input, can withstand a
maximum of 13.5V. In the vast majority
of circumstances this would be more
than adequate but once again, we’ve
“gilded the lily” somewhat by adding a pair of diodes across the input
(one each to the positive supply and
ground) along with a series resistor.
This protects the input from accidental
higher voltages and for the price is a
worthwhile addition.
This is very handy in case you
touch something at a higher potential
than the power supply. If you don’t
need this protection, the diodes can
simply be omitted. The 4.7kW resistor
could be retained, or replaced by a
wire link if you wish. It won’t matter
either way.
Circuit details
Surface-mount LEDs, so tiny that
they are almost impossible to find
if you drop them on a carpeted floor
REG1* 78L05
OUT
+2.8 -5V OR
+6 -15V*
GND
100nF
100nF
IN
180Ω
180Ω
100nF
180Ω
A LED1 A LED2 A LED3
λ
TS4148*
K
5
Vdd
D1
4.7k*
10k
A
6
PROBE
GP2
IC1
PIC10F200
GP3/VPP
GP1
K
* ONLY REQUIRED FOR
HIGHER VOLTAGE
OPERATION -- SEE TEXT
K
K
C
4
B
E
3
IC1 = PIC10F200
OR PIC10F202
Q1
MMUN2211
1
NOTE: ALL DEVICES
IN THIS PROJECT ARE
SURFACE-MOUNT
Vss
D2
TS4148*
GP0
λ
λ
K
A
2
S1
0V
SC
2007
PICPROBE
LEDS
(UNDER
SIDE)
A
K
78L05
TS4148
6
IN GND
NC
A
K
PIC10F20X
OUT
GND
NC
1
5
MMUN2211
4
C
B
2
3
E
Fig.1: the circuit can be built in two versions – that shown here, suitable for
general purpose work or without REG1, suitable only for low-voltage work.
October 2007 33
The SMD LEDs are really bright, especially in normal
lighting. This photo clearly shows them glowing even
though they have been “swamped” by the very bright
photo flash we used for the photo.
Parts List – PICPROBE
1 PC board – see text
1 clear plastic ballpoint pen
case with top and cap
1 35-40mm long darning needle
1 500mm length thin figure-8
cable, red & black
1 small red alligator clip
1 small black alligator clip
1 ultra-miniature (SMD) momentary action pushbutton switch
Semiconductors
1 PIC10F200 or PIC10F202 SMD
microcontroller programmed
with PicProbe.hex
1 MMUN2211 SMD NPN
resistor-equipped transistor
(Q1)
1 red SMD LED (LED1)
1 green SMD LED (LED2)
1 orange SMD LED (LED3)
2 TS4148 SMD diodes (D1-D2)
1 5V SMD positive regulator
(see text) (REG1)
Capacitors
3 100nF SMD
Resistors (all 603SMD)
1 10kW
1 4.7kW
3 180W
34 Silicon Chip
(trust us!), are directly driven from
the PIC’s GP2 (red LED) and GP1
(orange LED) outputs. The green LED
is driven by the inverse of GP2, using
transistor Q1.
Even though Q1 is shown on the
circuit as a standard NPN type, it’s
a bit more complicated than that.
It is actually a “Resistor Equipped
Transistor” which has two internal
resistors: a series resistor to the base
and a pull-down resistor to the emitter.
These “RET” devices are great for use
as digital inverters.
GP0 is normally held high by a 10kW
resistor connected to the positive supply. It’s also connected to a pushbutton
switch which grounds the input when
pressed.
Which PIC?
The circuit shows a PIC10F200 as
the microcontroller but you can also
use a PIC10 F202. The program was
originally written for the 200, which
has 256 bytes of program, 16 bytes of
RAM, and one 8-bit timer. Note that
neither the PIC10F204 nor PIC10F206
will work in this circuit – you must use
the 200 or the 202.
Operation
The probe has three LEDs and a push
button. The Red LED is turned on for a
logic 1 at the probe tip while the Green
LED turns on for a logic 0.
The Orange LED works in one of
two modes – pulse stretch or latched.
In pulse stretch mode, the orange LED
will pulse for 50ms every time there
is a change on the probe input. This
makes very small pulses at the probe
tip viewable. If the orange LED stays
on permanently in this mode then the
probe tip is changing at a rate greater
than 50ms.
In latched mode, the orange LED will
turn on and stay on with any change on
the probe tip. This is handy for detecting very infrequent changes. The latch
is cleared and the LED turned off when
the button is pressed.
The pushbutton has three functions:
(1) changing orange LED mode, (2)
clearing the latch and (3) enabling a
pull-up resistor on the probe tip.
To change modes you press and hold
the button for two seconds. After two
seconds the orange LED with blink to
indicate the mode is about to change.
When the button is released, the mode
is toggled. In latch mode, a single press
of the button will immediately reset
the latch.
If the button is pressed when power
is first applied, a pull-up resistor on
siliconchip.com.au
siliconchip.com.au
0V
+V
PICPROBE
+
JAYCAR
100nF
JE 100nF
TWICE FULL SIZE
(FOR CLARITY)
REG1
MC785L05
ACTUAL SIZE
OF PC BOARD
JAYCAR
PICPROBE
+
ALL COMPONENTS ARE SMD AND
ON COPPER SIDE OF PC BOARD
A
180
K
180
20071129
A
S1
10k
GND
LED3
LED2
JE
20071129
A, B, C AND GND ARE USED
FOR IN-CIRCUIT PROGRAMMING
D2
KC5457
EC8257
EC8257
SOLDER
4.7k
D1
C
TS4148 x2
IC1 B
A
100nF
180
K
LED1
MMUN2211
C
K
A
Q1
B
E
DARNING NEEDLE (~35-40mm)
Fig.2: install the parts on the Jaycar PC
board as shown in this twice-size
overlay. Note that this assembly differs
slightly from the accompanying photo
which shows the author’s prototype (ie,
no regulator or input protection diodes
for working at higher voltages).
KC5457
Internally, you don’t get much room
to play with in this tiny PIC. Because
the device is so small and the task relatively simple, the software was written
in PIC assembler using the PIC IDE 7.5
tool kit, which is available free from
www.microchip.com. The IDE gives
you an editor and assembler and is
quite easy to learn.
As this micro has no interrupts and
very little resources it doesn’t take long
to master but as I found out, there are
a few traps for young players. The first
thing to master is the internal oscillator
and its calibration, if required.
When the device is manufactured,
it has a MOVLW instruction loaded
into the last byte of the memory. On
power reset, the micro starts at the
last address and executes the MOVLW
instruction. This loads a calibration
value into the “W” register and is
factory set. The program counter then
rolls around to 0 and starts executing
the user’s code.
The problem comes when you
erase the device and lose the MOVLW
instruction. If you want a 4MHz
calibrated oscillator you need to read
the last byte and write it down then
manually put it back in. All this seemed
unnecessary for my application as I
wanted it to run as fast as possible. As
the first instruction I loaded “W” with
0x7E which makes the oscillator run
at its fastest speed.
The next item to master is the
internal timer. This is a bit tricky as
the micro has no interrupts to trigger
asynchronous events. The timer is freerunning and you can only read the
timer register and compare it with a
constant. Any write to the timer will
clear it and start timing again so you
can’t use any read-modify-write instruction.
This was a trap I fell into. I have run
the timer at 50ms per overflow (counts
from 0x3d to 0 in 50ms then is reloaded
OUCH!
The software
with 0x3d). If you check and branch
when the timer is zero you can have a
routine which is executed at a regular
period for timing tasks.
The program begins by setting the
oscillator configuration, port pin configuration (inputs or outputs), starting
the timer, and resetting the LEDs.
As the processor has no interrupts
the only way to monitor the probe tip
is to poll it. This is done in the main
loop and the smaller the main loop (or
the quicker it executes) the smaller the
pulse transition that can be detected.
This is one limitation of the design
but in practice it doesn’t appear to be
a problem.
The main loop moves the state of the
probe input to the red/green output,
checks the status of the mode change
flag and looks for the timer to reach
zero.
Every 50ms, the time function is
called. The job of the time function is
to check that the button has been held
down for two seconds and to update
the orange LED in either pulse or latch
modes.
First we will look at the button down
timer. To do this we have a variable
called CNT0 which is preloaded with
40. Every time the time function is
called we decrement CNT0 if the button is pressed. If it is not pressed, we
reset CNT0 back to 40.
The only way CNT0 can make it to
0 is if we have 40 consecutive calls to
time with the button pressed (40 x .05
= 2 seconds). When CNT0 reaches 0
we set a flag (BDOWN) to signal to the
main loop that the mode change function needs executing.
The orange LED is handled with different pieces of code depending on the
mode set. The flag LATCH determines
the mode.
Every time the red/green LED
changes state we set a flag (CHANGE).
This flag is read by the time routine.
In pulse-stretch mode, the orange LED is
turned on when CHANGE is set and then
CHANGE is cleared. If CHANGE is not set,
the orange LED is turned off. This means
that the minimum time that the orange
LED is on will be 50ms which is more than
enough for your eye to see.
PIC
the probe tip is enabled. Normally the
pull-up is disabled, which makes the
input impedance very high. In this
configuration the LEDs will flash randomly until the probe is connected to
the target test point.
This is very useful for tracking down
floating circuits on the target under test.
If this is not an issue, then enable the
pull-up and the tip will go to a “soft”
logic 1. The only way to reset the pullup is to re-power the probe.
October 2007 35
Where Do You Get It?
PROGRAMMING THE PIC CHIP
If you’re not building the PICPROBE
from a kit, you must first program the
10F20x micro with the file PicProbe.hex,
available from the SILICON CHIP website –
www.siliconchip.com.au
Since the micro is a surfacemount device, programming it
presents added complications. 6 1
It must be done in circuit
2
but before the board is fully 7
3
populated. This section explains 8
how to do this.
4
9
You need both a VPP voltage
5
source of around +13V and
a normal +5V supply. If you RS-232
SERIAL
have decided to use the 78L05
PORT
regulator, you can derive the 5V
supply from that.
If you have chosen to bypass
the regulator, you will need to apply +5V to
pin 5 of the micro and 0V to pin 2.
The micro must first be soldered in place,
making sure that the orientation is correct. If
you are using the regulator, solder that in too,
then solder both the positive and negative
supply leads to the board.
Special pads to access pins 1, 3 & 6 of
the PIC have been provided on the board
specifically for programming. These are
labelled, respectively, “A”, “B” and “C” on
the component overlay. The pad labelled
“GND” can be connected to the external
programming circuit shown above.
You may solder wires to these pads for
the programming phase and later, when the
micro has been successfully programmed,
remove these wires. Back-up pads for the
links required in normal operation have also
been provided on the PC board.
The type of programmer we recommend
is the “COM84” style programmer whose
schematic appears above. A computer’s
serial port will be required and the software
to use is WinPic, available free to download
from www.hamradioindia.org/circuits/
winpic.php
We used the WinPic version compiled 9th
December 2005 but other versions should
be similar.
After soldering the wires to the A, B and
C pads, you should breadboard this circuit.
The two BC546 NPN transistors are used
to switch on and off the higher programming
voltage, which for normal programming
36 Silicon Chip
+VPP
+5V
2.2k
+5V
10k
BC546
BC546
2.2k
2.2k
22k
2.2k
PIC 10F20x “COM84”
COMPATIBLE
PROGRAMMER
VPP APPROX. +13V
6
(”C”)
3
(”B”)
1
(”A”)
5
PIC
10F20x
2
Both Jaycar Electronics (www.
jaycar.com.au) and Altronics (www.
altronics.com.au) sell a kit of parts
for the PICPROBE.
Jaycar’s kit includes a doublesided PC board with plated-through
holes and all parts, including a preprogrammed micro but not the pen
or the needle. It retails for $14.95
(Cat. KC-5457).
The Altronics kit is similar with a
preprogrammmed micro and no pen
nor needle. It also sells for $14.95
(Cat. K-2587).
PIC TO BE PROGRAMMED
(ON PICPROBE PC BOARD
should be between 12.5V and 13.5V at pin 6.
Adjust your input VPP voltage level to within
this range. There will be a small voltage drop
across the 10kW resistor in series between
VPP and the collector of the BC546/pin 6.
When the Tx line (pin 3) of the serial port
is low, the voltage at pin 6 of the PIC10F20x
should be around 0V. When it is high, it
should be between 12.5V and 13.5V. The
WinPIC software will automatically switch
this voltage on or off as required.
To access the serial port, we used a serial
cable with an IDC 10-pin header attached, as
in the photograph below.
Once you are satisfied that the circuit
is working correctly, you may connect the
serial cable to your computer’s COM1 port.
Now you should run the WinPic pro
grammer. You must first select the “COM84”
programmer for the serial port in the
“Interface” tab. While you are there, check
that the interface is working correctly
by clicking on the “Initialize!” button. If
everything is working OK, you should get
the message “Interface tested OK”. If not,
double check your wiring.
Now go to Device -> Select . . . and select
the PIC10F20x as your device.
You now should be able to erase, program
and read the micro. To load the firmware,
go to File -> Load and select the PicProbe.
hex file. Then choose Device -> Program to
program the micro.
If this worked, go to Verify to check that
the firmware has been programmed correctly.
Latch mode is similar, in that when
CHANGE is set the orange LED is
turned on but is not cleared until the
button is pressed. This is detected using the BPRESS flag.
Mode changing uses a separate
function labelled “cngmode”. When
this function is called it will blink the
orange LED using simple delay loops
until the button is released. When the
button is released, the LATCH flag is
inverted and the routine exits back to
the main loop.
Construction
Basically, all the parts are installed
on a double-sided PC board – see Fig.2.
This board measures just 106 x 5mm
and should be a relatively snug fit inside the pen case. Don’t push it all the
way in to check, though – you may not
be able to get it back out again.
Note that the PC board shown in
Fig.2 is available only as part of a kit
from Jaycar Electronics. Altronics also
sell a kit for the PICPROBE, using their
own version of the PC board (the assembly instructions are with the kit).
Note that because you’ll be building
the PICPROBE from a kit, the PIC micro
will be supplied ready programmed.
You need to decide if you want to use
your logic probe for low-voltage work
only (as in the original design) or for
general purpose, higher voltage work.
If it is for low-voltage work only (ie, 5V
or less), you can leave out the voltage
regulator and place a link between its
input and output positions.
The first step in the assembly is to
carefully solder the SMD devices to the
PC board but don’t install the PIC just
yet. To install these parts, you will need
a soldering iron with a fine pointed tip
siliconchip.com.au
and a magnifying lamp. A pair
of self-closing tweezers can
be used to hold each device
in position as it is soldered.
Once these SMD parts are
in, solder on the probe tip,
the switch and the external
connection wires. As mentioned earlier, the tip is a
sewing needle. These are often
nickel-plated, which makes
soldering a bit difficult. Test
it first – if it is difficult (or
impossible) to get solder to
take, you may need to file off
a small section of the nickel
plating.
The size of the “probe” is
up to you – and the type of
work you’ll be doing. We’d be
Rigol DS5062MA 60MHz
Rigol DS5102MA 100MHz
inclined to use a small darning
60MHz Bandwidth
100MHz Bandwidth
needle, as these tend to have
1GS/s Real Time Sampling
1GS/s Real Time Sampling
less of a point (so you won’t
2
Channels
2 Channels
get stabbed!) but are still fine
Mono
LCD
Display
Mono LCD Display
enough for the vast majority
4K
Memory
Per
Channel
4K Memory Per Channel
of work.
20 Automatic Measurements
20 Automatic Measurements
The needle we used was
Advanced
Triggering
on
Edge,
Advanced Triggering on Edge,
about 35mm long and so far,
Video & Pulse
Video & Pulse
still hasn’t been missed from
Built-in FFT
Built-in FFT
the sewing box (;-).
Built-in USB
Built-in USB
Don’t forget that the power
3 Year Warranty
3 Year Warranty
wires (polarised figure-8 cable) need to pass through the
pen top cap so it is wise to
ONLY $
ONLY $
ex GST
ex GST
do this now, rather than later.
You’ll need to drill a hole in
SAVE $300
SAVE $200
the end of the cap to accom* Offer valid until 30th June 2007 or while stocks last.
modate the wires.
The last component to be
fitted should be the PIC chip,
Melbourne Brisbane
Adelaide
Perth
Sydney
Tel 03 9889 0427
Tel 07 3275 2183
Tel 08 8260 8166
Tel 08 9361 4200
as this allows you to check the
Tel 02 9519 3933
Fax 03 9889 0715
Fax 07 3275 2196
Fax 08 8260 8170
Fax 08 9361 4300
Fax 02 9550 1378
LED operation before putting
email testinst<at>emona.com.au
web www.emona.com.au
the PIC chip in. To do this,
connect power and in turn
short the cathode of each LED
to ground (0V). Each should
light in turn (you won’t do
any harm to Q1 doing this).
Next, remove power, wait a few
of course equates to a logic high and
As you do this, also check that the
minutes and then fit the PIC chip to the
logic low).
colours are correct: red towards the
board, taking care with its orientation.
Assembly is now complete – all you
probe, orange in the middle and green
That done, apply power again – the
have to do is drill a 2mm hole in the
towards the switch. If your LEDs light,
LEDs should be flashing in an apparent
pen case as shown in the photo to acit’s a pretty good bet that you haven’t
random fashion but only one should be
cess S1, then slide the completed PC
made any mistakes or shorted out any
lit when you touch the probe tip to the
board into the case until the switch is
SC
SMD pins.
positive supply and then to 0V (which
right under the hole.
RIGOL SCOPES SALE
... SAVE UP TO $300
1,099
799
EMONA
Issues Getting Dog-Eared?
Keep your copies
safe with these
handy binders
Available Aust, only. Price: $A13.95 plus $7 p&p per order (includes GST). Just fill in
and mail the handy order form in this issue; or fax (02) 9939 2648; or call (02) 9939 3295
and quote your credit card number.
siliconchip.com.au
REAL
VALUE
AT
$13.95
PLUS P
&
P
October 2007 37
|