• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeArduinoAdvanced Learning Kit for ArduinoProject 16. Experiment with LM35 Temperature Senso ...
Previous Next

Project 16. Experiment with LM35 Temperature Sensor

Posted by: Alvin Jin , March 27, 2014

[vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Introduction” tab_id=”1395585855-1-66″][vc_column_text]LM35 is a very common and easy to use temperature sensor transistor. The circuit only needs one component, which is LM35 itself. By interfacing the output of LM35 to ADC of Arduino, we can obtain the actual temperature reading.[/vc_column_text][/vc_tab][vc_tab title=”Parts List” tab_id=”1395930095833-3-10″][vc_column_text]The list of parts are as following:

  1. 1 x Temperature SensorĀ LM35 *
  2. 1 x [bigcommerce link=”/mini-breadboard-mini-self-adhesive-for-arduino-black/” target=”_blank”]Bread board[/bigcommerce]
  3. Several Jumper wires

[/vc_column_text][/vc_tab][vc_tab title=”Wire Diagram” tab_id=”1395930247152-4-0″][vc_column_text]We wire everything according to the following diagram:

LM35-1.jpg LM35[/vc_column_text][/vc_tab][vc_tab title=”Code” tab_id=”1395585855-2-94″][vc_column_text]

int potPin = 0; / / define the analog interface 0 LM35 temperature sensor connection
void setup ()
{
Serial.begin (9600) ;/ / set the baud rate
}
void loop ()
{
int val ;/ / define variables
int dat ;/ / define variables
val = analogRead (0) ;/ / read sensor analog values and assigned to val
dat = (125 * val) >> 8 ;/ / temperature formula
Serial.print ("Tep:") ;/ / output as a string represents the temperature display Tep
Serial.print (dat) ;/ / output shows the value of dat
Serial.println ("C") ;/ / output display as a C string
delay (500) ;/ / delay of 0.5 seconds
}

[/vc_column_text][/vc_tab][vc_tab title=”Test Reslut” tab_id=”1395587630293-2-6″][vc_column_text]After downloading the program to Arduino, we open a serial terminal to check the temperature reading:

LM35-2[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Tags: Advanced Learning Kit for Arduino

Share!
Tweet

Alvin Jin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors