Friday, August 9, 2024

Resurrecting The Met One MSO Weather Sensor

 

We have three defective MSO weather sensors from Met One Instruments that have been sitting in the junk box for over 7 years. Upon checking the Met One Instruments website, we found that this product has long been discontinued and replaced by Met One AIO weather sensor. Both models are identical except the AIO weather sensor now using an ultrasonic wind speed and wind direction sensor. 

These three MSO units suffered a common failure-- the board's microcontroller was damaged by an electrical surge, rendering the entire unit useless. For those unfamiliar with the MSO, let me give a short description about the instrument. It is a compact weather instrument made by Met One Instruments. The MSO includes an anemometer for measuring wind speed, a vane for measuring wind direction, a digital pressure sensor for atmospheric pressure and lastly it has a temperature/humidity sensor for measuring ambient temperature and relative humidity. That's 5 weather sensors combined in a small package.


For this project, I plan to reuse the potentiometer in the wind direction since it is still functional. The MSO uses a 360-degree 10K potentiometer and a reed switch for the anemometer assembly. 

For the ambient temperature, humidity and barometric pressure, I decided to use the new BME280 digital sensor from Adafruit. All these sensors can be easily integrated and processed by an Arduino microcontroller.



I built my prototype board on a single PCB measuring (2.5in x 2.5in) in size. The Arduino nano and the LM2596 buck converter are all mounted on the top. The buck converter is more convenient than the typical 7805 regulator since in can handle up to 35V of input without heating. Another important module in the project is the RS232 to TTL converter. It is mounted at the back of the pcb so only the 4 pins are visible on the surface. The converter is responsible for interfacing the Arduino to the outside world!

The MSO weather sensor sends a serial data every second. There are 5 parameters separated by a comma and terminated by a carriage return (cr) and line feed (lf). The format is:

Temp,Humidity,Pressure,Wind Speed,Wind Direction(cr)(lf)




We can use a datalogger or a serial data terminal program such as the RealTerm to display the real-time readings of the MSO weather sensor.  Below is the code used by the Arduino to integrate all the 5 sensors!


/***************************************************************************
  This is a library for the BME280 humidity, temperature & pressure sensor
  This example shows how to take Sensor Events instead of direct readings
  
  Designed specifically to work with the Adafruit BME280 Breakout
  ----> http://www.adafruit.com/products/2652

  These sensors use I2C or SPI to communicate, 2 or 4 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 & Kevin Townsend for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ***************************************************************************/

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BME280.h>



Adafruit_BME280 bme; // use I2C interface
Adafruit_Sensor *bme_temp = bme.getTemperatureSensor();
Adafruit_Sensor *bme_pressure = bme.getPressureSensor();
Adafruit_Sensor *bme_humidity = bme.getHumiditySensor();


const int pulsePin = 7; // Pin where the pulse signal is connected
unsigned long duration; // Duration of the pulse in microseconds
int frequency; // Frequency of the pulse in Hertz

void setup() {
  pinMode(pulsePin, INPUT_PULLUP);
  Serial.begin(9600);
  Serial.println(F("BME280 Sensor event test"));

  if (!bme.begin()) {
    Serial.println(F("Could not find a valid BME280 sensor, check wiring!"));
    while (1) delay(10);
  }
  
  //bme_temp->printSensorDetails();
  //bme_pressure->printSensorDetails();
  //bme_humidity->printSensorDetails();

  Serial.println();
  Serial.println("Multi Parameter Weather Sensor");
  Serial.println("Developed by Hevir, DU1VSS, 8/8/24");
  Serial.println();
  Serial.println("AT,RH,BP,WS,WD");
  Serial.println();


}

void loop() {

  ///   code for bme280   ///
  sensors_event_t temp_event, pressure_event, humidity_event;
  bme_temp->getEvent(&temp_event);
  bme_pressure->getEvent(&pressure_event);
  bme_humidity->getEvent(&humidity_event);

  ///   code for frequency counter   ///
    
    duration = pulseIn(pulsePin, LOW); //measure the duration of the pulse.
    frequency = 1000000.0 / duration; // Frequency = 1 / period, period = duration in microseconds
    float ws = ((frequency * 0.805) + 0.1748);


  ///   code for wind direction   ///

  int raw = analogRead(A2);
  int wd = (raw * (5.0 / 1023.0) * 72);



  Serial.print(temp_event.temperature);
  Serial.print(",");

  Serial.print(humidity_event.relative_humidity);
  Serial.print(",");

  Serial.print(pressure_event.pressure);
  Serial.print(",");

  Serial.print(ws);
  Serial.print(",");

  Serial.print (wd);
  Serial.print(",");

  Serial.print ("000"); //This extra line is included for siap+micros to parse the data correctly.
  Serial.println();

  delay(1000);
}






---73 de du1vss


No comments:

Post a Comment