Projects

Design And Make: The Ubiquitous Logic Probe

Bob Harper

Issue 4, October 2017

This article includes additional downloadable resources.
Please log in to access.

Log in

This is the first of our discrete projects! A logic probe is a powerful tool for any maker to have, since it simplifies debugging and testing.

Why do we use logic? Because all modern computers use logic. To not use logic would be illogical!

Logic sometimes fails, however, when the analog levels that control the inputs to gates, or the loading on the outputs, cause a misunderstanding. Logic works when the signal levels comply with logical requirements, (i.e., standards).

TESTING LOGIC AT THE HOBBY LEVEL

Many years ago I learned logic as a means to control stage lighting for rock bands. I knew electronics, but had never even heard of TTL or any of the digital logic technologies, except for switches and relays as I was, at that time, an apprentice electrician.

Later on I used logic ICs, 74xx devices in my first computer that consisted of seven ICs. It didn’t take much more circuitry before I needed something better to test these circuits. Eventually I saw some articles about logic probes and built one, using just four transistors and a few resistors. Recently I was asked if I could make a logic probe and that is where this story began.

MAKER LOGIC

Robotics, 3D printers, CNC mills, routers, and so on are all applications of the inputs and outputs of computers, being used to drive mechanical and opto-electric devices. The logic analyser is a terrific instrument, but overkill; and usually over-priced for hobbyists. Multimeters often have a logic function, but they can be slow, insensitive, and inaccurate. They can also be inconvenient; for example when you’re trying to hold a probe on a tiny pin, and you need to avoid touching the many other tiny pins that sit around it, when looking back and forth at the meter.

HOW IS A LOGIC PROBE BETTER THAN A MULTIMETER?

The logic probe has two or three coloured LED indicators near the probe tip, so the user can see the result without looking away. It also clearly shows three conditions using two of those LEDs. Also, multimeters read logic “0” or logic “1”, but not all meters can handle levels in between. Therefore, they may make mistakes in interpreting an open circuit or dead gate.

WHAT DOES A GOOD LOGIC PROBE NEED TO DO?

As we mentioned, typically logic probes read logic “0” and logic “1”. This may sound simple, but it’s not necessarily the case.

Firstly, it will help to know what type of system it will be used on. On some logic systems, the probe would read up to 48V for a logic “1” on relay logic, and perhaps +/-12V on other systems. Many systems have existed, most are now gone, relay, DTL, ECL and so on.

So let us begin by defining our logic probe as intended for TTL. You might say 0 volts for logic “0”, which although commonly agreed with, is not completely correct. In fact, most systems never actually reach exactly 0V. The truth is, TTL accepts from 0V to 0.8V as meaning a logic “0”, and CMOS accepts 0V to 1.5V as logic “0”, at least on a system with 5V rail voltage (and up to 4V on a system with 15V rail voltage). Then, we realise that the Arduino, along with many other computer systems, use either 5V or 3.3V rail voltage as a modern option. Thankfully, a 3.3V system still uses TTL levels for logic “0” (i.e., 0.8V).

The output voltages are another issue. TTL, either 5V or 3.3V systems, expect the output voltage to be from 0V to 0.5V, while the CMOS system expects the output voltage to be less than 0.05V – the main reason for lower power requirement of CMOS.

Logic “1” levels for TTL inputs (both 5V and 3.3V systems) need to be greater than 2V; but for CMOS, on a 5V supply, the inputs need to be above 3.5V to be a valid “1”.

So a professional probe requires a different design for each system, or a switch to select the system in use. For hobbyists, unless chasing a glitch at the very edge of a system, or attempting maximum “fan-out” (loading), where noise can cause false logic, a hobbyist can suffice with 0V to 0.8V as acceptable logic “0”, and above 2V as logic “1”. In fact, a technician would probably pull out an expensive CRO or logic analyser by then anyway.

LOGIC SHIFTS

