« Posts tagged lm35

[Part 2] Arduino powered Weather Station

This is the continuation of the the weather station I am slowly building along with other hobbies I have on the go at the same time. Not a lot has changed besides I have added a DHT11 humidity / temperature, SDCard for logging data, I/O Expansion shield, and an ambient light sensor, where hopefully I can find a way to control the backlight to the LCD. Still yet to add a RTC and barometric sensor.

And here is the code that I have put together from sample code that is available with the parts I have used.

»Read More

Arduino powered weather station

This is the starting of my Arduino powered weather station. Thus far we using a Freetronics Eleven (Arduino Uno Compatible) from Jaycars, DFRobot LCD Keypad Shield(Clone off of eBay), and DFRobot LM35 Temperature sensor from Little Bird Electronics. I also have a SDcard module to add for data logging so that can be output to a webpage via gnuplot.

I am going to be adding more to it as I can afford to get items needed, like Humidity, barometric/temperature sensors, bigger LCD and RTC.

Here is some of the current code

// include the library code:
#include <LiquidCrystal.h>
#define aref_voltage 3.3

// initialize the library with the numbers of the interface pins of the DFRobot LCD Keypad shield
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
//Connect LM35 on Analog
int sensorPin = 1;
int sensorTemp;

void setup() {
  // set up the LCD's number of columns and rows
  lcd.begin(16, 2);
  // initialize the serial communications
  Serial.begin(9600);
  analogReference(EXTERNAL);
}

void loop() {
  sensorTemp = analogRead(sensorPin);
  float volt = sensorTemp * aref_voltage;
  volt /= 1024.0;
  float tempC = volt * 1000;
  //Display the temperature on Serial monitor
  Serial.print("Temp:");
  Serial.print(tempC);
  Serial.println("°C");
  delay(500);
  //Display the temperature on LCD   
  lcd.clear(); //clear LCD screen
  lcd.setCursor(0,0);
  lcd.print("Current Temp.");
  lcd.setCursor(0,1);
  lcd.print((long)tempC / 10); //value from analog corresponding to temperature
  lcd.print(".");
  lcd.print((long)tempC % 10);
  lcd.print((char)223); //magic char. # for °
  lcd.print("C");
  delay(1000);
}

If you like my work check out my current wish list @ Sparkfun 😉