[vc_row][vc_column][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Module introduction” tab_id=”1393463653-1-21″][vc_column_text]Thermal Module is a temperature sensor consists of one LM35, LM35 is a temperature sensor has been widely used, because it uses internal compensation, so the output can begin with zero.It has different package type.At room temperature, the LM35 requires no additional calibration process can reach + / – 1/4 degree of accuracy.The power supply mode has single power supply and the positive and negative dual power . The mode of the positive and negative dual power can provide negative temperature measurement. The LM35 temperature sensor output voltage has a linear relation with the Celsius temperature. 0 degree output 0V, increased by 1 degree, the output voltage increases 10mV,calculated as follows: V (T) = 10 mV The following is sample diagram of the module:
[/vc_column_text][/vc_tab][vc_tab title=”Wiring diagram” tab_id=”1393463653-2-67″][vc_column_text]
Power supply (VCC) is connected to 3.3v of pcduino , wire(GND) is connected to GND of pcduino. Signal output (SIG) is connected to analog signal input port (A0 – A5), A0-A5 any one is ok.( recommend connect to the port above A2, because of A0, A1 ADC precision only six, we may not see obvious change.But it must be defined as same as the routine code.[/vc_column_text][/vc_tab][vc_tab title=”Demo code” tab_id=”1393463906735-2-8″][vc_column_text]
#include <core.h> int adc_id = 2; int delay_us = 100000; int HistoryValue = 0; void setup() { } void loop() { int value; float voltage; float temperature; value = analogRead(adc_id); // get adc value if(((HistoryValue>=value) && ((HistoryValue - value) > 10)) || ((HistoryValue<value) && ((value - HistoryValue) > 10))) { HistoryValue = value; // converting that reading to voltage, for 3.3v arduino use 3.3 voltage = value * 3.3; voltage /= 4096.0; // now print out the temperature temperature = (voltage - 0.5) * 100 ; //converting from 10 mv per degree wit 500 mV offset //to degrees ((volatge - 500mV) times 100) printf("%f degrees C\n", temperature); // now convert to Fahrenheight temperature = (temperature * 9.0 / 5.0) + 32.0; printf("%f degrees F\n", temperature); } }
[/vc_column_text][/vc_tab][vc_tab title=”Running effect diagram” tab_id=”1393464072493-3-5″][vc_column_text]
Leave a Reply
You must be logged in to post a comment.