element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
DIY Test Equipment
  • Challenges & Projects
  • Project14
  • DIY Test Equipment
  • More
  • Cancel
DIY Test Equipment
Blog DIY Test Equipment: The Di-o-Matic, a Simple Diode Tester [Arduino]
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join DIY Test Equipment to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: jc2048
  • Date Created: 5 Aug 2017 3:09 PM Date Created
  • Views 2160 views
  • Likes 17 likes
  • Comments 5 comments
  • diytestequipch
  • ardexperts
  • arduino_projects
  • arduino_classic
  • arduino uno project
Related
Recommended

DIY Test Equipment: The Di-o-Matic, a Simple Diode Tester [Arduino]

jc2048
jc2048
5 Aug 2017

I really should be doing other things, but I can't resist doing another quick piece of DIY Test Equipment. Again I'm

going to post it here in my blog. I haven't worked it up into a polished piece of equipment - it isn't even really

finished - instead I'm piecing together a design that you could take 'as is' and finish nicely or use the building

blocks for something quite different.

 

This time it's a diode tester. Operation is quite simple: I'm going to pass a current through the diode and measure the

forward voltage across it. The current will be controlled by the processor and the voltage read by the processor's ADC. I

only intend it for signal diodes and LEDs, so the current will only go up to 50mA (it would be possible to adapt it for

higher currents if you wanted to, but you'd have to look carefully at the power dissipation of the transistor). I'm going

to rely on the person doing the test to get the diode the right way round and not try to sense and correct for that with

the circuit. For the kind of diodes you'd test with this, they'd all stand 5V reverse voltage (the lowest are usually LEDs,

but they are generally specced at 5V or 6V maximum reverse voltage).

 

Here's the circuit that I pieced together in the simulator. (The ammeter is there so that I can see the current - for the

built circuit, replace it with a wire.)

 

image

 

And here it is built on a breadboard

 

image

 

I've chosen the op-amps on the less-than-scientific basis that I happened to have some, they're in DIL packages, and

they're cheap. This is a dual op-amp; the two devices are in a single 8-pin DIP package and share the supply pins. You

could substitute something with a more appropriate spec if you wanted to. The main disadvantage of these is that, though

they'll operate down to a supply of 3V (which means they'll be fine on the Arduino's 5V) and they will more or less reach

ground on the input and output, they fall 1.5V short of the positive rail on both input and output. That's a limitation of

many older bipolar op-amps, although it's fine in this case as it doesn't affect the circuit I've come up with.

 

To understand the circuit let's divide it into three sections. Firstly, the PWM output from the Arduino is smoothed by a

simple second-order filter made up of R2, C1, R3, and C2. The resistor on the output of the filter

means that it will reduce the voltage of the PWM (5V) to a range of a tenth of that (0-0.5V at the input of the op-amp). A

disadvantage of using PWM like this, rather than a DAC, is that there will be quite a long settling time, but that's ok as

long as we're aware of it and take it into account when writing the software.

 

Next there is a precision current sink. The feedback around U1 controls the transistor to make the voltage across R1, the

current sense resistor, the same as the input voltage. With a 10 ohm resistor for R1, an input range of 0-0.5V will give a

current of 0-50mA, with the current being proportional to that input voltage. Since the collector current is almost the

same as the emitter current (within 0.5%, or so), that means the current through the diode will be proportionally

controlled by the PWM. [I could have done better here with a MOSFET - feel free to substitute one if you want, but make

sure its threshold voltage is quite low.]

 

Finally, there is a differential amplifier made from U2. This amplifies the difference in potential between the two ends

of the diode. In fact, I've chosen the resistors to only give unity gain, so the voltage out [relative to ground] will be

the same as the potential across the diode. Because of the limitation on the range of the output of the op-amp, that will

only get us up to 3.5V. I decided I could live with that - I'm not going to be testing many diodes that would have a forward

voltage of greater than 3.5V with only 50mA of current flowing through them, the only diodes that will get up to that would

be blue, green or white LEDs and you wouldn't normally run them at 50mA anyway.

 

That all works fine in the simulator. The next step is to build it and see what it does in practice. I've written a sketch

to sweep the PWM from 0 to 255 so we can look at the waveforms on an oscilloscope.

 

