25
LED bargraph series - Is it hot or cold?
How’s the temperature today? Cold, good or hot? Ambient temperature can be easily measured without any special temperature sensor. You just need… a common diode! Well, actually, a diode and a resistor. Diodes change their forward voltage drop at a rate of approximately -2.3 mV per degree Celsius (ºC), so we just need to measure that voltage.
You may want to start by reading Setting up a LED bargraph. Check also our other Free Articles.
The minus sign on –2.3mV means that the voltage decreases when the temperature increases and vice-versa. Before the circuit can be used it needs to be calibrated with a “real” thermometer, but this is a very simple procedure. In the end, we’ll have a qualitative indication of temperature. We’ll use the DOT display mode, and configure the bargraph module by inserting the jumper as indicated in the documentation.
Below there’s the schematics for the temperature sensor circuit we’ll be using. It consists of a resistor in series with a diode, fed from 5V taken from the bargraph module. This circuit puts the diode into conduction mode, and a current of approximately (5V – 0,6V) / 4.7KOhm = 0.936mA constantly flows through the resistor and diode. We assumed a diode voltage drop of 0.60V, which is a typical voltage drop at around 1mA, in a normal small signal diode like the well-known 1N4148; close enough to 0.936mA.
Now, here were I live, we have a year air temperature between 0ºC and 33ºC. That is 33ºC of amplitude, which we need to map on the bargraph module’s 12 LEDs. This gives us 2.75ºC per LED. And 2.75ºC means a diode forward voltage drop variation of 2.75ºC x 2.3mV = 6.325mV. So our bargraph module needs to display a range of 6.325mV x 12 LEDs = 75.9mV. Ok, we know the input range size, but we still don’t know the exact limits, where it starts and where it ends; ‘til now we just know how much separates the bottom limit from the upper limit. If we knew let’s say, that our diode’s voltage drop is 680mV (0.68V) at 20ºC, we could calculate the voltage drop at 0ºC, one of the temperature limits we need, since we know it varies –2.3mV per ºC; in the example above, it would be
680mV – (-2.3mV x (20ºC – 0ºC)) = 680 + 2.3 x 20 = 680 + 46 = 726mV
This would be the TOP value for the LED module. But then you say “Hell, why the TOP and not the BOTTOM? After all, this is the lower temperature limit!”. Well, the fact is that the lower temperature limit corresponds to the higher voltage drop on the diode, and the upper temperature limit corresponds to the lower voltage drop. In a typical bargraph module, the TOP limit must be set at a higher voltage than the lower limit, so we must “swap” them. The side effect is that the dot will move in the opposite direction from what is set as the “growing” direction for the module, but you can orient the module in any direction you wish so there’s no hassle.
So, what you need is one calibration point, like the hypothetical 680mV at 20ºC above. That is, you need to pick up your diode and find out one temperature / voltage pair of values. There are mainly 2 ways of doing this:
- You set your diode to a known temperature and then measure the voltage drop.
- You measure the voltage drop at room temperature and then find out what’s the room temperature.
Option 1. is hard to do without specialized equipment. But if you have another thermometer or a way of knowing the current room temperature, going option 2. is easy. Connect the sensor assembly to the bargraph module and turn power on; next, put your other thermometer as close as possible to the diode and wait 1 minute or 2 to make sure they both reach the same temperature. Finally take note of the temperature reading on your other thermometer and measure the diode’s voltage drop. That’s it! You now have the 2 values that will allow you to follow the calculations above and find the exact values for the input range limit of the bargraph module.
If you don’t have another thermometer, you can always ask for someone to borrow you one or you can perform the calibration downtown, near of those street thermometers J.
The calibration procedure must be performed for every diode you wish to use as a sensor. Due to minuscule manufacturing differences, every diode is born different. If you get 100 diodes and put them to work at the same temperature, they will all have a different voltage drop. However, the temperature will always affect the drop in the same way on all 100 of them: -2.3mV per ºC.
The beauty of using a diode as a temperature sensor is that it’s cheap, precise and reliable.
Happy measuring!
Nuno
Did you like this article? Have questions, critics, suggestions?
I want your feedback!
Release Your Inner Self