Barometer

Fig. 1: MS5637 barometer/altimeter

The Sparrow nodes are using the MS5637 pressure sensor for barometric and altimeter measurements. We will use the Freetronics library to interface with it.

#include <Wire.h>
#include <BaroSensor.h>
int controlPin = 7;
 
void setup()
{
  pinMode(controlPin, OUTPUT);  //sensor on/off control
  delay(100);
 
  digitalWrite(controlPin, LOW);
 
  Serial.begin(9600);
  BaroSensor.begin();
}
 
void loop()
{
  if(!BaroSensor.isOK()) {
    Serial.print("Sensor not Found/OK. Error: "); 
    Serial.println(BaroSensor.getError());
    BaroSensor.begin(); // Try to reinitialise the sensor if we can
  }
  else {
    Serial.print("Temperature: "); 
    Serial.println(BaroSensor.getTemperature());
    Serial.print("Pressure:    ");
    Serial.println(BaroSensor.getPressure());
  }
  delay(1000);
}

The light sensor on the Sparrow node is very versatile, it can measure visibile, infrared and UV radiation. Check it out!