Jump to content

SkySurveyBanner.jpg.21855908fce40597655603b6c9af720d.jpg

Weather Station Ideas


Gina

Recommended Posts

4 minutes ago, Gina said:

Looking at the wind vane calculations...  I will have 8 digital inputs to the ESP32 two of which may be on at the same time.  A "sledgehammer" approach would be to assign values of 1, 2, 4, 8, 16 etc. and then use a look-up table to convert to 16 values 0-15. This table would have 256 entries.  I'm wondering if this would put a strain on the ESP32.  Guess I can try it and see.  Then Consensus Averaging with magnum maths and put the result in the HTML string.

Actually you don't need a 256-entry table, because most of those entries are invalid.  For example, assuming the pins are connected in sequence around the compass and, say, the pin giving value 4 is "on" then the only other pins that should also be possible to see "on" are either 2 or 8.  Therefore any input that is not a single pin or a pair of adjacent pins is not valid and can be discounted.

James

Link to comment
Share on other sites

Have you considered storing your readings in a database. Then you can split the system into 2 parts;

1. A part based on the ESP32 that simply takes readings & logs raw data to the database 

2. A front-end based on a pi or pc that displays the data. This can be more powerful for the processing required. Having the data in a db also allows you to keep a history of your readings. I now have readings going back to 2016 in my weather db.

Link to comment
Share on other sites

Just now, Gina said:

Do you use a Real Time Clock with that James?

Not a hardware one, no.  I'm not using a microcontroller for mine though, so my system can be synchronised to "real" time using NTP.

James

  • Thanks 1
Link to comment
Share on other sites

2 minutes ago, JamesF said:

Actually you don't need a 256-entry table, because most of those entries are invalid.  For example, assuming the pins are connected in sequence around the compass and, say, the pin giving value 4 is "on" then the only other pins that should also be possible to see "on" are either 2 or 8.  Therefore any input that is not a single pin or a pair of adjacent pins is not valid and can be discounted.

James

That's what I was thinking but ATM I can't think of a better method.  I'll get my thinking cap on!

Link to comment
Share on other sites

2 minutes ago, tekkydave said:

Have you considered storing your readings in a database. Then you can split the system into 2 parts;

1. A part based on the ESP32 that simply takes readings & logs raw data to the database 

2. A front-end based on a pi or pc that displays the data. This can be more powerful for the processing required. Having the data in a db also allows you to keep a history of your readings. I now have readings going back to 2016 in my weather db.

That's my usual way of doing things but I need to get readings from the ESPs more automatically.  ATM I'm just using a browser (Firefox) to read each ESP manually.  This current method will do for now - far better than nothing.

Link to comment
Share on other sites

7 minutes ago, Gina said:

That's what I was thinking but ATM I can't think of a better method.  I'll get my thinking cap on!

What language are you going to be using for writing the code?

James

Link to comment
Share on other sites

Thinking online...  Let's look at how a table may be formed.  We have a "1" for N, NE, E, SE, S, SW, W, NW.   If we assign a value of 1 for N and 2 for NE we have 1, 2 or 3. So the value for E has to be 4.  With E on we can have that alone or with NE or SE.  NE has a value of 2 so ENE gives 2+4 = 6.  So far so good...  N=1, NE=2, E=4.  We haven't used 5 so let's try assigning 5 to SE.  ESE = 5+4 = 9.  Next number is 6.  Assigning 6 to S gives 6+5=11 for SSE.  Assigning 7 for SW gives SSW=7+6=13.  Assigning 8 for W gives 8+7=15 for WSW.  9 for NW gives 9+8=17 for WNW.  Now the critical case of NNW.  That's 9+1=10, which we haven't had yet so that's fine!

Let's tabulate this.

  • N = 1
  • NNE = 3
  • NE =2
  • ENE = 6
  • E = 4
  • ESE = 9
  • SE = 5
  • SSE = 11
  • S = 6
  • SSW = 13
  • SW = 7
  • ESW = 15
  • W = 8
  • WNW
  • NW = 9
  • NNW = 10

So the table looks like this.

  1. N
  2. NE
  3. NNE
  4. E
  5. SE
  6. S
  7. SW
  8. W
  9. ESE
  10. NNW
  11. SSE
  12. N/A
  13. SSW
  14. N/A
  15. ESW
  16. N/A

So we have a table of 16 entries rather than 256.  Great!

 

Link to comment
Share on other sites

13 minutes ago, JamesF said:

Do you have to read the pins individually, or can you read them all in one go?

James

I think they have to be read individually.

Link to comment
Share on other sites

The very first 1-wire wind-vane I had contained 8 reed switches. It selectively shorted out resistors in a chain to give a 4-bit analogue reading. This was read by a 4-bit 1-wire AtoD chip and the software then used the values to calculate 1 of 16 compass directions. I'll see if I can find the original circuit.

Edit: found it! 

This is  pdf so d/l then open up

CalculatingWindSpeedAndDirection.PDF

Edited by tekkydave
Link to comment
Share on other sites

Yes, that was one of the alternatives I had in mind but the 8+1 wire digital connection doesn't need any resistors.  Otherwise not a lot to choose between them - no resistors v more wires.

Link to comment
Share on other sites

3 hours ago, Gina said:

Seems the "easy" places to put the Stevenson screen would not be good!

2080222346_Screenshotfrom2020-07-3011-09-04.png.2230c6be0645173c3ea34631a12d22eb.png

The north obsy wall, while shaded from the sun would not allow much airflow.  On the wind sensor pole would suffer from heat from the black rubber roof of the obsy.  Same with the ASC pole.

Here's a rough aerial view courtesy Google (a few years old).  The rough ground cover and the whole of the area is currently overgrown with thistles but will be cleared.  I'm thinking perhaps on a fence post on the boundary where I took a tree down might be as good as anywhere (if within WiFi range).  The greener area is my property - the not so green area is my neighbours field.

1624809195_AerialView02.png.1f9297694989bb8100c305e572f62772.png

Where that tree used to be, seems the best location. Otoh, as I said before, you're probably not going to do any scientific research with it, so near the wind instruments or even the asc, would be ok too. Meteorological meassurements have to be consistent, and comparable with each other. For those, stations need to be located in similar environments. But for you, it doesn't matter as much. Just make sure that obvious heat an circulation disturbing sources are avoided.

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

1 hour ago, Gina said:

For the wind instruments, instantaneous wind speed has little meaning.  I'll probably average over 5 minutes.

Right so, but it's wind gusts that will cause problems when the obsy is open. Even if the station won't control the obsy, it's nice to know what's happening outside. Along with the average of 5 minutes, also measure the maximum for those 5 minutes.

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, JamesF said:

Do you have to read the pins individually, or can you read them all in one go?

James

I don't know if an esp can, but an avr microcontroller, such as an arduino, certainly can. Input pins of such a chip are configured as 8 bit registers, called Ports, and you will normally read one such register/ port (= 8 bit) at a time. The solution that comes to mind is to use an attiny84 or similar. Connect the vane to 8 of its input pins, and program it as an i2c slave device.

Edit:

Since esp pins are configurable, the internal layout is very different from avr controllers. To read multiple gpio pins at the same time, you have to create your own register. Similar to this (but inputs in stead of outputs)

https://stackoverflow.com/questions/52348930/esp32-direct-port-manipulation

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

2 hours ago, Gina said:

I think they have to be read individually.

In that case if we assumed pin 0 is N, pin 1 is NE, pin 2 is E and so on around the compass points, I would probably do something similar to this:

pinValues = 0;

for ( p = 0; p < 8 ; p++ ) {
  if ( pin p is on ) {
    pinValues |= ( 1 << p );
  }
}

windDirection = UNDEFINED;
switch ( pinValues ) {
  case 0x01 : windDirection = NORTH; break;
  case 0x03 : windDirection = NNE; break;
  case 0x02 : windDirection = NE; break;
  case 0x06 : windDirection = ENE; break;
  case 0x04 : windDirection = E; break;
  // ...etc
}

James

  • Thanks 1
Link to comment
Share on other sites

Ah yes, that's a simpler method - thank you.

Actually, since I shall go on to do Consensus Averaging I'll use integer values 0-15.

Edited by Gina
Link to comment
Share on other sites

I'd not come across the consensus averaging thing before, so it looks like I have a little more coding to do myself now :)

What I might actually do, possibly for no other reason than I like to complicate things :), is to keep separate sets of "bins" for each minute of a five minute period, effectively making them ring buffers each containing a minute's worth of data for each bin.  That would allow me to update the wind direction every minute based on the last five minutes' data.

James

  • Like 1
Link to comment
Share on other sites

No, I hadn'r come across Consensus Averaging before either - it's very clever and makes use of the waggling of the vane to get a better resolution out of the 16 compass points.  My earlier weather stations used magnetic damping to reduce the waggling.  Then to get an average I would use 16 bins to collect points for each direction and use the one with the most counts as the true direction.  Consensus Averaging takes this much further.

Link to comment
Share on other sites

1 hour ago, JamesF said:

In that case if we assumed pin 0 is N, pin 1 is NE, pin 2 is E and so on around the compass points, I would probably do something similar to this:


pinValues = 0;

for ( p = 0; p < 8 ; p++ ) {
  if ( pin p is on ) {
    pinValues |= ( 1 << p );
  }
}

windDirection = UNDEFINED;
switch ( pinValues ) {
  case 0x01 : windDirection = NORTH; break;
  case 0x03 : windDirection = NNE; break;
  case 0x02 : windDirection = NE; break;
  case 0x06 : windDirection = ENE; break;
  case 0x04 : windDirection = E; break;
  // ...etc
}

James

I may be wrong but I don't think your for loop gives the right results.  I worked out that the pins needed special numbering viz.  1 2 4 5 6 7 8 9.  Note that 3 had to be left out as we get that with NNE from N + NE (1+2).

Edited by Gina
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.