arduino temperature humidity

7
http://www.instructables.com/id/Arduino-Temperature-Humidity/ Home Sign Up! Browse Community Submit All Art Craft Food Games Green Home Kids Life Music Offbeat Outdoors Pets Photo Ride Science Tech Arduino + Temperature + Humidity by devillived on November 5, 2008 Table of Contents Arduino + Temperature + Humidity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Intro: Arduino + Temperature + Humidity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Step 1: Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Step 2: Setting up Arduino + Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Step 3: Connecting Humidity Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Step 4: Setting up code!!! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Upload: giri-nata-wirawan

Post on 20-Oct-2015

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Arduino Temperature Humidity

http://www.instructables.com/id/Arduino-Temperature-Humidity/

Home   Sign Up!   Browse   Community   Submit

   All     Art     Craft     Food     Games     Green     Home     Kids     Life     Music     Offbeat     Outdoors     Pets     Photo     Ride     Science     Tech

Arduino + Temperature + Humidityby devillived on November 5, 2008

Table of Contents

Arduino + Temperature + Humidity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Intro:   Arduino + Temperature + Humidity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 1:   Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Step 2:   Setting up Arduino + Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 3:   Connecting Humidity Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

Step 4:   Setting up code!!! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Page 2: Arduino Temperature Humidity

http://www.instructables.com/id/Arduino-Temperature-Humidity/

Intro:  Arduino + Temperature + HumidityA simple temperature sensor using one LM35 Precision Temperature Sensor , Humidity Sensor and Arduino, so you can hookup on your future projects. The circuit willsend serial information about the temperature and humidity so you can use on your computer. I have taken data from my compost. The project is related to an existingproduct daily dump with which anyone can convert kitchen waste into compost at home. For more details about product go to http://www.dailydump.org/content/.Digicompost displays the changes (change in temp, humidity) happening inside dump

Step 1: Materials- Arduino (You can use other microcontroller, but then you will need to change the code).- LM35 Precision Centigrade Temperature Sensor , you can get from any electronic store. Here is the DATA SHEET.- BreadBoard.- Humidity Sensor.- Wires.

Page 3: Arduino Temperature Humidity

http://www.instructables.com/id/Arduino-Temperature-Humidity/

Page 4: Arduino Temperature Humidity

http://www.instructables.com/id/Arduino-Temperature-Humidity/

