For a stand alone weather station with information about temperature and presure, I put a alphanumeric LCD display with 16 colons and 2 rows (1602):
and test montage is:
I use this sketch:
// adapted sketch by niq_ro from http://nicuflorica.blogspot.ro/ & http://arduinotehniq.blogspot.com/// https://github.com/adafruit/Adafruit-BMP085-Library
#include <Wire.h>
#include <Adafruit_BMP085.h>
/*************************************************** This is an example for the BMP085 Barometric Pressure & Temp Sensor Designed specifically to work with the Adafruit BMP085 Breakout ----> https://www.adafruit.com/products/391 These displays use I2C to communicate, 2 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, all text above must be included in any redistribution ****************************************************/// Connect VCC of the BMP085 sensor to 3.3V (NOT 5.0V!)// Connect GND to Ground// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4// EOC is not used, it signifies an end of conversion// XCLR is a reset pin, also not used here// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pinsLiquidCrystal lcd(7, 6, 5, 4, 3, 2);
/* ------------------- | LCD | Arduino | ------------------- LCD RS pin to digital pin 7 | RS | D7 | LCD Enable pin to digital pin 6 | E | D6 | LCD D4 pin to digital pin 5 | D4 | D6 | LCD D5 pin to digital pin 4 | D5 | D4 | LCD D6 pin to digital pin 3 | D6 | D3 | LCD D7 pin to digital pin 2 | D7 | D2 | LCD R/W pin to ground | R/W | GND | -------------------*/
Adafruit_BMP085 bmp;
voidsetup() {
lcd.begin(16, 2);
// Print a logo message to the LCD.
lcd.print("www.tehnic.go.ro");
lcd.setCursor(0, 1);
lcd.print("creat de niq_ro");
delay (2500);
lcd.clear();
// Print another message to the LCD.
lcd.setCursor(2, 0);
lcd.print("termometru -");
lcd.setCursor(0, 1);
lcd.print("barometru ver1.0");
delay (2500);
lcd.clear();
Serial.begin(9600);
if (!bmp.begin()) {
Serial.println("nu exita senzor compatibil BMP085 sau BMP180");
while (1) {}
}
}
voidloop() {
Serial.print("Temperatura = ");
Serial.print(bmp.readTemperature());
Serial.println(" *C");
Serial.print("Presiune = ");
Serial.print(bmp.readPressure());
Serial.print(" Pa / ");
// Serial.print("Presiune = ");float presiune1 = bmp.readPressure()/101.325;
presiune1 = presiune1 * 0.760;
Serial.print(presiune1);
Serial.println(" mmHg");
// Calculate altitude assuming 'standard' barometric// pressure of 1013.25 millibar = 101325 PascalSerial.print("Altitudine = ");
Serial.print(bmp.readAltitude());
Serial.println(" m");
Serial.print("Presiune la nivelul marii (calculata) = ");
Serial.print(bmp.readSealevelPressure());
Serial.print(" Pa / ");
// http://en.wikipedia.org/wiki/Atmospheric_pressure#Mean_sea_level_pressure// Serial.print("Presiure la nivelul marii (calculata) = ");float presiune = bmp.readSealevelPressure()/101.325;
presiune = presiune * 0.760;
Serial.print(presiune);
Serial.println(" mmHg");
// you can get a more precise measurement of altitude// if you know the current sea level pressure which will// vary with weather and such. If it is 1015 millibars// that is equal to 101500 Pascals.Serial.print("Altitudine reala = ");
Serial.print(bmp.readAltitude(101500));
Serial.println(" m");
Serial.println();
lcd.setCursor(1, 0);
lcd.print("temp.= ");
if ( bmp.readTemperature() < 10)
{
lcd.print(" ");
lcd.print(bmp.readTemperature());
}
else
{
lcd.print(bmp.readTemperature(),1);
}
lcd.write(0b11011111);
lcd.print("C ");
lcd.setCursor(1, 1);
lcd.print("pres.= p");
lcd.print(presiune,0);
lcd.print("mmHg ");
delay(2500);
}
24.11.2014 In last weak-end, I received 3 pics from Dave (http://g4rvh.wordpress.com/) with a shield for Arduino Uno, made after my schematic:
Note: This article is a rearrangement ofarticle from http://arduinotehniq.blogspot.ro/2014/09/arduino-due-and-22-tft-display-with.html A usual weather station for domestic use must give us information about temperature and humidity, but a good weather station give us information about pressure, too. I design a weater station with 2.2" TFT display with ILI9341 driver.
I did several experimets with Arduino Uno, then Arduino Mega and my conclusion is that development board are too slow for this display; so, I change classical Arduino board with next step, for me, Arduino Due.
Arduino Due works with 3.3V logical level like ILI9341 driver, so in schematic we not need the logical level convertor (eg CD4050) from 5V to 3.3V as in case use Arduino Uno or Mega.
For control the colour display with ILI9341, I use graphical library named ucglib, derivated from u8glib library for monochrome graphical display. I decided to use BMP180 sensor for give information about temperature and pressure & DHT11 sensor for give just humidity value, because is not accurate at temperature reading. My schematic for sensors at Arduino Due is:
In my case, real ensemble is:
For upload a sketch in Arduino Due must install a new version of Arduino IDE, named 1.5.7 Beta (in future, version will be changed, but now 1.5.7 Beta is current version). For DHT11 sensor must use a new library compatible with Due, I found in a article named Class for DHTxx sensors (xx = 11-21-22-33-44) and for BMP180 I use Adafruit-BMP085. I write some original sketches for this weather station, and last is:
A very interesting device is a AC light dimmer. With Arduino, we can made control with potentiometer (like in shops) or with push buttons. I try more version, and now I present you a AC light dimmer with 2 push buttons for 16 steps and a alphanumerical LCD1602 display. I use 100W incandescent bulb at 230V/50Hz. My schematic is:
*/
#include <LiquidCrystal.h>
// use LiquidCrystal.h library for alphanumerical display 1602LiquidCrystal lcd(13,12,11,10,9,8);
/* ------------------- | LCD | Arduino | ------------------- LCD RS pin to digital pin 13 | RS | D13 | LCD Enable pin to digital pin 12 | E | D12 | LCD D4 pin to digital pin 11 | D4 | D11 | LCD D5 pin to digital pin 10 | D5 | D10 | LCD D6 pin to digital pin 9 | D6 | D9 | LCD D7 pin to digital pin 8 | D7 | D8 | LCD R/W pin to ground | R/W | GND | -------------------*/
#include <TimerOne.h> // Avaiable from http://www.arduino.cc/playground/Code/Timer1
volatile int i=0; // Variable to use as a counter
volatile boolean zero_cross=0; // Boolean to store a "switch" to tell us if we have crossed zeroint AC_pin = 3; // Output to Opto Triacint buton1 = 4; // first button at pin 4int buton2 = 5; // second button at pin 5int dim2 = 0; // led controlint dim = 128; // Dimming level (0-128) 0 = on, 128 = 0ffint pas = 8; // step for count;// version: 4m7 (15.04.2013 - Craiova, Romania) - 16 steps, 4 button & LED blue to red (off to MAX) // version: 7m3 (22.01.2014 - Craiova, Romania) - 16 steps, 2 button & LCD1602int freqStep = 75; // This is the delay-per-brightness step in microseconds for 50Hz(change the value in 65 for 60Hz)voidsetup() { // Begin setupSerial.begin(9600);
pinMode(buton1, INPUT); // set buton1 pin as inputpinMode(buton2, INPUT); // set buton1 pin as inputpinMode(AC_pin, OUTPUT); // Set the Triac pin as outputattachInterrupt(0, zero_cross_detect, RISING); // Attach an Interupt to Pin 2 (interupt 0) for Zero Cross Detection
Timer1.initialize(freqStep); // Initialize TimerOne library for the freq we need
Timer1.attachInterrupt(dim_check, freqStep);
// Use the TimerOne Library to attach an interrupt
lcd.begin(16, 2); // set up the LCD's number of columns and rows:
lcd.clear(); // clear the screen
lcd.setCursor(2, 0); // put cursor at colon 0 and row 0
lcd.print("16 steps AC"); // print a text
lcd.setCursor(0, 1); // put cursor at colon 0 and row 1
lcd.print("dimmer for bulb"); // print a textdelay (3000);
lcd.clear(); // clear the screen
lcd.setCursor(1, 0); // put cursor at colon 0 and row 0
lcd.print("this sketch is"); // print a text
lcd.setCursor(1, 1); // put cursor at colon 0 and row 1
lcd.print("made by niq_ro"); // print a textdelay (3000);
lcd.clear(); // clear the screen
}
void zero_cross_detect() {
zero_cross = true; // set the boolean to true to tell our dimming function that a zero cross has occured
i=0;
digitalWrite(AC_pin, LOW);
}
// Turn on the TRIAC at the appropriate timevoid dim_check() {
if(zero_cross == true) {
if(i>=dim) {
digitalWrite(AC_pin, HIGH); // turn on light
i=0; // reset time step counter
zero_cross=false; // reset zero cross detection
}
else {
i++; // increment time step counter
}
}
}
voidloop() {
digitalWrite(buton1, HIGH);
digitalWrite(buton2, HIGH);
if (digitalRead(buton1) == LOW)
{
if (dim<127)
{
dim = dim + pas;
if (dim>127)
{
dim=128;
}
}
}
if (digitalRead(buton2) == LOW)
{
if (dim>5)
{
dim = dim - pas;
if (dim<0)
{
dim=0;
}
}
}
while (digitalRead(buton1) == LOW) { }
delay(10); // waiting little bit... while (digitalRead(buton2) == LOW) { }
delay(10); // waiting little bit...
dim2 = 255-2*dim;
if (dim2<0)
{
dim2 = 0;
}
Serial.print("dim=");
Serial.print(dim);
Serial.print(" dim2=");
Serial.print(dim2);
Serial.print(" dim1=");
Serial.print(2*dim);
Serial.print('\n');
delay (100);
lcd.setCursor(2, 0); // put cursor at colon 0 and row 0
lcd.print("power is "); // print a text
lcd.print(100-100*(255-dim2)/255);
lcd.print("% "); // print a text
lcd.setCursor(1, 1); // put cursor at colon 0 and row 1
lcd.print("dim. level="); // print a text
lcd.print(dim);
lcd.print(" "); // print a text
}