LED TESTER
This device will allow you to:
1. Test low power LEDs, including surface mount types,
2. Display its’ intrinsic voltage drop (VLED),
3. Adjust its’ brightness by changing the current through it (iLED),
4. Choose any voltage up to 9V that you plan to use the LED for in a project (Vtarget), and
5. Based on the above parameters, will display the proper resistance to use for that LED (RLED).
6. Detect shorted contacts during testing.
7. Control contrast/brightness of the LCD.
Giving Credit Where Due
Firstly, complete credit for this idea and core circuitry
goes to the author of robotroomTM (please see his original article at http://www.robotroom.com/LED-Tester-Pro-1.html). I adapted his idea for use with the PIC 12F683, using the very easy (and powerful) Great Cow Basic for coding. To accommodate the low pin count on the PIC, I used the 2-wire LCD circuit by Myke Predko (see http://www.hobbyprojects.com/quick_circuits_reference/microcontroller_circuits/2_wire_lcd_interface_using_PIC16CF84.html).
Materials Needed and Parts List
Eagle for Schematic & Layout
Great Cow Basic for coding
Superfine hobby saw
Parts list:
Part Value
C1 0.1uF CAPACITOR
C2 1uF POLARIZED CAPACITOR
C3 0.1uF CAPACITOR
C4 0.1uF CAPACITOR
C6 0.1uF CAPACITOR
C7 1uF POLARIZED CAPACITOR
C8 0.1uF CAPACITOR
D2 1N914 DIODE
IC1 PIC12F683 PIC12F683P
IC2 74LS174N Hex D type FLIP FLOP, clear
R1 1K RESISTOR
R2 10K POTENTIOMETER
R3 500 POTENTIOMETER
R4 10K POTENTIOMETER
R5 47 RESISTOR
R6 10K RESISTOR
R7 10K RESISTOR
R8 47 RESISTOR
R9 100 POTENTIOMETER
FEMALE HEADERS FOR LCD, EXTERNAL LEDS
SMALL SPDT SWITCH FOR ON/OFF
LM317 VOLTAGE REGULATOR
MCP1702-5V VOLTAGE REGULATOR
BACKLIT 8X2 LCD WITH 16 PIN MALE HEADER
Schematic
Downloads
Layout
Downloads
CODE
;LED tester, derived from Robot Room project
;original project from http://www.robotroom.com/LED-Tester-Pro-1.html
;Uses 2 wire setup for LCD
;uses PIC 12F683
;Since need 3 analog inputs, will use An0,AN1,AN2, and
;will use GP4 & GP5 for the 2 wire output to the LCD.
;-----------------------------------------------------------------------
;Hardware Setup:
;INPUTS - LED high from circuit to AN0 (pin7)
; LED low from circuit to AN1 (pin 6); this is the current sense resistor
; 10K Target voltage pot wiper to AN2 (pin 5), ends to +5V & GND
; GP3 (pin 4) to +5V so not floating.
;OUTPUTS - GP4 (pin 3) to LCD DAT
; GP5 (pin 2) to LCD CLOCK
;-----------------------------------------------------------------------
;Chip Settings
#chip 12F683,8
#config MCLRE=OFF ;no external reset
;2 wire LCD setup
#define LCD_IO 2
#define LCD_DB GPIO.4 ;shift register data on GP4, pin 3
#define LCD_CB GPIO.5 ;shift register clock on GP5, pin 2
;Main Program
Dim ledhigh, ledlow, Vtarget as long
Dim Vled, Iled, Rled as word
;inputs
#define high AN0
dir AN0 in
#define low AN1
dir AN1 in
#define target AN2
dir AN2 in
;Define custom characters arrays ("ma" and "ohm")
dim index as byte ;custom character bytes
lcdcmd 64 ;go to base address of character 0 in CGRAM,
;writing continues for subsequent characters
Dim AA(8)
AA() = 0x0A,0x15,0x11,0x04,0x0A,0x0E,0x11,0x00
;"ma" character, written into CG RAM address 64 (= ASCII 0)
gosub write
AA() = 0x00,0x00,0x0E,0x11,0x11,0x0A,0x1B,0x00
;"ohm" character, written into CG RAM address 72 (= ASCII 1)
gosub write
goto resume
;Write each character into CGRAM of LCD circuitry----------------------
write:
Set LCD_RS On
for index = 1 to 8
LCD2_NIBBLEOUT Swap4(AA(index))
LCD2_NIBBLEOUT AA(index)
next
return
resume:
;Main program loop
do
;-----scale inputs
ledhigh = ReadAD10(high)
ledhigh = ledhigh * 5000
ledhigh = ledhigh / 1023
ledlow = ReadAD10(low)
ledlow = ledlow * 5000
ledlow = ledlow / 1023
Vtarget = ReadAD10(target)
Vtarget = Vtarget * 9000
Vtarget = Vtarget / 1023
;-----calculated results:
Vled = (ledhigh - ledlow) * 2
Iled = ledlow/47
ledlow = ledlow * 10
ledlow = ledlow/47
If (ledlow % 10) >= 5 then Iled ++
ledlow = ledlow * 47
ledlow = ledlow / 10
Rled = (Vtarget - Vled) / Iled
;Printing to display:
If Vled/1000 = 0 then
locate 0,0 : print "SHORTED "
locate 1,0 : print "CONTACTS"
goto resume
End if
If ledlow < 50 then
locate 0,0 : print " Touch "
locate 1,0 : print " LED "
goto resume
End if
Locate 0,0
Print Vled/1000 : Print "."
Print (Vled % 1000)/100 : Print "V"
locate 0,6
If Iled < 10 then
locate 0,4 : print " " :print Iled
else
locate 0,4 : print " " :print Iled
End if
locate 0,7 : LCDWriteChar 0
Locate 1,0
Print Vtarget/1000 : Print "."
Print (Vtarget % 1000)/100 : Print " "
Locate 1,5
If Rled < 100 then
locate 1,4 : print " " : print Rled
else
locate 1,4 : Print Rled
End if
Locate 1,7 : LCDWriteChar 1
loop
Screen Shot
Construction Notes
Construction notes:
Þ Solder the wire connections (red, yellow, and pink in the layout) first, then the components which will be covered by the LCD (see photograph).
Þ The 2 copper pads are actually a single piece of PCB with a superfine slit in the copper layer to separate them electrically. The pads are soldered by wires to underlying PCB traces. The pads are also mechanically connected to the underlying board by 2 screws; this allows for replacement if the pads wear out from repeated use.
Þ Note the 16 pin female header accepts the LCD with presoldered 16 pin male header.
Þ 6 pin female header between pads for testing LEDs via wires if desired.
Notes About Battery Power
- A 9V battery will work for most LEDs until it drops below ~6.5V.
- Use a fresh battery for blue LEDs; won’t work if drops below ~8.2V.
- Need new battery if cannot raise current to desired level with adjustment of iLED pot, or current drops when test a blue LED.