Step 2: Setting up Arduino + TemperatureArduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, andanyone interested in creating interactive objects or environments. For more information log on to (http://www.arduino.cc)

Connecting a temperature sensor:The LM35 has three legs and looks like a transistor. The two outside legs are+5v and Ground, and the middle leg develops the sample voltage.

The Analog to Digital Converter (ADC) converts analog values into a digital approximationbased on the formula ADC Value = sample * 1024 / reference voltage (+5v). So with a +5 voltreference, the digital approximation will = input voltage * 205. (Ex. 2.5v * 205 = 512.5)

The LM35 is a precision linear temperature sensor that supplies 10mv per degree Celsius.This means at 15 degrees Celsius, it would produce a reading of .150v or 150 millivolts.Putting this value into our ADC conversion ( .15v * 205 = 30.75) we can get a closeapproximation of the Celsius temperature by dividing the digital input count by 2.

If the LM35 were supplied by a different reference voltage (9v or 12v) we would haveto use a different conversion method. For this circuit, dividing by 2 works well.

Step 3: Connecting Humidity SensorThere are two pins on to the humidity sensor one is for ground and other for out which goes on the pin 3 on to arduino. I have used a local made sensor for testinghumidity/ moisture but one can go for SHT15 which have both temperature and humidity.

Page 5: Arduino Temperature Humidity

http://www.instructables.com/id/Arduino-Temperature-Humidity/

Step 4: Setting up code!!!Plug in your arduino to the computer, open the application select proper port and model no. before you start any coding. After everything is done write down the code asshown below:

int pin = 5; // analog pinint putPin = 3; // humidityint tempc = 0,tempf=0; // temperature variablesint samples[8]; // variables to make a better precisionint maxi = -100,mini = 100; // to start max/min temperatureint i;

float humi = 0;float prehum = 0;float humconst = 0;float truehum = 0;float pretruehum = 0;long pretruehumconst = 0;long valb = 0;

void setup(){Serial.begin(9600); // start serial communication}

void loop(){

for(i = 0;i<=7;i++){

samples[i] = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;tempc = tempc + samples[i];delay(1000);}

tempc = tempc/8.0;tempf = (tempc * 9)/ 5 + 32;

valb = analogRead(putPin); // humidity calculationprehum = (valb/5);humconst = (0.16/0.0062);humi = prehum - humconst;pretruehumconst = 0.00216*tempc;pretruehum = 1.0546-pretruehumconst;truehum = humi/pretruehum ;delay(1000);

Serial.print(tempc,DEC);Serial.print(" Celsius, ");Serial.print ("Humidity: ");Serial.print ((long)truehum);Serial.println ("% ");

tempc = 0;

delay(1000); // delay before loop}

After everything is done click on the upload button which will take a little while to upload and when the uploading is done make sure you click on the SerialCommunication to get the readings from the sensor !!!

Page 6: Arduino Temperature Humidity

http://www.instructables.com/id/Arduino-Temperature-Humidity/

Related Instructables

The ArduinoWeather Station/ Thermostat bysspence

Using Humiditysensor with8051Microcontroller(video) byashoksharma

SeeeduinoHumidity andNoise notifier bysuqingxiao

DigitalTemperature/Hygrometermodification bymemkuk

Arduino BasedTemperatureMonitor (video)by kunal_djscoe

MushroomEnvironmentControl -ArduinoPowered byanthony_p1234

Comments

14 comments Add Comment

 i0scan says:  Jul 31, 2009. 4:47 PM  REPLYCan I ask where you got the humidity sensor and how much it cost? Great instructable by the way.

 devillived says:  Oct 26, 2009. 8:34 PM  REPLYIts a local made humidty sensor i am not in the town for few days but can send you the pdf i have made. which has most of the information so let meknow if you need it send me a hi mail to [email protected] will send you the pdf

 ReagenWard says:  Oct 26, 2009. 9:08 AM  REPLYWould you mind adding details about the humidity sensor?

 devillived says:  Oct 26, 2009. 8:32 PM  REPLYIts a local made humidty sensor i am not in the town for few days but can send you the pdf i have made from it which has most of the information so letme know if you need it send me a hi mail to [email protected] will send you the pdf

 pavan5859 says:  Jun 8, 2009. 1:39 PM  REPLYcan it used on the hot water pipes to know the temperature

 devillived says:  Jun 8, 2009. 8:46 PM  REPLYyes you can unless you use other temperature sensors available in the market ...

 Ubachukwu says:  Mar 25, 2009. 9:56 PM  REPLYCan You use this device to measure Water Temperature? IF so, how would you go about doing so?

Page 7: Arduino Temperature Humidity

http://www.instructables.com/id/Arduino-Temperature-Humidity/

 Ubachukwu says:  Mar 26, 2009. 1:48 AM  REPLYok, I read up on insulating the microchip in another instructable thanks. This arduino code that you have posted, I am not sure what the member "silverhalo" meant by the code not working and needing some swaping. Can you explain the code or at least tell me what errors are in the code so I may adjustthe code myself

 devillived says:  Mar 26, 2009. 8:51 AM  REPLYwell if its possible for you to tell me where your facing the issue!!! then i can guide you with it !!!

 devillived says:  Mar 25, 2009. 11:45 PM  REPLYya you can just make sure your temperature sensor is properly insulated!!!!

 rolandl says:  Nov 12, 2008. 7:17 AM  REPLYIf you use linux, I suggest you install SimpleMessageSystem (from arduino.cc) and get my shellscript package from http://user.cavenet.com/rolandl, calledSMS1.tgz. It will read all 6 AD channels, scale to mV, and format for import to most spreadsheets. Easy to modify input and scaling for your choice ofsensors. Now with GUI via xdialog command. Allows complex control via scripts. Check it out.

 silverHalo says:  Nov 9, 2008. 9:10 AM  REPLYIs the "samples" syntax correct, I was having issues when it complied. Is it supposed to be samples[8] and samples[i] instead? thanks!

 silverHalo says:  Nov 9, 2008. 10:04 AM  REPLYMust be something with the instructables formatting of the posts... it changed my formatting too!! The syntax should be "samples" followed by an openbracket (with the "8" or "i" inside of the bracket) and the closed bracket..... These posts don't like [

 devillived says:  Nov 9, 2008. 8:03 PM  REPLYYes there is some problem with the formatting will upload the file!!