Using a Temperature Sensor

Similar documents
BalloonSat Sensor Array

EK307 Lab: Microcontrollers

1/Build a Mintronics: MintDuino

Smart Wireless Temperature Data Logger

Prototyping & Engineering Electronics Kits Basic Kit Guide

Lab 4: Determining temperature from a temperature sensor

Figure 1. A complete Temperature Sensor

Onwards and Upwards, Your near space guide Overview of the NearSys Two Sensor Temperature Array Figure 1. A complete Two Sensor Temperature Array

Introduction to Arduino Diagrams & Code Brown County Library

DEV-1 HamStack Development Board

1. Project title: Home Monitoring System. Student: Alexandru Irasoc. Mail address: Student: Constantin Grijincu

TMP36 Temperature Sensor

ELCT708 MicroLab Session #1 Introduction to Embedded Systems and Microcontrollers. Eng. Salma Hesham

TMP36 Temperature Sensor

Earthshine Design Arduino Starters Kit Manual - A Complete Beginners Guide to the Arduino. Project 13. Serial Temperature Sensor

SPDM Level 2 Smart Electronics Unit, Level 2

Physical Computing Self-Quiz

Implementation of Temperature Sensor on PICM4520 Microcontroller

Microcontroller Based Data Acquisition System

AC : DESIGN OF DATA ACQUISITION SYSTEM FOR COMPUTER ENGINEERING EDUCATION

Wiring guide for dual-output vibration and temperature sensors

Build the Machine Science XBoard, with a programmable microcontroller.

Introduction to Arduino Diagrams & Code Brown County Library

AXE Stack 18. BASIC-Programmable Microcontroller Kit. An inexpensive introduction to microcontroller technology for all ability levels

More Arduino Programming

Arduino Part 2. Introductory Medical Device Prototyping

EXPERIMENT 7 Please visit to learn all features of arduino before you start the experiments

Physical Computing Self-Quiz

CSE 466 Exam 1 Winter, 2010

ARDUINO MINI 05 Code: A000087

Arduino Uno Microcontroller Overview

Lab-3: LCDs Serial Communication Analog Inputs Temperature Measurement System

Note. The above image and many others are courtesy of - this is a wonderful resource for designing circuits.

Digital I/O Operations

