
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 😉
Recent Comments