# Microduino Digital tube thermometer(LM35, DS18b20)

 Language: English  • 中文

## Objective

This tutorial will teach you using two temperature sensor, that are LM35 and DS18B20, and use the digital tube to display the temperature.

## First Experiment(LM35 temperature sensor)

LM35 temperature sensor

LM35 temperature sensor output voltage linear relationship between the Celsius temperature scale, 0 ℃, output is 0V, for every 1℃increases in output voltage of 10mV.

• Sensor parameters:
• Input voltage 35V to -0.2V
• Output voltage 6V to -1.0V
• Output current 10mA
• Specified operating temperature range
• LM35A -55℃ to +150℃
• LM35C, LM35CA -40℃ to +110℃
• LM35D 0℃ to +100℃

• Specification: (detailed information, please refer to LM35 datasheft)
• 1. Working voltage: DC4～30V;
• 2. Working current: less than 133μA;
• 3. Output voltage: +6V～-1.0V;
• 4. Output impedance: 1mA 0.1Ω load
• 5. Precision: 0.5℃ (at +25℃);
• 6. Leakage current: less than 60μA;
• 7. Proportion factor: linear +10.0mV/℃;
• 8. Nonlinear values: ±1/4℃;
• 9. Calibration method: directly use Celsius temperature calibration;
• 10. Rated temperature range: -55～+150℃.

Identify the pin easily, put the sensor as upper picture, the left pin is power, the middle pin is data, the right pin is GND.

## Schematic

Pin table:

Microduino pin Digital tube pin
D2 10(A)
D3 9(B)
D4 1(C)
D5 4(D)
D6 3(E)
D7 6(F)
D8 5(G)
9 2(DP)
D10 8(LED1)
D11 7(LED2)

## Program

LM35 and DS18B20 use the same program.

Refers to MicroduinoDigitalThermometerLM35-DS18B20.ino

## Debug

Step 1: Copy the code to IDE and compile it;

Step 2: Set up the circuit, as follows:

Step 4: Observe the digital tube. Find a hot object to close the temperature sensor, the digital tube will display the value.

## Result

After LM35 sensor near the heat source, the digital tube displayed value will rise, leave the heat source temperature will gradually reduce.

## Second Experiment (DS18B20 temperature sensor)

DS18B20 temperature sensor

DS18B20 is a single bus digital sensors produced by United States DALLAS company, convert temperature variation to digital signal, and each device has an unique serial number, so can realize multipoint measurement. Its measuring range is -55°C to +125 °C, in which -10°C to +85°C range measuring accuracy can reach ±0.5°C. It is only has three pins, GND, DQ and VDD, power supply can be directly by the cable itself, also can use external power supply, it is convenient to use, but must pay a price for this kind of convenient. Its timing is critical, various operation on DS18B20 must be conducted in accordance with the protocol of DS18B20. Operation protocol contains: initialize DS18B20, send ROM function command, send the memory operation command and process data. If there are more interrupt in program, or the hardware connection wire is too long, which can cause temporal waveform distortion, then result in chaotic measurement results. Based on this situation which makes use of this chip by certain restrictions.

Identify the pin easily, put the sensor as upper picture, the left pin is power, the middle pin is data, the right pin is GND.

## Schematic

Pin table:

Microduino pin Digital tube pin
D2 10(A)
D3 9(B)
D4 1(C)
D5 4(D)
D6 3(E)
D7 6(F)
D8 5(G)
9 2(DP)
D10 8(LED1)
D11 7(LED2)

## Program

LM35 and DS18B20 use the same program.

Refer to MicroduinoDigitalThermometerLM35-DS18B20.ino

## Debug

Step 1: Copy the code to IDE and compile it

Step 2: Set up the circuit, as follows: