Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Weather Station Ideas


Gina

Recommended Posts

Sensors have arrived so now I'll set up a test rig.  I think optical is favourite as only 4 sensors needed.  OTOH the emitter diodes need a fair amount of current.  I would prefer Hall devices but ATM I can't see how to use fewer than 8 of them.  Optical is more accurate though.

Edited by Gina
  • Like 1
Link to comment
Share on other sites

3 hours ago, Gina said:

The ESP32 has arrived and it isn't all that big - just over 1" wide and 2" long (28mm x 50mm).  Now I'm waiting for the optical and Hall sensors.

I tend to use the Wemos D1 series of ESP8266 devices, I find them more reliable than the larger DIL one you've just bought (not sure why, but I have had to replace quite a few in that format plus when programming them having to press a button to do so is a bit of a pain), there's also a good range of dev boards for them to experiment with. Since my AAG one-wire station died, I've been running my weather station with them since 2016 though I do have a slight problem with memory erosion over time (I might have a round robin buffer average thingy thats doing too many writes over time somewhere in the code)

The original incarnation was stripboard with RTC, BME280 sensor and an UV sensor hooked up to Davis anemometer, wind direction and rain bucket.  This was housed in an enclosure made from white plastic plant saucers.

image.png.2cc6ed2a85da9e8b64c5ed63288a9a85.pngimage.png.6f342c5f4cfd68c142ee1627ccec87e1.png

 

I eventually replaced the saucer version with a stevenson screen I build out of wood and plastic vent covers.

The strip board didn't last too long though - in June 2018, they finally succumbed to corrosion , I'd replaced the humidity sensor quite some time before that (thats the white thing hanging in the background).

image.png.b0ed7c2574d70b87c3c01e7752f0d3e9.png

 

I'm currently using a D1 mini-pro with external antenna socket though I haven't bothered to fit the external antenna as it has been fine so far. (about 70m down the garden)

Buy Wemos® D1 Mini Pro 16M Bytes External Antenna Connector ...

 

The code has evolved over the years but basically the devices connects over wifi and syncs the RTC with NTP then runs a state machine with interrupts for rain and wind speed pulses. wind direction is analogue ADC input (it's a resistive sensor).  RTC & temp/humidity are I2C/1-wire. There's a watchdog on there to reboot if the device if the wifi is unobtainable etc. I did have a ftp, simple web page and syslog implemented but I've since dispensed of them - though I might put the webpage back on at some point if I get the motivation to do so....

Data uploads to wunderground and posts on twitter every couple of hours plus broadcasts MQTT data which I then use for other stuff in the house using NodeRed including a little weather display (also running on ESP8266) 

image.thumb.png.562e8610bc068161f224c594b693ce16.png

Edited by jiberjaber
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Been looking at the datasheet for the TCRT5000L reflective optical sensor.  With 20mm through the diode it gives 1mA of collector current in the transistor which is more than enough.  Mind you, it does depend on the reflectivity of the surface and that's where experimenting is required.  I'm thinking of going for 10ma diode current giving around 0.5ma collector current.  The volt drop in the diode shows 1.1v so with 4 in series that's 4.4v.  If I run off 12v that leaves 7.6v for a series resistor = 750 ohms.  680 is the nearest preferred value.  For the detector transistor, I think I'll work on 0.25mA as a start.  If I run it from 3.3v, 12K should let it saturate at 0.4v VCE.  I have yet to look at the ESP32 datasheet to see what analogue voltage it takes but mostly this uses 3.3v so I assume that's the maximum.

Link to comment
Share on other sites

4 minutes ago, Gina said:

Been looking at the datasheet for the TCRT5000L reflective optical sensor.  With 20mm through the diode it gives 1mA of collector current in the transistor which is more than enough.  Mind you, it does depend on the reflectivity of the surface and that's where experimenting is required.  I'm thinking of going for 10ma diode current giving around 0.5ma collector current.  The volt drop in the diode shows 1.1v so with 4 in series that's 4.4v.  If I run off 12v that leaves 7.6v for a series resistor = 750 ohms.  680 is the nearest preferred value.  For the detector transistor, I think I'll work on 0.25mA as a start.  If I run it from 3.3v, 12K should let it saturate at 0.4v VCE.  I have yet to look at the ESP32 datasheet to see what analogue voltage it takes but mostly this uses 3.3v so I assume that's the maximum.

Yep - that's correct though I've yet to destroy a pin yet :) 

  • Thanks 1
Link to comment
Share on other sites

For testing I can connect 4 diodes in series and connect to 12v from my bench PSU through a 680Ω resistor.  Since the diodes drop around 1.1v, 3 of them will be 3.3v so I can connect from there to a transistor collector with a 12KΩ resistor and check collector voltage.

926058593_Screenshotfrom2020-06-2820-00-25.png.4260abc4bfa0f9070a3850c4033d44df.png1100698998_Screenshotfrom2020-06-2820-02-23.png.799e1613709d652ff8a6607b32d2e702.png

Link to comment
Share on other sites

Didn't have a 12KΩ so used 10K.  Voltage across the 3 diodes was 2.6v.  Without plastic (white PLA) the collector was at 1.9v with plastic at 2-3mm voltage was 0.18v.  That's a pretty good change.

Link to comment
Share on other sites

Second test :-  Diode current reduced to 5mA by dropping the PSU voltage.  Collector voltage with PLA absent was 2.3v and at 2-4mm gave 0.16v.

Since I don't want to leave the sensors open to the damp I shall have to test with a dark background.  I think I have some FLO black velour for lining scopes, though black paper or matte black paint may do.

I'll do more testing tomorrow.

Edited by Gina
Link to comment
Share on other sites

Link to comment
Share on other sites

