loading
Arduino LED Exploration
My program shows you all of the data on your Led from the first light to the normal operation light. From that data you can pick an RS that is good light, but lower in current. You must build the circuit to run my program. You must open a terminal window when you run my program. Bright led can waste a lot of current. Using a higher RS like 470 to 1k you can save almost half of the current. You can set LED_VCC to where the Led is running. Aref is the processor’s VCC running my program. You can also set LED_START_VOLTS and LED_MAX_VOLTS for the Led. You can set information in the output for your Led.

RS is found (Vin – Vled) / Iled as (6 – 1.7) / .02 = 215 or about 220 ohms.

I could not upload my program with .ino or pde extension so I made it LED_Test_A8.txt. Just change the extension to .ino. The new file extension is .ino. Change the file extension to run the program.

Currently my program needs to run on a 5 volt system. You can use LED_VCC for any voltage and get to RS for the Test Led. I have a 3.3 volt system now and I will work on my program for it.

I got my Arduino Uno at Makezine.com Store with the Arduino Starter Pack that came with the MakerShield for it. If you have not gotten into Microprocessor Processor Boards you should try the Arduino. There is a ton of support at Arduino.cc/en/. The Arduino IDE(Integrated Development Environment) easy to get started with and can do a lot of stuff with the processors. You do need to know C. I must say that the C language is uniquely Arduino, but that is the fun of it. They have tons of help and examples.

I was playing with the Light Dependent Resistor (LDR) that came in the Arduino starter pack and I saw it jump when I pasted it over a lit LED. So I built my program to show how Leds work. The Arduinos are wonderful and I love C. This is what processor boards do in our world. They sit in a box collecting data that they format and transmit to another system. My program tests the Led and outputs the data to the terminal.

My program uses Pulse Width Modulation(PWM) on a digital pin to slowly increase the voltage applied to the test LED. I read the LDR for the light output of the Led. Analogue outputs are 256 steps ground to VCC as PWM. Analogue inputs are 1024 steps ground to VCC(Aref). A high enough range to get about four decimal places of accuracy. I created AdcOneVolt by dividing 1024 by Aref(5). I read the volts at the Test Led and R1(220) and I know my volts In so ohms law for current is VoltsIn – VoltsLed  / R1. This was simple with the Arduino.
The lightGap or the difference in the light output by the Led at each Step in the test gave me a plateau test. If the lightGap is low for 3 times in a row it is a plateau. As a semiconductor junction reaches its Saturation point the light, voltage and the current level off in the form of a plateau. My program looks for the first plateau of the Led and ends the test at that point. This is the normal operating voltage and current for the Led at VCC. I also give the Led’s first light. The Current and the Input Voltage do change but the Led voltage and its light output do not change much. Increase your RS for each Led and you will have more power for other things.

My program looks more complicated than it is because it is a terminal program. All of that text and logic to control it is what fills up my two loops. Always label the closing brace of a loop when you first start it so that you and everyone else will know what it is. Comments let everyone understand your code. Naming variables so that they connect to what they are make your code easier to understand. Defines do not use any memory. Floating point uses a lot of memory, but they print faster and nicer without any other formatting.

To test Infrared diodes and detectors you need a matched set. The Nano-Meter frequency needs to be close enough for them to work together. The detector goes where the LDR is. You may not need to changes anything in the program.

The probe I made out of the simple little LDR that came in the starter pack. I insulated the leads of the LDR and twisted them together to form a cord. I added a bit more wire and mounted it on a short pin snap-off header. You need to cover the edge and the back of the LDR to block excess light from hitting it. I used black heat-shrink tubing that just fit the LDR to do this. I filled the back of the LDR and the wires with hot-melt glue and added a smaller piece of heat-shrink tubing to make it look nice. I put another piece of heat-shrink tubing on the LDR to from a hood to block more light. Another piece of un-shrunk heat-shrink tubing that just fits the LDR goes over your test LED and then your probe goes into that and touches the test LED. Look at the pictures.

I just created a circuit for this article. You need the circuit to run my program. I created a very small cute circuit board LedExplore2s circuit.pdf and a mini-shield LedExplore1mShield.pdf. I also made a board with twelve circuits on it LedExplore2s12.pdf. To make the board print the pdf file at 100%. For lasers printers print on the smooth side of the transparence sheet. Make sure you can read the name and port numbers. These boards are the bottom trace of the circuit board. Cut out the circuit on the board’s outline. 

In the circuit the capacitors are necessary for good analogue readings. PWM is noisy. C2-100mf & C3-104 input PWM. C1-4.7mf output test Led voltage read. C4-104 LDR read. R2 10k stabilizes PWM output by providing a load to ground. The LDR and the switch are standard circuits. See the schematic.
<p>A topic of interest to many. Thanks.</p>
I guess I got busy and forgot I had my program and data file for this project. it is the LedExplore.zip. Only for the Arduinos.
Fixed some things <br>Fixed the output a bit. I added some error handling. This is hard with an electronic circuit. If there is no light for three lines of dashes then I stop the test. <br>
If you're doing what makes you happy, why is it &quot;Sad to be a geek&quot; ??? Don't let others tell you how you should feel. As I always sign off &quot;CHEERS!&quot;
Very helpful! <br>And you're not alone most people dont understand you when writing an instructable about a project you did makes you miss dinner, stay up late and have a smile on your face the whole time. <br>I'm just starting out with microprocessors, great instructable to help me start
excellent. You can also make a digital resistor that is very useful in controlling analogue circuits. The best part with your set up is that you can have the microprocessor linearize the LDR response. The LDR resistance change is not linear per change of light intensity. It is exponential. I have an analogue version of what you did:<br><br>https://www.instructables.com/id/Make-a-Voltage-Controlled-Resistor-and-Use-It/<br><br>
When you are editing sometimes you do too many things at once. I made a mistake on my Ohms law chart and I do not know how I did it. It is fixed now. Sorry.

About This Instructable

11,454views

59favorites

License:

Bio: I have always been a geek and I see things differently than most people. I am healthy too and I love biology. Programming has always ... More »
More by Geek07Boy:Fun Led Checker Tester Flying a toy QuadCopter Servo Math 
Add instructable to: