Observing the Temperature of the TMP36 Temperature Sensor

Similar documents
MCP4725 Digital to Analog Converter Hookup Guide

Arduino Lesson 13. DC Motors. Created by Simon Monk

Lab 6 Introduction to Serial and Wireless Communication

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

Arduino Lesson 5. The Serial Monitor

Arduino Lesson 16. Stepper Motors

Arduino Lesson 1. Blink

PHYS 2P32 Project: MIDI for Arduino/ 8 Note Keyboard

Arduino Lesson 14. Servo Motors

GM862 Arduino Shield

CanSat Program. Stensat Group LLC

1 Coffee cooling : Part B : automated data acquisition

Arduino Microcontroller Guide W. Durfee, University of Minnesota ver. oct-2011 Available on-line at

The Answer to the 14 Most Frequently Asked Modbus Questions

EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL

AirCasting Particle Monitor Bill of Materials

Connecting Arduino to Processing a

CAN-Bus Shield Hookup Guide

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

DS1307 Real Time Clock Breakout Board Kit

Adafruit SHT31-D Temperature & Humidity Sensor Breakout

How To Use An Ams 5812 Pressure Sensor With A Usb Starter Kit

Sample EHG CL and EHG SL10 16-bit Modbus RTU Packet

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

Home Security System for Automatic Doors

Ultrasonic Distance Measurement Module

Electronic Brick of Current Sensor

Microcontroller Programming Beginning with Arduino. Charlie Mooney

Evaluation copy. Build a Temperature Sensor. Project PROJECT DESIGN REQUIREMENTS

Adafruit BME280 Humidity + Barometric Pressure + Temperature Sensor Breakout

Servo Motors (SensorDAQ only) Evaluation copy. Vernier Digital Control Unit (DCU) LabQuest or LabPro power supply

Lecture 7: Programming for the Arduino

Arduino Lab 1 - The Voltage Divider

C4DI Arduino tutorial 4 Things beginning with the letter i

Thermistor. Created by Ladyada. Last updated on :30:46 PM EDT

Arduino DUE + DAC MCP4922 (SPI)

TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO

Surveillance System Using Wireless Sensor Networks

Building a Basic Communication Network using XBee DigiMesh. Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

SMS Alarm Messenger. Setup Software Guide. SMSPro_Setup. Revision [Version 2.2]

Using LabVIEW to Measure Temperature with a Thermistor

TSL2561 Luminosity Sensor

Arduino Lesson 9. Sensing Light

QUICK START GUIDE FOR DEMONSTRATION CIRCUIT BIT DIFFERENTIAL ADC WITH I2C LTC2485 DESCRIPTION

Wireless Communication With Arduino

Arduino Lesson 17. Sending Movement Detector

#include <Gamer.h> Gamer gamer; void setup() { gamer.begin(); } void loop() {

ZX-NUNCHUK (# )

How to Move Canon EF Lenses. Yosuke Bando

Bluetooth + USB 16 Servo Controller [RKI-1005 & RKI-1205]

DEPARTMENT OF ELECTRONICS ENGINEERING

Programming the Arduino

Temperature Measurement with a Thermistor and an Arduino

Introduction: Implementation of the MVI56-MCM module for modbus communications:

Current Loop Tuning Procedure. Servo Drive Current Loop Tuning Procedure (intended for Analog input PWM output servo drives) General Procedure AN-015

Temperature Measurement with a Thermistor and an Arduino

Arduino Internet Connectivity: Maintenance Manual Julian Ryan Draft No. 7 April 24, 2015

EZIO-4THIE * External CJC Sensor** (National LM19)

How to Make a Pogo Pin Test Jig. Created by Tyler Cooper

Connection to an RS-485 Network

How To Control A Car With A Thermostat

Zeros, Ones, and the Morse Code

FREQUENCY RESPONSE OF AN AUDIO AMPLIFIER

Green House Monitoring and Controlling Using Android Mobile Application

Character LCDs. Created by Ladyada. Last updated on :45:29 PM EDT

IR Communication a learn.sparkfun.com tutorial

Data Sheet. Adaptive Design ltd. Arduino Dual L6470 Stepper Motor Shield V th November L6470 Stepper Motor Shield

Arduino Shield Manual

RN-52 Bluetooth Hookup Guide

Temperature Scales. The metric system that we are now using includes a unit that is specific for the representation of measured temperatures.

Electronics 5: Arduino, PWM, Mosfetts and Motors

AXE033 SERIAL/I2C LCD

User Manual. Air-conditioner Controller SB-DN-HVAC (MAC01.331)

A REST API for Arduino & the CC3000 WiFi Chip

What's New in ADP Reporting?

Arduino Motor Shield (L298) Manual

1602 LCD adopts standard 14 pins(no backlight) or 16pins(with backlight) interface, Instruction of each pin interface is as follows:

Arduino-Based Dataloggers: Hardware and Software David R. Brooks Institute for Earth Science Research and Education V 1.2, June, , 2015

Parallax Serial LCD 2 rows x 16 characters Non-backlit (#27976) 2 rows x 16 characters Backlit (#27977) 4 rows x 20 characters Backlit (#27979)

USB / Data-Acquisition Module NOW LEAD-FREE

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

Arduino Wifi shield And reciever. 5V adapter. Connecting wifi module on shield: Make sure the wifi unit is connected the following way on the shield:

Sending an SMS with Temboo

Arduino Shield Manual

Yun Shield Quick Start Guide VERSION: 1.0 Version Description Date 1.0 Release 2014-Jul-08 Yun Shield Quick Start Guide 1 / 14

RS232 Board datasheet

Experiment 8 : Pulse Width Modulation

Lab 4 - Data Acquisition

APPLICATION NOTE. Measuring Current Output Transducers with Campbell Scientific Dataloggers. App. Note Code: 2MI-B Revision: 1

cs281: Introduction to Computer Systems Lab08 Interrupt Handling and Stepper Motor Controller

Driver Installation and Hyperterminal Operation of iload Digital USB Sensors

AN2680 Application note

Advanced Data Capture and Control Systems

KTA-223 Arduino Compatible Relay Controller

RGB for ZX Spectrum 128, +2, +2A, +3

Arduino project. Arduino board. Serial transmission

Controlling a Dot Matrix LED Display with a Microcontroller

Transcription:

Observing the Temperature of the TMP36 Temperature Sensor By now you ve learned how to upload code, wire components onto a breadboard and control an LED with an analog input; you ve come a long way! This tutorial will have you observe, on your computer screen, the temperature in the room using the TMP36 temperature sensor. By the end, you ll know how to read a datasheet and observe variables directly using the Serial class of functions. Part 1. Gathering Materials To complete this tutorial, you ll need a few things: A computer with the Arduino IDE installed and setup for the Sparkfun Redboard 1 x TMP36 temperature sensor 3 x 6 Jumper Wire 1 x breadboard 1 x Sparkfun Redboard 1 x USB (B) Cable Part 2. Wiring the Components Figure 1. Wiring Diagram for the TMP36 temperature sensor After acquiring the parts, wire the sensor to how it s shown in figure 1. While wiring, make sure that the flat side of the sensor is facing you. The leftmost pin is connected to 5V and the rightmost pin is connected to GND. The middle pin contains the data for the temperature and will connect to the A0 analog input. Learning to wire the sensor is as easy as reading the

datasheet (http://cdn.sparkfun.com/datasheets/sensors/temp/tmp35_36_37.pdf). Figure 4 in that datasheet shows how this sensor is to be wired. Part 3. Reading a Datasheet Unfortunately when you get a new sensor in the mail, like the TMP36, it doesn t come with an instruction manual. The first thing to do is to lookup the datasheet online. This will show how to wire it, what voltages are appropriate for the device, the functional diagram for how it works, how to use it in a program, and many other things. Thankfully this is a relatively simple sensor to interface with and doesn t require hours of reading like the MLX90620 temperature sensor. For this application, we are mostly concerned with Figure 6 in the datasheet, shown in this tutorial in Figure 2. Figure 2. Output voltage versus temperature ( C) for the TMP family of temperature sensors We ll be using the TMP35 sensor, Figure 2 shows that, for the line labeled (b), at 0 C we should expect the output voltage to be 0.5V and at 50 C we expect the output to be 1V. This shows that for each degree Celsius increase, we should expect an increase of 10 mv on the output. Because this is a linear relationship with a slope of 10mV / C, the equation for the line is: Temperature ( C) = (Output Voltage - 0.5)100 To convert from Celsius to Fahrenheit, we will use the following relationship: F = (1.8 C) + 32 Now we re ready to program the TMP36 temperature sensor.

Part 4. Programming Void setup(){ / This initiates the connection for the arduino to communicate back data to the computer at a bitrate equal to the number inside the parenthesis. The Arduino IDE and most other programmers use 9600 bits/sec as a default. / Serial.begin(9600); } void loop() { / First, we'll gather the data that the temperature sensor is providing as an output / int rawvalue = analogread(a0); / The datasheet correlates voltage to temperature. We'll first need to convert the analogread into an actual voltage. Knowing that 0V corresponds to a reading of 0 and a reading of 5V corresponds to a reading of 1023 means that they're related by: Voltage = (5/1023)analogRead Another thing to note here is the difference between different types of number values. int type: if a variable is declared as an int, it can only be a whole number between -32,678 and +32,677. The use of this variable uses 2 bytes of information float type: if a variable is declared as a float, it can be between -3.402824E+38 and +3.402824E+38 with 6 digits of decimal space available. For numbers that may contain decimals, like in this tutorial, we will want to use a float. The use of this variable uses 4 bytes of information One last point to note is how division works in Arduino. Theres whole number division, and decimal precision division. For example, 5/1023 will result in zero because it rounds down to the nearest whole number. While 5.0/1023.0 will result

in a more exact value of 0.004888 / float voltagereading = (5.0/1023.0) rawvalue; //Using the conversion of: //Temperature = (Voltage - 0.5)100 float tempcelsius = (voltagereading - 0.5)100.0; //Using the conversion of: //Fahrenheit = 1.8 Celsius + 32 float tempfahrenheit = (tempcelsius 1.8) + 32; / Now we'll want to print out the values of these variables and see how the sensor responds when you breathe on it! To print a line of text, we'll use Serial.print() and Serial.println() functions and put what we want inside the parenthesis, with quotes surrounding the text. Or no quotes in the case of just printing a variable If you'd like to print multiple things on the same line, Serial.print() allows you to do that. For the following code: int test = 5; Serial.println("Hello World"); Serial.println(test); Serial.print("Hello World"); Serial.print(test); Will print the following inside the Serial Monitor: Hello World 5 Hello World5 / Serial.print("The Voltage on the Input is: "); Serial.print(voltageReading); Serial.print(" V"); Serial.print("The Temperature is: "); Serial.print(tempCelsius); Serial.print(" degree(s) Celsius");

Serial.print("Or: "); Serial.print(tempFahrenheit); Serial.print(" degree(s) Fahrenheit"); / Using the delay() command, we can control how quickly the Arduino reads the temperature in the room. The number inside the parenthesis is the wait time, in milliseconds / delay(500); } Part 5. Uploading the program and testing Now, upload the code and click on the magnifier glass in the top right window. A new window should appear and start printing lines of text. The output should look like something in Figure 3, and print a new section every half second. Figure 3. Sample Output Let the program run for a few seconds and you should start to see that the output is the same every time it prints. Now breathe onto it! The warm air from your breath should cause the temperature sensor to start increasing in temperature, and if left alone for some time, will return to the value it was at before the breath. That concludes this tutorial, introducing you to how to interface with a sensor, read a datasheet, and view its output onto a computer monitor. The next one will show you how to create a night light with the light sensor and an LED Happy Tinkering!