LCD Prototype Circuit on Solderless Breadboard. 840 Pin Solderless Breadboard ( # ND)

One Grove Base Shield board this allows you to connect various Grove units (below) to your Seeeduino board; Nine Grove Grove units, consisting of:

Adafruit INA219 Current Sensor Breakout

MACHINE BREAKDOWN DETECTION SYSTEM

Manual iaq-engine Indoor Air Quality sensor

Thursday, September 15, electronic components

Lab 01 Arduino 程式設計實驗. Essential Arduino Programming and Digital Signal Process

Serial.begin ( ); Serial.println( ); analogread ( ); map ( );

Lab 2.2 Ohm s Law and Introduction to Arduinos

Robotics/Electronics Review for the Final Exam

Arduino 07 ARDUINO WORKSHOP 2007

Humidity/Temperature Sensor

Project 24 LCD Temperature Display

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

Basic Input/Output Operations

Manual Version March 2007

An FTDI connection: The ATtiny microcontrollers don t have a hardware UART External Crystal header pins for an optional crystal

Layad Circuits Arduino Basic Kit B. Content Summary

CII: Current Input, Isolated

AVR Board Setup General Purpose Digital Output

Adafruit 1-Wire Thermocouple Amplifier - MAX31850K

CPCS (Fall 2015), Merced College A Smart Parking Lot Dulce Meza-Flores Ashley Arredondo

DEV16T. LCD Daughter board

Adafruit INA219 Current Sensor Breakout

WEATHER STATION WITH SERIAL COMMUNICATION

Introduction to MATLABs Data Acquisition Toolbox, the USB DAQ, and accelerometers

IME-100 ECE. Lab 3. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

Experiment 10 Fall 2012

REQUIRED MATERIALS Epiphany-DAQ board Wire Jumpers IR Rangefinder Sensor LED Resistors Breadboard Multimeter (if needed)

Linux Kernel Hacking Free Course, 3rd edition. HWMPS: Hardware Monitor & Protection System

Arduino - DigitalReadSerial

Determination of Calibration Factors

Texas Instruments Microcontroller HOW-TO GUIDE Interfacing Keypad with MSP430F5529

If I wanted to connect an LED and little light bulb and have them switch on and off with one switch, my schematic would look like the one below.

Photoresistor, Transistor, and LED s

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas

VKey Voltage Keypad Hookup Guide

HomeVision-Pro Overview for HomeVision Users

KNOCK LOCK MAKE YOUR OWN SECRET LOCKING MECHANISM TO KEEP UNWANTED GUESTS OUT OF YOUR SPACE! Discover: input with a piezo, writing your own functions

Assembly Instructions for 128x64 Graphics Display Unit

BASIC Stamp Activity Board: Features and Specifications

Make your own secret locking mechanism to keep unwanted guests out of your space!

SPIRIT. Phase 5 Analog Board Computer and Electronics Engineering

OpenSprinkler v2.1u Build Instructions

Adafruit 1-Wire Thermocouple Amplifier - MAX31850K

Adafruit INA219 Current Sensor Breakout

Figure 1. The completed programming kit List of Parts

AIRRS. Infrared Distance Measurement Analog Output Signal Narrow Field of View Reliable Easy to use. Analog Infra-Red Ranging System

StenBOT Robot Kit. Stensat Group LLC, Copyright 2018

Goal: We want to build an autonomous vehicle (robot)

Electronic Brick Starter Kit

REQUIRED MATERIALS Epiphany-DAQ board Wire Jumpers Switch LED Resistors Breadboard Multimeter (if needed)

Laboratory 1 Introduction to the Arduino boards

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

ROBOTLINKING THE POWER SUPPLY LEARNING KIT TUTORIAL

Embedded Systems and Software

HAND-HELD THERMOCOUPLE THERMOMETER SERVICE MANUAL. CATALOG NUMBERS , and , and PROPRIETARY

Gambar A-1 Foto alat prototype infrared thermometer

Robotics Training Module ABLab Solutions

DAQCplate Users Guide

Electronic Coin Toss

EEE394 Microprocessor and Microcontroller Laboratory Lab #6

ME 3210: Mechatronics Signal Conditioning Circuit for IR Sensors March 27, 2003

SYSTEM DESIGN SPECIFICATIONS ZIGBEE BASIC SYSTEM

SWITCH 10 KILOHM RESISTOR 220 OHM RESISTOR POTENTIOMETER LCD SCREEN INGREDIENTS

Connecting LEDs to the ADB I/O

Transcription:

Using a Temperature Sensor Add a temperature sensor to the ATmega Board. Site: icode Course: Machine Science Guides (Arduino Version) Book: Using a Temperature Sensor Printed by: Ivan Rudnicki Date: Wednesday, July 30, 2014, 03:32 PM

Contents About Temperature Sensors Adding the Temperature Sensor Reading Analog Values Converting to Celsius (LM35) Converting to Celsius (LM335)

About Temperature Sensors Temperature sensors are used in a wide range of electronic devices, including digital thermometers, home thermostats, microwave ovens, and refrigerators. Figure 1 shows two devices with temperature sensors. Figure 1. Devices with temperature sensors. The temperature sensor provided in your kit is a precision analog sensor, whose voltage output is linearly proportional to the temperature. Configured as described here, the sensor has an operating range of about 0 C to +150 C.

Adding the Temperature Sensor The temperature sensor is a three pin integrated circuit. When the device's flat side is facing towards you, the three pins are labeled 1, 2, and 3, from left to right, as shown in Figure 2. Figure 2. Temperature sensor. Depending on your kit, you may have either an LM35 temperature sensor or an LM335 temperature sensor. You can identify your sensor by reading the text on the flat face of the device, as shown in Figure 3. The two sensors are wired slightly differently on the breadboard and produce different analog outputs, so it is critical to identify which type you have before moving ahead. Figure 3. LM35 (left) and LM335 (right). If you have the LM35, connect the temperature sensor as shown in Figure 4. Pin 1 is connected to power, and pin 3 is connected to ground. Pin 2 connects to ground through a 1.0 uf capacitor, and to Port C4 (pin 27) on the microcontroller through a 10K Ohm resistor.

Figure 4. Circuit schematic for the LM35. If you have the LM335, connect the temperature sensor as shown in Figure 5. Pin 1 is inserted into the breadboard but not connected to anything. Pin 3 is connected to ground. Pin 2 connects to power through a 1K ohm resistor, and to Port C4 (pin 27) on the microcontroller. Figure 5. Circuit schematic for LM335.

Reading Analog Values The following code reads the analog to digital converter value on Port C4 and displays it on the LCD. This value is proportional to the ambient Celsius temperature. 1. Rename your code file analogvalue.c. 2. Modify your code file, as follows: #include <mxapi.h> #include <lcd.h> #include <adc.h> int main(void) int analog_value; adc_init(); lcd_init(); while(1==1) //Declare a variable //Initialize analog to digital converter //Initialize the LCD analog_value=adc_read(4); //Read the ADC value on Port C4 lcd_decimal(first_line, analog_value, 3); //Display value on LCD delay_ms(100); //Wait 100 milliseconds 3. Compile and test your new code. Note that the value displayed on the LCD is the raw analog value, not the ambient temperature in Celsius. In the next step, you will convert this value to an accurate Celsius temperature.

Converting to Celsius (LM35) The adc_read function returns values ranging from 0 to 1024, corresponding to voltages ranging from 0mV to 5100mV (5.1V) on the pin being monitored, so each adc_read increment represents a voltage change of about 5mV. The LM35 temperature sensor creates 10mV of output voltage for every degree Celsius. Therefore, the adc_read function value increments by 2 for every degree Celsius. Using the following code, you can convert the analog voltage from the LM35 into a Celsius temperature to display on the LCD. 1. Rename your code file celsiustemp.c. 2. Modify your code file, as follows: #include <mxapi.h> #include <lcd.h> #include <adc.h> int main(void) int analog_value; adc_init(); lcd_init(); while(1==1) analog_value=adc_read(4); //Read value on Port C4 analog_value=analog_value/2; //Divide value by 2 lcd_decimal(first_line, analog_value, 3); //Display value on LCD lcd_character(first_line+4, 223); //Display degree symbol lcd_text(first_line+5, "C"); //Display the letter "C" delay_ms(100); //Wait 100 milliseconds 3. Compile and test your new code.

Converting to Celsius (LM335) The adc_read function returns values ranging from 0 to 1024, corresponding to voltages ranging from 0mV to 5100mV (5.1V) on the pin being monitored, so each adc_read increment represents a voltage change of about 5mV. The LM335 temperature sensor creates 10mV of output voltage for every degree Celsius. Therefore, the adc_read function value increments by 2 for every degree Celsius. (Because the LM335 is designed to work in Kelvin units, the value is offset from Celsius temperature by 273 degrees.) Using the following code, you can convert the analog voltage from the LM35 into a Celsius temperature to display on the LCD. 1. Rename your code file celsiustemp.c. 2. Modify your code file, as follows: #include <mxapi.h> #include <lcd.h> #include <adc.h> int main(void) int analog_value; adc_init(); lcd_init(); while(1==1) analog_value=adc_read(4); //Read value on Port C4 analog_value=(analog_value/2) 273; //Divide value by 2 and subtract 273 lcd_decimal(first_line, analog_value, 3); //Display value on LCD lcd_character(first_line+4, 223); //Display degree symbol lcd_text(first_line+5, "C"); //Display the letter "C" delay_ms(100); //Wait 100 milliseconds 3. Compile and test your new code.