The ESP32 would be a good option for the temperature, humidity, pressure, etc. but I am wondering if I'm over thinking the wind vane sensor.  The simplest solution would seem to be reed switches with a resistor network.  My original ones were glass and an inch long also the wind vane was smaller than my current one so I'm thinking the magnetic attraction to the reeds would be a lot less with the modern 14mm long plastic cased reed switches than the earlier glass ones.

Edited by Gina
Link to comment
Share on other sites

OTOH I've been researching the resistor values and circuit for the reed switch system and it seems it needs very odd resistor values and quite complicated wiring.  This may actually be more complicated than a Gray code disc, 4 optical sensors and ESP32 (or maybe ESP8266 with lots of pins).

Link to comment
Share on other sites

11 minutes ago, Gina said:

OTOH I've been researching the resistor values and circuit for the reed switch system and it seems it needs very odd resistor values and quite complicated wiring.  This may actually be more complicated than a Gray code disc, 4 optical sensors and ESP32 (or maybe ESP8266 with lots of pins).

Doesn't the read switch just require a pull-up (or down) resistor - I am sure that is all mine is ?

In the arduino code I enable the internal pull-up and then setup an interrupt with a small debounce timer (500us I think) to increment a counter of wind speed pulses

eg: pinMode(WS_Pin, INPUT_PULLUP); //Wind Speed

Every 5 seconds I calculate the gust speed and every 60s I calculate both gust and wind speed 

eg: wind speed = number of pulses in 60 seconds * distance moved by a cup in one revolution of the device.

Interrupt for wind speed:

Quote

void rpm() {
    long thisTime=micros()-wind_last;
  wind_last=micros();
  if(thisTime>500)
  {
    
  pulseswind++;
  pulsesgust++;
    if (Wind_debug_spd) {
  Serial.print(F("Interupt Nb wind turn:  "));
  Serial.println(pulseswind);
    }
  }
}

function to calculate and return wind speed

Quote

float speedwind()
{
     // cli();
     float pulseswindrmp = ( pulseswind / 60.00f );
     calcwindspeed = ( pulseswindrmp * 2.250f );
    if (calcwindspeed > tempwindgust)
    {
      tempwindgust = calcwindspeed;
    }
  if (debug) {
     Serial.print(F("Total pulseswindrmp:  "));
     Serial.print(pulseswindrmp);
     Serial.print(F("   Wind Speed:  "));
     Serial.println(calcwindspeed);
  }
     pulseswind = 0;
     //sei();
     return calcwindspeed;
     
}

 

I think my original code derived from this code but has huge modifications since then but some of the functions have remained the same (such as the interrupt and wind speed calcs.)

http://chynehome.com/web/wp-content/uploads/2015/10/Personnal_Weather_Station_ESP8266_V2_12.txt

 

Link to comment
Share on other sites

I'm referring to the wind vane with 8 reed switches not the anemometer.  The latter is no problem and I'm using a Hall device.

The 8 reeds and magnet are arranged with an overlap - two reeds connect when the magnet is between them.  This give a 16 direction readout by measuring the output voltage with an ADC.

Edited by Gina
  • Like 1
Link to comment
Share on other sites

1 minute ago, Gina said:

I'm referring to the wind vane with 8 reed switches not the anemometer.  The latter is no problem and I'm using a Hall device.

Yes, you posted just after I had re-read the post in more context!

IIRC the AAG one-wire uses reed switches for position, it then used a one-wire device to take in the switches from which then position could be calculated, so instead of a complicated resistor network, perhaps just have a MUX device to take in the switches and calculate from there? I'll see if I can find the info for the AAG detector.

  • Like 1
Link to comment
Share on other sites

https://www.adafruit.com/product/1083

About £1.50 of Ebay I think   https://www.ebay.co.uk/itm/ADS1115-ADS1015-12-bit-Conversion-Module-Subminiature-Precise-Development/192504483066?hash=item2cd2294cfa:g:NO4AAOSw3K1ayIBO 

 

More expensive if you want them quicker though

(I miss-remembered the specs, they are 12bit 4 input - so probably ideal)

  • Thanks 1
Link to comment
Share on other sites

Makes more sense to use the ESP32 alone than add a separate unit IMO.  Thank you anyway.

Edited by Gina
  • Like 1
Link to comment
Share on other sites

8 reed switches or 4 opto sensors have the same number of connections but the opto system has fewer resistors and fewer connections to the ESP.

Link to comment
Share on other sites

1 minute ago, Gina said:

8 reed switches or 4 opto sensors have the same number of connections but the opto system has fewer resistors and fewer connections to the ESP.

 

I don't think ESP32's were around when I looked at it. I think I might have got these ADC to build my own wind sensor but in the end decided to get Davis sensors and base on that, on the AAG unit it replaced the issue was the components physically deteriorating due to UV rather than the electronics - though it was connected to a PC to run the wx station rather than the smaller unit of an ESP as it is now :)

Other bonus of the ESP32 is it will be a bit more able to handle all the tasks without missing an interrupt ect due to its faster clock speed.

Flip side is the reed switch is not prone to any need for potential cleaning (remote chance but the other is optical so might get some muck in there)

  • Thanks 1
Link to comment
Share on other sites

It seems the ESP32 has programmable pull-up or pull-down internal resistors on most pins.  This may remove the need for external resistors.  I'm hoping this applies to the ADC inputs - I see it certainly applies to most digital inputs.  This makes reed switches more practical as they would only need connecting to ESP and Gnd.  9 connections total.  Another possibility might be Hall switches but more connections needed and they need power.

  • Like 2
Link to comment
Share on other sites

With a 3D printer making either solution would not be too much of an issue. I would still be tempted to try optical with reed switches as the fallback plan. 

One of my projects is to build an ultrasonic version, I just need some more free time!

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.