This first trace shows the PWM and the ripple after the filter. The filter isn't perfect and the lowish repetition rate of the PWM

on the Arduino isn't helping. That ripple represents about 8% of the fullscale current, so there's no way I can claim this to be

precision instrumentation. It could be improved either by increasing the PWM rate, increasing the amount of filtering, or by moving

away from the PWM and using a DAC to control the current. Something that saves me a bit is that the non-linear characteristic

of the diode means that there's much less ripple at the output. So this isn't a commercial design that you'd sell, but it's ok as

a very cheap circuit, with few bits, that you can throw together quickly and will do something useful and allow you to experiment

with hardware. [If you wanted to try a DAC version, consider either a PSoC device or some of the ST parts that have built-in DACs.]

 

image

 

Ripple on the output voltage

 

image

 

This trace shows the voltage at the input of U1 [yellow trace], as generated by the PWM, and the voltage at the output [blue trace].

This is with a 1N4148 as the device under test. You can see the non-linear characteristic of the diode quite

clearly. (You can also see the way that the yellow trace fattens halfway up where the ripple is at its worst.)

 

image

 

Now a trace with a blue LED as the DUT [device under test]. Here the forward voltage is much higher.

 

image

 

If you look at the higher current end of the trace, you can see where the forward voltage has flattened at about 3.6V. That's

where the output of the op-amp has reached its limit - if you substituted a part with a 'rail-to-rail' output, you'd get the rest of that curve.

 

The output voltage can be read by the Arduino's ADC and there are several ways this could function as a tester. One way would

be to have a selection of 'spot' currents that could be selected or cycled round. For testing LEDs, currents of 5mA, 10mA,

15mA, 20mA, would allow the brightness to be assessed as well as giving the forward voltage at commonly used currents.

A more ambitious instrument could sweep the input and plot the curve. I'll leave all that as an exercise for the

reader. It would also be quite simple to build a version that didn't use the processor at all - a potentiometer at the

input to set the current and a meter to read the diode voltage would do, with the whole thing operating off of a battery.

 

Finally, and rather belatedly, here's the very simple code that sweeps the PWM:

 

int pwmout = 3;               // the PWM pin used for output
int pwm_output_value = 0;     // PWM output value
// the setup routine runs once when you press reset:
void setup() {
  // declare pin 9 to be an output:
  pinMode(pwmout, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
  // write to the PWM output
  analogWrite(pwmout, pwm_output_value);
  // change the value for next time through the loop:
  pwm_output_value = pwm_output_value + 1;
  // reset when we get to max value
  if (pwm_output_value == 255) {
    pwm_output_value= 0;
  }
  // wait for 2 milliseconds
  delay(100);
}

 

If you found this interesting and would like to see more of the blogs I've written, a list can be found here: jc2048 Blog Index

  • Sign in to reply

Top Comments

  • DAB
    DAB over 8 years ago +4
    Nice simple project for makers to try. I could see @John Wiltrout building one to test his salvaged parts. Are you listening John? DAB
  • jw0752
    jw0752 over 8 years ago +3
    Hi Jon, DAB is right I do think this is a neat circuit and I really like to see things like this on the forum. I am sure there are a lot of silent members that like to experiment with this type of circuit…
  • balearicdynamics
    balearicdynamics over 8 years ago +2
    Like this project I suggest you to put it on the Project 14 list, it is the wort as it is also inspiring and open to hackings and evolutions. Enrico
  • jc2048
    jc2048 over 6 years ago in reply to kristotlego

    Thanks for pointing that out. I've just added it.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • kristotlego
    kristotlego over 6 years ago

    Where's the code? Please share it.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jw0752
    jw0752 over 8 years ago

    Hi Jon,

    DAB is right I do think this is a neat circuit and I really like to see things like this on the forum. I am sure there are a lot of silent members that like to experiment with this type of circuit.  I have a bunch of things on my plate right now but I will bookmark this and get back to it when I catch up.

    John

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 8 years ago

    Like this project image

    I suggest you to put it on the Project 14 list, it is the wort as it is also inspiring and open to hackings and evolutions.

     

    Enrico

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 8 years ago

    Nice simple project for makers to try.

     

    I could see @John Wiltrout building one to test his salvaged parts.

     

    Are you listening John?

     

    DAB

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube