In the previous post, I described how I managed to get an LED functioning as a sensor, using the voltage readout of a certain LED as a reference. That technique, however, was unrefined, as it used only HIGH and LOW settings. The sensor had only two settings, really - on and off. I refined that by changing my inputs and outputs to analogRead and analogWrite, again measuring voltage. I used a setup similar to the one described on the "Intro to LEDs as Sensors" page, except I swapped input/output pins on the Arduino. The sensor LED's cathode was at Pin 9 (a PWM pin on the Arduino), and the anode was placed at pin A1 (an analog port). By using a PWM pin, I could employ the analogWrite function, and the analog pin allowed me to read the voltage off the anode to some degree of accuracy.

Code for this setup can be downloaded here:

This system waits for a user input, then takes 5 measurements and displays them in Arduino's serial monitor. With this setup on an Arduino Mega board, it is possible to run about 15 sensors per board.

While this voltage measurement now had at least some degree of accuracy associated with it, the implementation was not perfect. I set up a testing procedure for measuring the response functions of a single 5mm white LED using a Just Normlicht lightbox and my Arduino connected to a computer. I placed the breadboard in the lightbox, then stepped the lightbox through its brightness settings, taking a reading at each setting. The results from this LED alone were inconclusive, not describing any really useful relationship between the incoming light and the LED's response.