Salah satu sensor suhu yang ada di pasaran adalah LM35. LM35 memberikan analog voltage yang berkadar terus dengan suhu di dalam unit Celcius. Di atas adalah gambar sensor LM35 dari DFRobot. Pin-pin nya adalah
- pin 1 = output
- pin 2 = GND
- pin 3 = 5V
Cara membaca suhu daripada sensor LM35 adalah dengan menggunakan ADC. Kemudian tukarkan nilai voltan kepada Celcius dengan kadar 10mV per Celcius. Suhu tersebut juga boleh ditukarkan kepada unit lain seperti Fahrenheit dan Kelvin. Rumus menukarkan unitnya adalah seperti di bawah.
Berikut adalah demo sensor LM35.
PIC Source Code
Sertai Telegram Group bagi dapatkan source code
19 responses to “PIC Lesson: Sensor LM35”
Salam encik Shahrulnizam…Saya menggunakan temperature sensor Thermistor NTC (1kohm)..Adakah pengiraan voltage to temperature nya adalah sama (10mV/C).Saya cuba cari dalam datasheet tapi hampa..Need help..
ws, Zuhairi. Pengiraan thermistor lain dan rasanya thermistor x de unit penukaran voltage ke celcius.
Hi,i want to ask is it ur LM35 sensor directly connect to which 3 pin of ur IC 16F877A?
And how your signal reading from sensor show in ur display?is it possible if the pic directly send the signal to xbee device without show the reading at display after receive the signal from sensor?if possible what is the coding needed to interface for the receive signal from sensor to PIC then trnsmit to the rx of xbee device?
thanks and kindly waiting ur reply.
Hi, LM35 give analog voltage. Then, it can directly connect to PIC. After PIC get the value, it can do whatever, even display on LCD or transmit to XBee. Ofcourse, it can transmit to XBee without display on LCD.
Salam,encik shahrulnizam.sya nak bertnya adkah berbeza menggunakan pir dgan sensor lm35 pda program pic..
ws, Ali. PIR dgn LM35 berbeza. PIR bagi signal digital, LM35 bagi signal analog. PIR sensor lihat disini.
salam..tuan, leh bgtau pinout utk connect LCD 20×4 dgn pic16f887 ni x?saya try simulate guna coding tuan,tp kuar tulisan pelik2 kt LCD tu..
ws, rujuk dalam file LibraryHD44780.h kat sini.
Salam, En. Shahrul, saya nak tanya, saya kurang faham dengan programming berikut:
for(;;){
temperature[0]=(int)(4.888*read_a2d(0)); //10mV per Celsius
temperature[1]=(int)(1.8*temperature[0]+320); //Celsius to Fahrenheit
temperature[2]=(int)(temperature[0]+2731.5); //Celsius to Kelvin
soalan saya, saya x faham dengan nilai 4.888 tu… kenapa 4.888? apa perkaitannya dengan 10mV percelcius?
satu lagi kenapa kena guna for? bukan ke for( umpukan;syarat;increment@decrement) cth (x=0;x>10, x++), sorry banyak tanya, sbb saya cetek ilmu, dah cuba buat carian, but still x faham yang area tu sahaja. TQ for sharing Mr. Shahrul..
ws, sunny. No ADC darab 4.888 untuk jadikan nilai 5000 (1023×4.888) mewakili 5000mV. Nilai mV tukarkan kpd Celsius.
for(;;) untuk looping selamanya.
Myself Sumanta from Indian Institute of Technology Kharagpur wants to see the output of LM35. When 5volt is given at its Vs pin with respect to ground, the device is getting heated up too much. Can anyone tell me the cause of this problem and how it can be solved. Waiting for all of your suggestions.
Sumanta
Sumanta, maybe you put wrong polarity. Refer to datasheet, the pin view from bottom or top.
salam…saya nk tnye, knape value temperature yang sy dpat 30 keatas??mcm x logik…faktor ape yg boleh jd mcm 2??
w/salam miss, sy pun x tahu sebab apa bacaan tinggi.
sy raffi
Salam, En. Shahrul. sy d minta utk mnghasilkan satu projek, d mna tajuk projek sy tu ialah (LM35DZ control relay using PIC18F4580).
berikut ialah komponen yg telah disediakan:
1-lm35DZ
2-PIC18F4580
3-relay
4-DC motor
apabila lm35DZ mengesan suhu lebih drpd 30drjah celsius atau keatas, relay akan berfungsi/on, sebaliknya relay akan off.
sbenar nya sy x tau mcm mna nk buat connection dia dlm software proteus? dan apa programming utk projek ni jika menggunakan C language brdasarkan software MPLAB?
w/salam, mohd raffi. Kena tempah projek.
Salam tuan, equation untuk convert signal analog voltage dari sensor nieh ke Celcius, mcm mana equation nya??
w/salam, lihat dlm programming di atas.