Saturday, February 8, 2014

Web Based Weather Server Version 2

I have added a Barometric Pressure Sensor to our Web Based Weather Station, and added calculations for Heat Index and Dew Point. You can read about how to build the Weather Server at http://www.instructables.com/id/The-Super-Simple-Arduino-Weather-Web-Server/ and I will be adding the new features to that Instructable.

I had to connect the sensor shield with jumper wires, as it did not play nice with my old Ethernet Shield. I will have to notch the Protoshield to avoid hitting the Ethernet Connector. The Ethernet Shield does not work stacked on top of the Protoshield, as it appears to use the  ICSP Header.





Power Over Ethernet - Powering Remote Arduino's

Several of my projects use Ethernet to communicate data back to a server or internet connection. Our Web Enabled Weather Server for one. I've decided to power the remote arduino and sensor board over the ethernet connection. Common Power Over Ethernet solutions send 48vdc over the spare Ethernet pairs (others send the power over the data pairs as well). The solution I have chosen takes the Ethernet signal from my router, injects the power, and on the other end, strips the power back out before supplying the Ethernet connection to the Arduino. It contains a 48v to 12v/9v/5v DC-DC converter.

TP-LINK TL-POE200 Power over Ethernet Adapter Kit, 1 Injector, 1 Splitter, up to 100 meters (325 Feet), 12/9/5V power output 

http://tinyurl.com/ArduinoPOE

Wednesday, February 5, 2014

Sensing Barometric Pressure

Adafruit makes a nice barometric pressure sensor (BMP180), but their tutorial is designed for the BMP085 and does not compile on Arduino 1.05

It has a built in temperature sensor, and we calculate our current altitude, which is not exact, and can fluctuate with the weather.

Here is how to make it work, and I've added a bunch of calculations for US units of measure. The 4 connections are in the code below. This is a 5v friendly board, and works with the UNO with no modifications.



You will need to download and install the BMP085 library that works with both the BMP085 and the BMP180 at https://github.com/adafruit/Adafruit-BMP085-Library

I will be merging this sensor with our weather project at http://arduinotronics.blogspot.com/2013/12/temp-humidity-w-dew-point-calcualtions.html that serves up temp, humidity, dew point and heat index calculations.


#include <Wire.h>
#include <Adafruit_BMP085.h>

float Tc=0;
float Tf=0;
float Pa=0;
float InHg=0;
float Am=0;
float Af=0;

/***************************************************
  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
 ****************************************************/
//Modified by Steve Spence of http://arduinotronics.blogspot.com

// Connect VIN of the BMP180 sensor to 5.0V //Make sure you have a 5v sensor, otherwise use the 3.3v power pin on the Arduino

// Connect GND to Ground
// Connect SCL to A5 on Arduino Uno (pin 21 on the 2560)
// Connect SDA to A4 on Arduino Uno (pin 20 on the 2560)


Adafruit_BMP085 bmp;

void setup() {
  Serial.begin(9600);
  if (!bmp.begin()) {
Serial.println("Could not find a valid BMP085/180 sensor, check wiring!");
while (1) {}
  }
}

void loop() {
    Serial.print("Temperature = ");
    //Serial.print(bmp.readTemperature());
    Tc=bmp.readTemperature();
    Tf=((Tc*9)/5)+32;
    Serial.print(Tf);
    Serial.println(" *F");
 
    Serial.print("Pressure = ");
    //Serial.print(bmp.readPressure());
    Pa=bmp.readPressure();
    InHg=Pa*0.000295333727;
    Serial.print(InHg);
    Serial.println(" In Hg");
 
    // Calculate altitude assuming 'standard' barometric
    // pressure of 1013.25 millibar = 101325 Pascal
    Serial.print("Altitude = ");
    //Serial.print(bmp.readAltitude());
    Am=bmp.readAltitude(101550); //adjusted for local altitude
    Af=Am*3.28084;
    Serial.print(Af);
    Serial.println(" feet");

  // 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("Real altitude = ");
  //  Serial.print(bmp.readAltitude(101500));
  //  Serial.println(" meters");
 
    Serial.println();
    delay(1000);
}

Tuesday, February 4, 2014

Installing Arduino 3rd Party Libraries

Libraries are pieces of code that commonly add functionality for specific pieces of hardware (can be software functions). Instead of putting all that code into your sketch, you can include and call a library that has the functions you need, passing it parameters for your specific implementation. This keeps your sketch uncluttered, and can help you use hardware that you may not understand. The Arduino IDE comes with lots of libraries built in, but it is common to have 3rd party libraries included with various pieces of hardware. In the past, you would manually unzip these libraries and copy them to the appropriate folders (and you still can) but recent versions of the IDE have a import library function that accomplishes this task for you. Read more at http://arduino.cc/en/Guide/Libraries