Close

Design Considerations, or A Design History

A project log for Affordable Reflectance Transformation Imaging Dome

A simple and inexpensive way to image and analyze subtle surface details on objects.

leszek-pawlowiczLeszek Pawlowicz 06/18/2016 at 05:260 Comments

This is just a quick explanation of the basic LED power control system I use in my RTI controller. You might find it useful in understanding how things work, and I hope it's not too technical; but you don't have to understand this to build the system.

I first started working on this project early in 2013. I knew the control system would be driven by an Arduino, since the control requirements were pretty basic - turn lights on and off, fire a camera shutter in sync with the lights. But while an Arduino Mega has enough pins to control an adequate number of LEDs to do RTI (around 50+), wiring those pins individually to LEDs would be a nightmare. And in any case the Arduino wasn't going to be adequate as a power source to light up the LEDs - the maximum current any Arduino pin can safely supply is 40 mA, with 20 mA the recommended maximum for continuous output. That means about 100 mW of power at best, which would have limited me to small domes and long camera exposure times. What's more, for good control of LED light intensity, critical for good RTI results, you need to control LED current accurately.

The solution to the first problem is to wire up the LED lights in matrix format:

Here's an 8x8 LED matrix diagram , with 64 LEDs in total. To turn on a single LED, you need to activate the appropriate electrical connections for the matching row and column, high-side voltage for the columns, low-side for the rows. For example, activating Column 4 and Row 5 lights up only the 4th LED in the 5th row. Running sequentially through rows and columns, every light can be turned on just once. This requires control of only 16 Arduino output pins.

The second problem, high and accurate LED currents, requires circuitry on both the high and low sides of the LED. Here's the solution I came up with:

Sorry about the crummy schematic - most of mine are hand-drawn. On the left is a standard high-side P-channel MOSFET driver layout, which is easily found on the Internet (e.g. here and here). I originally used a single-chip high-side Darlington array with 8 channels, but the maximum current was only 350 mA, resulting in LED light intensities that were still a bit dimmer than what I wanted; P-Channel MOSFETs can handle much higher currents, even though I had to now use 8 of them. The P-Channel MOSFET controls on/off for the LED power supply, shown as +12V, but which normally runs at +9V, and can run +8-12V. The connection from +12V through the 10K resistor to the Gate is required because P-channel MOSFETs are on when the Gate is unbiased, so a voltage equal to the Source-Drain bias voltage needs to be applied to keep the MOSFET normally turned off. When +5V is applied from an Arduino controller output pin to the base of the 2N3904 transistor, it turns that transistor on, which shunts the +12V voltage away from the gate and turns on the P-MOSFET supply voltage to the LED. Check out the links above for a more coherent explanation. Below is a better schematic of the high-side driver from the first site linked above; the "Load" in this case is an LED, and there's no need for a flyback protection diode. I use IRF9540 P-Channel MOSFETs because they're cheap, and work fine, but an FQP27P06, FQ47P06, or NDP6020P P-Channel MOSFET would work just as well. You just need a P-channel MOSFET that can handle high currents, and has a low Rds.

On the right-side of my schematic is the low-side driver/control, a CAT4101 LED driver that not only switches on and off the low (ground) side, but allows you to set a desired current between 150 mA and 1 A. This is a 5-pin chip. The first pin, EN/PWM, switches on the LED and can control intensity through Pulse Width Modulation; the 2nd pin, Vin, supplies +5V of power to the chip. I have these two pins bridged in my control system, so that the same Arduino controller pin both switches the chip on and supplies power. I did this because leaving all of the CAT4101 chips powered on continuously led to some weird issues with multiple LEDs turning on even when only one should have. The GND pin goes to ground. RSET connects to resistors that set the output current, with 560R giving you about 1 A, the maximum. The 5K variable resistor lets you fine-tune the current to allow for variations between different chips, and also allows you to set currents lower than the max 1A. This is useful for extending the life of the LEDs by keeping them from overheating, and also in certain use cases. For example, I sometimes use USB microscopes for micro-RTI, and full LED intensity is usually too bright for those; if I turn the current down to 150 mA, then there's no problem with sensor saturation. Finally, the LED pin connects to the ground side of the LED.

The schematic shows one high-side and one low-side driver, connected to one LED. But in the control system, there are eight high-side drivers, each connected to a column in the LED matrix, and 8 low-side drivers/constant current controls, each connected to a row in the matrix. Each driver is connect to an Arduino controller output pin that can turn it on and off as needed in software. This setup can drive a Cree 3W LED to its full power limit, at a current of 1 A.

Just for laughs, here's the inside of my original controller box from 2013, using a Darlington array :

And here's the most recent version I've built, the prototype for the system I'm describing on these project pages:

P-Channel MOSFETs on the left, CAT4101 chips on the right.

Discussions