In a system where the logic is ‘state determined’ and the outputs don’t change unless an input is changed, logic “0” and logic “1” are quite sufficient. On low speed systems, a flickering pair of red and green LEDs might be enough to say the clock is ticking, but even experienced technicians have difficulty on faster systems. The main issue is knowing whether the system is clocking, or held in a high impedance state or centre voltage (i.e., between a logic “0” and a logic “1”). To identify this, a logic probe can have a ‘pulse’ LED, usually orange, that may simply light when oscillating, or flash at a fixed frequency when a pulsed signal or clock is running. Some probes have a function to ‘catch’ a transition, meaning that the orange LED turns on and latches on until reset.

If the probe tip changes logic, or even if the logic momentarily changes then returns to the initial state, whether correctly following the logic, or due to a glitch, the latch will pick it up. This is useful for catching sporadic and unintentional pulses that may trigger logic circuits intermittently, and especially if the circuit is triggered unexpectedly and unpredictably.

OUR LOGIC PROBE DESIGN

While we would be proud to say we designed a new type of logic probe, it would be very likely that somebody else had already published or uploaded something very close to this design, even if we have done all the hard work ourselves. Anyway, the first step most engineers would take is to research what has already been done. This circuit uses the best method we know of, using a simple IC, and for very little cost.

WHAT DO I WANT?

Honestly? I want something easy to make, which will last forever and cost me nothing! Or as close to that as possible! With this in mind, I researched many existing designs, some as early as 1975, to try to compare approaches.

Hobbyists could easily get away with two LEDs and two resistors, and that approach is good when you need something cheap and/or fast! So long as you realise that you will be getting very basic results, and will be loading the circuit so much you might actually cause logic faults in the process.

So, as in all test instruments, we want the probe to take as little from the circuit as practically possible, and try to be sure that the voltages are within the limits shown in Figure 1 – at least for TTL and perhaps 3.3V TTL.

1
levels graph

Another factor can be the speed of operation, but hobbyists are usually happy with basic technology, so although high speed quad comparators were researched, we settled for an old friend that is easy to find, cheap, and has good manners: the LM339, which is also used in many of the designs already available on the internet and elsewhere.

WHAT IS A COMPARATOR?

A comparator is a type of op-amp that compares the voltage on the two input pins, and decides which voltage is the highest. Then the output is changed to reflect that decision. Op-amps can do this, but are designed as analog devices on both input and output. Comparators are required to switch the output.

Comparators have a “-“ input, and a “+” input, but either input can have a voltage anywhere between the supply voltages applied to them. The “+” and “-“ do not refer to the voltage, but the effect the inputs have on the output.

Device Inputs        Op-Amp Output      OC Comparator Output
+ input < - input      -ve value          Transistor Off
+ input = - input      Analogue            Switching
+ input > - input      +ve value          Transistor On

If the “+” is more positive than the “-”, the output turns on, but if the “-” is more positive than the “+” the output turns off.

Note that the output itself is a transistor with an open collector (OC), unlike most op-amps. OC simply means there is an NPN transistor with the collector connected to that output pin, and the emitter connected to ground via the power supply pins. Therefore, the output does not go high or low, simply on or off. You will need to connect the load between the OC output pin and a positive supply, which can be a separate supply to the IC supply itself.

LM339 QUAD COMPARATOR

The circuit
The circuit of the Logic Probe and it's LM339 Quad Comparator core.

The LM339 has four comparators (hence “quad”) in one 14-pin device; a DIP (dual inline package) device – a through-hole device – is my preference, but SMD and other versions are also available. The inputs do not require much current to detect the logic, typically 25nA (yes, that’s “nano amps”), and the whole device takes 0.8mA total power, regardless of supply voltage, which can be from 2V to 32V. (Note: that does not include the output loads as they are supplied by a separate power source external to the IC power pins.) Therefore, the LM339 will work on 3.3V and 5V TTL systems, as well as CMOS and some others, (with adjustments to some resistor circuit values if you are keen). The output is compatible with TTL, MOS and CMOS, and the current draw per output is rated at 20mA, which is sufficient for directly driving 3mm LED indicators.

Switching speed is the least impressive of the specifications, but only if you can see and think at almost 2MHz. In fact, the design doesn’t require that kind of speed even if the micro runs at 20MHz. The signals on the computer I/O lines will not normally be changing that fast, and pulses can still be detected. I do recommend that when you use any device, you download the datasheet/s and some application notes off the internet, and read them. It is a good way to determine what it all means, and at minimum the datasheets will tell you what pins to use.

THE CIRCUIT

2
figure 2

Take a look at Figure 2. Note what the pins are and try to remember them. Particularly note that pin 3 is the positive or VCC connection, 5V in most cases, and pin 12 is ground.

Each comparator has two inputs (+ and -) and one output. Note the polarity of the inputs on either side of the IC. Comparator 1 has its inputs on pins 6 (-) and 7 (+) and its output on pin 1. Then note that comparator 3 is the same on the other side of the IC, except for the polarity of the pins. Once you become familiar with the symmetry of the pin-out, you’ll find working with the device quick and easy!

For simplicity, we are going to describe the logic probe in two parts, and we’ll start with level detection first.

Beginning with the comparator inputs, there are two voltage dividers at work. The first uses R1 = 18k, and R2 = 10k, to set the logic probe voltage when not connected, to Vcc x (10k/(10k + 18k) volts. When the rail voltage is 5V, the probe will be ~1.78V, or between 0.8V and 2.0V, so neither LED should be lit. The probe voltage is connected to the comparator inputs on pins 5 and 6, via two 100k resistors, R3 and R4. You’ll note that another 100k, R14, takes the probe voltage to pin 10 for the pulse circuit. We’ll explain that section later.

When the rail voltage is 3.3V, the probe will be ~1.2V, so as before neither LED should be lit, and 3v3 TTL can be tested without issue.

For a CMOS circuit, two resistors of the same value should be used for R1 and R2, but the values used for TTL will also work on CMOS, and no changes are necessary.

The second voltage divider chain using R3, R4 and R5, set the two reference values, 0.8V for “0” level TTL on comparator pin 4, and 2V for “1” level TTL on comparator pin 7. The string is designed for 5V TTL but works on 3v3 TTL with a little error in the absolute threshold values. For standard 5V TTL, R5 = 18k, R6 = 8k2 and R7 = 4k7 respectively giving reference values at pin 4 of 775mV, and 2.04V on pin 7.

The switch allows the user to swap between two references: standard TTL in the forward position, and a second option in the back position. Assuming CMOS is the second option, the resistors should be R20=R6=R21 = 8k2. If you want a more exact reference for working on 3v3 TTL, R6 remains as 8k2, as it is common to both switch positions and both options of CMOS and 3v3 TTL. Use a 10K for R20, and 5k6 for R21, only if you intend the second switch position to be used for 3v3 TTL.

CONSTANT CURRENT LED DRIVE

The LEDs on the outputs of the comparators are on pin 1 (“1”) and pin 2 (“0”). To keep the brightness of the LEDs about the same from 3V to 15V, a constant current source has been built using D1, D2, Q1, R10 and R11. R10 limits the current to 20mA, but the supply is shared between LED 1 and LED2 as they do not come on together.

REVERSE SUPPLY VOLTAGE PROTECTION

In the dreaded situation where a technically-minded person connects the red wire to ground and the black wire to 5V (as happens from time to time), R22 and D3 limit the reverse voltage across the LM339 to -0.6V, but R22 will start burning out and letting the smoke out; so consider it a sacrificial fused resistor!

circuit boards

THE PULSE CIRCUIT

The pulse detector has a basic function in what it can do, as we wanted to keep the logic probe simple. In reality, it did start to collect more parts than originally intended. The basic circuit configuration is a monostable multi-vibrator (a name that takes up more space than the actual circuit!). Put simply, a brief trigger at the input, causes the output to turn on for a timed period.

We begin at the probe, where we are more interested in the change in voltage than the actual voltage. Therefore R14, another 100k is connected to pin 10 via C2, a 1 nanoFarad capacitor. The capacitor will only pass a current when the voltage is changing.

R12, 1M0 and R13, 100k set up a reference voltage on pin 10 of about 450mV. Comparator pin 11, due to the voltage divider using R8, 1M0, and R9, 68k, has a set value of about 290mV, for reasons we’ll get to later in the loop!

The output of comparator 3 remains off in normal conditions. When the pulse of current presents at pin 10, it becomes temporarily more negative than pin 11 and it’s output, pin 13 turns on which discharges C1. This turns comparator 4 off, which lifts the voltage on R9, so pin 11 is again higher than pin 10, turning comparator 3 off.

For comparator 4, R16, 220k and R17, 100k set pin 9 to about 1.6V, with some feedback from R18, 10M pulling pin 9 a little lower in normal times, but a little higher when the LED is on. This is positive feedback and serves as a Schmidt trigger, to add hysteresis to the switch.

Pin 8 of comparator 4 has the RC timing circuit using R15, 1M0, and C1, 1uF. The timing constant of this pair is 1 second, for 63% of the supply voltage. However, pin 8 is compared to the voltage on pin 9, ~1.6V, so switches in about one-third of a second. A longer pulse would result if R16 were made 100k, for example.

So what happens to comparator 4, is comparator 3 grounds pin 8, turning the output transistor off.

Transistor Q2 is turned on by bias resistor R23, which has been reduced to 330Ω as Q2 was not turning completely off. It sounds wrong but comparator 4 output wasn’t pulling the base of Q2 low enough.

The orange LED, LED3, has a simple ballast resistor, R19, 1k0, although it might have been powered by the constant current circuit, sharing current with the other LEDs.

C1 charges with the current flowing in from R15, until the voltage across C1 reaches the value on pin 9, and as soon as it exceeds that value, comparator 4 turns on, grounding the base of Q2. Everything is back to starting position except that C1 will continue to charge until it reaches rail voltage. The circuit is ready for another pulse.

ASSEMBLY

While this object can be built from proto board or similar, it will quickly end up as a rat’s nest, so we recommend using a PCB or kit from one of the supporting suppliers. The PCB is shaped and sized so it will be a natural size to hold for testing a circuit, and the probe tip and LEDs are all at one end, while the power leads and switch are at the other end. So doing it this way means not only will you have somewhere to put the components, but you won’t have to guess where the connections go!

HOMEMADE PCB

The PCB was in fact designed as a single-sided board, and those keen enough can download the PCB pattern from the website. Just be sure to use the “single-sided” pattern, which has wider tracks and larger pads for easier hand-drilling. You will need only two links of wire on the top-side of the PCB.

For commercially available boards, double-sided PCBs are often the same price as single-sided boards, so the links are integrated into the PCB already. There's not a whole lot of spare space on the board, so it does make life a little easier.

POWER

We did argue a little – but only between gentlemen – about options for the power supply. While a 9V battery would power it and be reasonably tidy, it also required voltage regulation and special consideration for CMOS above the supply voltage.

In the end any kind of battery was disqualified as unnecessary when the thing is used to test a powered circuit anyway. Using the supply from the “DUT” (device under test) is the norm for logic probes, as they don’t require much current anyway.

Still there may be options. My own probe had the leads ripped off it once, so I used a speaker cable with a pair of IC clips. When everything was TTL in DIP ICs, I simply clipped onto pins 7 and 14, or whatever the supply pins for the ICs were. I still think that’s the way for ICs with legs!

Those who work mainly on Arduino, Raspberry Pi and such, may prefer a pair of male pins or female sockets (PIN-header-style) to go straight onto the supply pins/sockets. Alternatively, you might like to use alligator clips, or even solder the wires onto the DUT power supply. Others may prefer having a USB plug and lead, and even use a USB plug pack. All these options can have the wires soldered directly into the PCB, or place a right-angle two-pin header into the power pads, and plug onto them with a two-way 0.1-inch socket. It all really comes down to what you intend to work on.

REF :COMPONENTS :JaycarAltronics
R118k Resistor RR0602 R7588
R210k Resistor RR0596 R7582
R3100k Resistor RR0620 R7606
R4100k Resistor RR0620 R7606
R513k Resistor RR0599 R7585
R68k2 Resistor RR0594 R7580
R74k7 Resistor RR0588 R7574
R81M0 Resistor RR0644 R7630
R968k Resistor RR0616 R7602
R1033R Resistor RR0536 R7522
R111k0 Resistor RR0572 R7558
R121M0 Resistor RR0644 R7630
R13100k Resistor RR0620 R7606
R14100k Resistor RR0620 R7606
R151M0 Resistor RR0644 R7630
R16220k Resistor RR0628 R7614
R17100k Resistor RR0620 R7606
R1810M Resistor RR0660 R7094
R191k0 Resistor RR0572 R7558
R208k2 Resistor RR0594 R7580
R218k2 Resistor RR0594 R7580
R2233R Resistor RR0536 R7522
R23330R Resistor RR0560 R7546
C11µF Electrolytic 25V RE6032 R4718
C21nF Capacitor MKT 100V RM7010 R3001B
D11N4148 Diode ZR1100 Z0101
D21N4148 Diode ZR1100 Z0101
D31N4004 Diode ZR1004 Z0109
LED1Red LED 3mm ZD0100 Z0700
LED2Green LED 3mm ZD0120 Z0701
LED3Orange LED 3mm ZD0119 Z0705
Q1BC557 Transistor PNP ZT2164 Z1055
Q2BC547 Transistor PNP ZT2152 Z1040
IC1LM339N Quad Comparator ZL3339 Z2532
S1DPDT Switch SS0823 S2060
REF :Other Hardware :
PROBE1-pin eg.Test Probe -or- Canvas Needle
PWR2-pin Pin Header, 2pin-RA, polarised, (optional)
PWR2-pin Pin Header, 2pin socket header
PWR-clipIC-Clip IC Pin Test Clip Red
PWR-clipIC-Clip IC Pin Test Clip Black
PCBDIY1709-1 Printed Circuit Board, DIY17091-1
Dims3.05” x 1.05” (88.9 x 26.7mm) (88.9 X 26.7MM)
CaseDIY1709-1-33D printed case, (see text)

Note: Our part numbers may denote a pack of parts, such as resistors which are often sold in a pack. We have suggested probe-tip hardware and other methods. Kits sold for this project may contain other suitable hardware for this purpose, and may not precisely match this list.

GROUND LEAD

If you intend to use a dedicated power supply, which isn’t connected to the DUT, the logic probe requires a ground lead that should be soldered in with the negative power wire, or onto the pad beneath the PCB. Using the DUT power supply avoids the requirement of a ground lead. This convenience is why we used DUT for power.

PROBE TIP

The kind of probe you use is dependent on your needs for the logic probe itself. You might want a good strong probe, or a tiny pin probe for getting into socket headers (for example). With this second user preference in mind, the PCB is made using a largish pad for a wire, with two smaller pads (not connected to ground) for a wire loop, to mechanically support the probe tip.

In the past, my TAFE students have used 1mm2 (and bigger) electrician’s copper wire, copper boat nails, darning needles, MIG welding wire, and many more clever solutions. One little known trick to make soft copper wire become hard, is to beat it with a hammer, rolling it as you go, so it remains basically round.

The hole in the end of the 3D printed case allows you to use a probe from an old multimeter lead, or a new one if you like. Sometimes it’s handy to leave the probe connected to a wire, pin or circuit, so you can work hands-free. A short lead with an IC clip on one end and an alligator clip on the other can also be handy. Be inventive!

PCB ASSEMBLY

The usual rule for manual assembly is “hardware, passive, active”, meaning that you fit sockets, switches, and pins first. If you do use a two-pin header or whatever, or fit the power now, you can perform tests as you go, to make sure you have it all in the right places and soldered correctly.

So with the switch, probe and power soldered in, connect it up and check that you have 5V as expected, and where expected. It is a good practice to assemble in stages and test as you go, rather than loading up every component and soldering everything in one go.

PASSIVE COMPONENTS

The resistors and capacitors come next, and a suggestion may be useful. If you think you might like to replace components at some stage, solder the component leads and cut them off close to the PCB. If you need to change one, it will be easier to get out.

The alternative, used in the industry and military, is to cut leads to about 1mm, bend them over, either flat against the PCB or at about 45 degrees, depending on just how harsh the mechanical forces on the PCB may be, and solder to cover the component pin as well as making the joint. This is a devil to remove without dedicated rework stations.

Make sure each joint is clean and shiny, and there are no “inclusions” (i.e., bits of nasty things unexpectedly stuck in the solder).

Out with the multimeter, and power up the circuit. There is a table provided with all the voltages to expect on the IC pads, for when the correct components are in the correct places, and are correctly soldered.

Compare your values to those in the table shown below.

CONDITIONNO ICPROBE FLOATINGPROBE HIPROBE LOWPULSE LED OFFPULSE LED ON
Pin 10.0023.4822.823.483.48
Pin 203.482.61.963.483.48
Pin 35.165.13
Pin 40.795
Pin 51.831.835.11 0.004 1.83 1.83
Pin 61.831.835.11 0.004 1.83 1.83
Pin 72.159
Pin 84.71.5861.586 1.575 1.586 0
Pin 91.841.61
Pin 100.470.47 0.47 0.47 0.47 0.47
Pin 115.130.938 0.938 0.938 0.938 0.938
Pin 1200
Pin 134.71.587 1.586 1.586 1.586 0
Pin 145.160.651 0.29 0.29 0.29 0.29

ACTIVE COMPONENTS

Active components are the most sensitive to heat and static electricity, so they should be left until last.

Place and solder the diodes and transistors, as well as the LEDs, but leave the IC until later. Be very careful with the active components – make sure you have the polarity correct. Check all the connections as above, and then check the voltages.

Use a small piece of wire to short the pads of pins 1, 2 and 14, to the ground, pin 12. Each of the LEDs should light: LED 1 and LED 2 when the short is in place, and LED 3 when it is not in place. This has also tested the constant current transistor Q1, and transistor Q2.

LM339 PLACEMENT

The LM339 quad comparator IC is fairly robust, and the PCB has some basic protection against reverse voltage, but if you are unsure about your soldering, you might like to use a low profile IC socket. This way you can make sure your soldering is clean and tidy, no shorts, whiskers, or dry joints, and then fit the 14-pin IC. The dimple near pin 1 (i.e., the little curved bit taken out of one end), goes where the little bite is taken out of the overlay print. Don’t laugh – even us old hands do it wrong sometimes!

FINALLY!

The big moment has arrived, and if you have passed all the tests so far, you should be looking at success. Power up, and nothing should happen – especially, no smoke. With a piece of jumper wire attached to the probe tip, touch pin 3 and the red LED should light. The orange LED should also come on briefly, about one-third of a second. Touch the ground, pin 12, and the green LED should come on. Note: I could have told you to put the switch in the forward position, but it doesn’t really matter if we’re looking for a good ground or positive rail.

LEVEL TESTING FIELD

If you really want to, you can check your actual levels by putting a potentiometer between ground and 5V, and the probe on the wiper pin, and adjust until the green “0” LED just goes out. Read, and record the voltage, and then adjust until it just turns on; then read and record again, and see how much hysteresis there is. Note that no hysteresis is actually designed into the circuit, on the levels at least.

Likewise, adjust until the red “1” LED just comes on, read the voltage and record, and then adjust it until it just goes off; then read and record again. The values should not be very different, and should be less than 0.8V for a logic “0”, and more than 2V for a logic “1”; this is with the switch in the TTL position.

You can try it also in the CMOS position, and for different voltage supplies up to 15V. Low should be about one-third supply voltage, and high should be about two-thirds supply voltage.

case

3D PRINTED CASE

We have designed a handy case for mounting the probe, so it can easily become part of your toolkit.

The case has two snap-ins to hold the PCB in place, while the case halves snap together for a neat fit. The case may want to stay that way, so make sure you’re ready to leave it together, or perhaps sand the snap-ins so it goes together easily, and therefore comes apart easily. If the PCB is tight, it forces the sides of the case out, so make sure the PCB fits well before tackling the lid. Checking you have no protrusions from your PCB will help ensure a neat fit too.

It could be perpetually fine tuned, but PCB manufacturers will vary, and some of the “fit” depends on the 3D printer and how it is set up. The original case was designed in OpenSCAD, and we've provided the SCAD file to make any changes relatively easily too. For those of you using Tinkercad or similar software, you can easily import the STL file and add/remove shapes from the core design too, though some modifications are much easier to make in OpenSCAD as it can re-render the shapes from scratch.

USING YOUR NEW PROBE

Obviously one caveat we must make is to never use this logic probe on voltages above 15V, or any device that runs on live ac current. IT IS NOT CatIII-rated, and isn’t meant to be. It's meant for TTL / logic levels only.

Now that we’ve clarified that point, take a probe around a running Arduino or such. Using the DUT’s power supply avoids requiring a ground wire, and the probe has enough input resistance to be kind to your circuits.

If you strike a test point that doesn’t light, or lights intermittently either high or low, but doesn’t hold at least one LED on, then it is probably spending a lot of time in between a logic high and a logic low, or has a high impedance. Either way, you may have found your fault!

Logic probes take a little learning before you really know how to use one well, but once you get your proficiency badge, you’ll always have that skill in your kit.

ADVANCED TESTING - ARDUINO

If this is the first time you've used a logic probe, some advanced testing might be worthwhile to fully appreciate the relationship between the logic levels in your code (or created by an integrated circuit), and the actual levels and voltages presented in a circuit.

For this reason, we have created a basic Arduino Sketch, which you can use as a powerful test tool. It will also put your probe through its paces in an Arduino specific environment.

The sketch is quite simple, and you can elaborate on it further to test all pins. This is also a valuable education exercise.

int lowPin = 5;
int highPin = 6;
int pwmPin = 9; 
void setup() {
  // set these pins as outputs
  pinMode(highPin, OUTPUT);
  pinMode(lowPin, OUTPUT);
}
void loop() {
  digitalWrite(highPin, HIGH);
  digitalWrite(lowPin, LOW);
  analogWrite(pwmPin, 10);
    }

What we have effectively done here is quite simply, set pin 5 to LOW, pin 6 to HIGH, and pin 9 (which is a PWM-enabled hardware pin) to a low value.

You may notice that in the setup function, we have specified our high and low logic pins as OUTPUT, but not our PWM pin. This is because the analogWrite function does this automatically.

It's important to remember to use the pinMode function in setup for any standard digital outputs.

We have also included this sketch as probe_test.ino in the digital resources too. Load the sketch onto your Arduino.

Connect power for your probe to the 5V and GND pins on your Arduino. While you should have performed basic tests on your probe already, if you want to be sure your probe is working, you can touch the probe tip onto the 5V or GND. You should see the red or green LEDs illuminate respectively. As long as this occurs, move on to the pins we have specified in the sketch.

test

LOW: Touch the probe tip to pin 5, which we have set with a LOW output. You should see the green LED illuminate.

HIGH: Touch the probe tip to pin 6, which we have set with a HIGH output. You should see the red LED illuminate.

PULSE: Touch the probe tip to pin 9, which we have set with a PWM output.

You may also notice that the green LED is illuminated. This is because we have set it to around 4% duty-cycle (more accurately, 10/255, or 0.3921... but who's counting). This is because the probe features some great functionality. When a pulse width output is detected, the red and green LEDs act as a duty-cycle reference. When the duty cycle is low (that is, off more often than on), the green LED will illuminate alongside the yellow pulse indicator.

int ledPin = 9;
  void setup() {
  // nothing happens in setup
}
void loop() {
  // fade in from min to max in increments of 5
  for (int fade = 0 ; fade <= 255; fade += 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fade);
    // wait 300ms to see the dimming effect
    delay(300);
 }
  // fade out from max to min in increments of 5
  for (int fade = 255 ; fade >= 0; fade -= 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fade);
    // wait 300ms to see the dimming effect
    delay(300);
  }
}

Likewise when the duty cycle is high (that is, on more often than off), the red LED will illuminate alongside the yellow pulse indicator. Of course, when the pulse width is somewhere in between, you will see all three LEDs illuminated.

Component tolerances will affect the precise points where the high and low LEDs switch on and off when the probe is in pulse mode. However, to demonstrate this, we can utilise a modified version of the FADING example sketch included with the Arduino IDE. Ours is not too different from the example provided with the software, however we have slowed the cycle down considerably so it's more visible and you can watch it go through the full cycle from 0% to 100% duty cycle, and back again. This sketch is provided in the resources as probe_pwm_cycle.ino. Load it onto your UNO and touch the probe to pin 9, watching what happens!

WHAT ABOUT A RASPBERRY PI?

The beauty of logic is that it's, well - logical. The process for coding a similar test on Raspberry Pi is fairly similar. But we've done it for you, providing the sample Python scripts in the resources.

Of course, you still need to tell the Raspberry Pi what you're doing, and set the various pins to have their respective outputs.

Here is a basic Python code to achieve something fairly similar to probe_test.ino, but it's Python so we'll call it probe_test.py (i know, we're very creative).

Load probe_test.py in IDLE and run. Since Raspberry Pi pins are unlabelled, it's easiest to use a GPIO breakout adaptor which provides full labels on each of the pins.

Again, you can verify your probe is powered and working properly by touching the tip to any of the GND or 5V pins on the Pi, and looking for the green or red lights respectively.

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM) 
lowPin = 5
highPin = 6
pwmPin = 13
GPIO.setup(lowPin, GPIO.OUT)  # set up pin 17
GPIO.setup(highPin, GPIO.OUT)  # set up pin 18
PWM1 = GPIO.PWM(13, 100) # enable software PWM
GPIO.output(lowPin, 0)  # send pin 5 low
GPIO.output(highPin, 1)  # send pin 6 high
PWM1.start(10)     # start PWM at 10%

As in the Arduino examples, we'll also provide an example for a cycling PWM output so you can see the effect it has on the probe. Load and run probe_pwm_cycle.py. Pin 13 should start looping through the cycle taking it from 0% duty cycle to 100% duty cycle, and continue on forever (well, until you forcibly quit the programme).

testing

The interesting thing about Raspberry Pi PWM is that there's only two hardware PWM channels. Most PWM functionality is derived from software PWM via the GPIO library. For most purposes, it's perfectly adequate and opens up far more functionality than would otherwise be provided for this purpose.

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM) 
PWM1 = GPIO.PWM(13, 100) # enable PWM at 100Hz
PWM1.start(0)     # start PWM at 0%
while 1:
  for level in range(0, 101, 5):
    p.ChangeDutyCycle(level)
    time.sleep(0.5)
  for level in range(100, -1, -5):
    p.ChangeDutyCycle(level)
    time.sleep(0.5)

So there you have it! Go forth and conquer logic with your new logic probe, and newfound understanding of how it works!

Buy The Logic Probe Kit: ALTRONICS JAYCAR
K9800KD6100