LEDs As Temperature Sensors

6.4K248

Intro: LEDs As Temperature Sensors

Using the Arduino microcontroller I have devised a method of using the voltage produced by a power LED to measure its own temperature to within +- 10 °C without the need for an external temperature sensor e.g. thermocouple, thermistor or digital sensor. In this instructable I explain the details of my idea as well as the code and how to implement this in an existing system. As far as I know I am the first person to implement this idea and I am planning on entering it into the Google Science Fair as I am 15.

An LED consists of a semicondutor pn junction. A pn junction will produce a voltage when exposed to light and heat in much the same way as a solar cell. However both temperature and light will affect the output voltage of the LED so to estimate the temperature the light level needs to be measured.

In my system I use a green LED as the light sensor. The value from both the power LED and the light sensing LED have to be inputted into a simple formula along with some constants to estimate the temperature. A small calibration sequence with different temperatures and light levels are needed to determine constants in the formula.

As of yet I have only been able to estimate the temperature of power LEDs that operate within the operation voltages of the Arduino.

In the next step I shall explain how to construct the calibration module.

STEP 1: Constructing the Calibration Module

The calibration module will allow you to accurately control the temperature of the LED and measure it's voltage and light level. The readings obtained form the calibration will allow you to calculate the constants needed to estimate the temperature.

Things needed:


• Aluminium sheet (this is what the sensors, heater and power LED will be affixed to)
• LM35 temperature sensor
• Green LED (as light sensor)
• Plastic (1.6 mm thick for thermal isolation of light sensor from Power LED)
• 5 Watt 22 Ohm Power resistor (as heater)
• Power LED (running at 3.3 Volts)


First a piece of aluminium sheet approximately 55 mm by 30 mm must be shaped. Affix the power resistor, Power LED and temperature sensor to the aluminium plate with bolts or thermal adhesive if necessary.

Cut a 20 mm x 5 mm strip of the plastic to act as a mounting arm for the LED. This will prevent heat reaching the light sensor and affecting the light reading. Drill two 1 mm holes in the plastic to accommodate the LED leads. Bolt or glue this to the plate.

I made a modification to my original calibration module so that I could fit new LED s easily without needing to do any soldering. This involved shaping a piece of aluminium to clamp the LED onto the base plate and using copper tape on the calibration module as the electrical contacts.

STEP 2: Constructing the Circuitry

I used an Arduino Nano board as the brains of my device but I think any Arduino board could be used. I created a schematic and breadboard layout on Fritzing. To test my idea I simply made the circuitry on a piece of proto-board. The PNP transistor I used was a 2N3906.

STEP 3: The Arduino Code

I am not going to go into detail as to how to program the Arduino boards as I am aware that there are already many instructables out there which have already explained this in great detail. I have attached a simple (and probably rubbishly written) piece of code for the Arduino which will hopefully allow you to perform a calibration of the LED.
The code averages out the reading over 20 readings to obtain a more accurate temperature reading. The voltage readings are in millivolts.

STEP 4: The Calibration

The calibration of an LED can be quite a lengthy process.

To do this I calibrated the LED over a range of temperatures and light levels. Using a power supply set to 7 volts I heated the module up using the resistor and let it cool down with the Arduino connected to your computer with the serial monitor opened in the Arduino IDE.

STEP 5: Analyzing the Data From the Calibration

I copied and pasted the data from the serial terminal into excel where I performed some simple data analysis. The text to columns feature comes in handy when splitting the data into several columns using the space delimiting function.

Column order:

  1. Degrees C from LM35
  2. LDR voltage (delete this column)
  3. LED light sensor voltage
  4. LED voltage
  5. Calculated temperature done by the Arduino

Use this simple formula to change the variables to suit your LED setup.
Calc_temp = ((LED_voltage * LED_const) + (LED_light_voltage * light_const) + constant); Here are the values I used for the spreadsheet:

LED_const = -0.9

light_const = -0.15

constant = 4510

STEP 6: Testing and Implementing

I have already included a piece of code that switches on the indication LED at pin 13 of the arduino nano when the calculated temperature rises above 50 degrees C.
In a real world application the light sensing LED could already be present in the form of an indication LED.

9 Comments

Cool idea.
I did something similar but used a normal 2222 transistor. Emitter to GND, base and collector to an analogRead() pin. Haven't spent a lot of time converting the output to a temperature (as I only needed temp change), but it seems to be linear (-1 output = -1 deg F).

I went with this as it was simpler than dealing with the changing light levels of LEDs

But apparently this equation works (required calibration at known temp):
T = T_0 + (Vout_0 -Vout) * 500
where:
T_0 is the temperature at which you performed the calibration
Vout_0 is the output voltage measured at the calibration temperature
Vout is the output from the ADC
Yes I agree, but this method does not allow you to measure the temperature of an LED because the forward voltage changes with light level. My method utilises a separate LED as a light sensor so the temperature can be estimated. The method described in the website could be used separately by using thermal adhesive to attach the 1n4148 diode.

Silly me. I did not read your intro carefully enough, I missed the basic thrust of the project.

Nice idea. Keep at it.

Another approach would be to measure the Led current and subtract the led characteristic curve to get the temperature dependent voltage shift. Leds are usually driven by constant current so for a single setting this would be easy and quick. Start at ambient and then use the Arduino to pulse the Led to measure the ambient voltage at that current. There may be problems getting the current pulse short enough to avoid heating the Led during the measurement. Would need some experiment here. An IR temperature meter would give you some idea if the die was being heated.

Yet another approach would be to attach a temperature sensor (e.g. a diode) on (in) the led heat sink and use the R value (degrees C / Watt) specification to together with the known current and voltage driving the led to estimate the die temperature from the head sink temperature and the power being supplied to the led. (Actually the setup here seems to be measuring the heat sink temperature rather then the led die temperature so there is already an implied dependence on the R value of the die to base)

What worries my slightly about the present approach is that the led output degrades over time so the accuracy of the measurement will also degrade. Another possible problem is that the led output varies from led to led, but I assume the calibration procedure will over come that. Also the temperature being measured appears to be the heat sink temperature. What is really important is the led die temperature.

If you can modify your approach to give a reliable, if even only approximate, led die temperature it would be invaluable for may applications where there is limited heat sink available for high powered leds and there is a risk of thermal overload in higher ambient temperatures or if high power is used for extended periods.

very interesting...

Really nice idea!

wicked. awesome. unusual. you rock!

Thanks, but if only I could publicize my idea better so more people would see it. Unfortunately there was only one contest that I thought that my Instructable would fit into.