Jump to content

SkySurveyBanner.jpg.21855908fce40597655603b6c9af720d.jpg

Arduino Based Weather Station


Gina

Recommended Posts

Load the PV with a small resistor, say 47R or even less. That will make sure a small amount of light doesn't give too high a voltage, as with a high impedance load it will just rise up to near the maximum even in low illumination.

  • Thanks 1
Link to comment
Share on other sites

Haven't found that PV cell but I have found my box of lenses for widefield imaging.  I have designs for 3D printed brackets for whichever aluminium pipe I decide to use and a support bracket for the larger diameter pipe.  With over-engineering in mind, I think I shall use the thicker one.  I can't really see any disadvantage.

Before I stick the wind (and light level) measuring unit up in the air though I really need to work out how I'm going to connect it.  As it is, it just connects to a computer via USB.  The data logging and indoor instruments unit also connects via USB.  Then there's the exterior temperature and humidity unit and the rain gauge to connect in. 

My earlier weather station design used 1-wire bus but with several of the 1-wire devices being no longer available I have abandoned that idea.  I shall need to have a good think ?  I plan to put the indoor unit in my observatory scope room where it can check temperature and humidity in there (more useful than in the house, I reckon).  The display will be indoors.  The observatory currently has a CAT6 megabit Ethernet connection but no USB connection to the house.

Edited by Gina
Link to comment
Share on other sites

I see the current Ethernet shields for the Arduino do have pass through connections so it may be possible to stack both the Ethernet shield and the data logger shields on the main Arduino Uno or Mega.  I'm currently using a Uno but have a feeling it won't have enough I/O ports.  Fortunately the shields fit both Uno and Mega.  The data from the wind instruments could be carried by a serial stream over two or three lines (including Gnd) and, in fact, I gather you can connect two Arduinos via I2C or serial.

Edited by Gina
Link to comment
Share on other sites

If I were starting again I would probably go for the RPi rather than Arduino but with almost all the hardware built and the code written, I'll probably stick with the Arduinos.  My WiFi should work but as I already have gigabit Ethernet available in my observatory, I think I'll use that.  OTOH if the Arduinos prove too awkward the RPi is an alternative.

Link to comment
Share on other sites

Similar reasons here. I already had the 1-wire sensors, wind vane and Sheepwalk interface for the RPi so it was a no-brainer. Plus I wanted to program in Java and use a database on the indoor RPi. I started with sqlite but have now switched to mySQL as I have multiple clients accessing the db and sqlite will not handle it.

  • Like 1
Link to comment
Share on other sites

Been reading about I2C for connecting two Arduinos and there's a problem with the cable length.  The limit appears to be less than 2m and the remote Arduino is up on the top of my 5m mast.  The cable can come out of the mast tube at above 1.5m above ground but that's still far too much.  So that's I2C out of the frame :( 

Serial has been suggested as another way of connecting two Arduinos but the serial lines on the remote Nano are connected to the USB-serial chip.  I can't find information on disconnecting the serial chip so that I cam use the Tx and Rx lines independently of the chip.

I guess I could use a 4-5m USB cable but...

Link to comment
Share on other sites

Looked into doing away with the mast-top Nano and using long wires to the master Arduino but the wind vane direction chip uses SPI which has a very limited range, quoted as a few inches or a foot or two at best, so that's out.  Also, looked further into serial but without line drivers and receivers, that's very limited too.  This is getting silly!!  Maybe out-of-the-box thinking required.

Link to comment
Share on other sites

I guess I could "use a sledgehammer to crack a nut" and use a computer in the observatory and connect both Arduinos by USB then connect to that using TeamViewer but I'm sure there's a better way.

Link to comment
Share on other sites

Yes, one of the things I was thinking.  Now if the Nano could behave as a 1-wire slave...  But I could use a 1-wire device as an interface I think.

Link to comment
Share on other sites

The library emulates a DS18B20 which sends 2 bytes so I can easily encode the data for wind direction and speed.

Edited by Gina
Link to comment
Share on other sites

Actually, the wind data could be sent as just one byte viz. 0-15 wind direction and 0-15 wind speed on Beaufort scale but with two bytes I have the luxury of a whole byte for each or counting as a word of 16bits, I could use 9 bits for wind direction in degrees and 7 bits for wind speed in mph 0-127.

Edited by Gina
Link to comment
Share on other sites

The actual DS18B20 sends 12 bits of data so I shall have to check if the MS 5 bits (used by DS18B20 as sign) can be accessed separately.  If not I'll be limited to 12 bits and may need to do more data processing in the Nano.

Link to comment
Share on other sites

So that's a plan to connect the Nano to the Uno (or Mega is I run out of pins on the Uno) next is to connect from the house.  Two types of comms link, cable or WiFi and I would prefer the latter as one reason for buying the AP was for WiFi in the observatory.  Must check that first.

Edited by Gina
Link to comment
Share on other sites

Been checking on which pins I'm using on the Nano and I find I'm using D2 as interrupt for the anemometer and D3 for one of the direction measuring chip lines.  OneWireArduinoSlave needs an interrupt line and I've used both of them but the direction chip can use different pins for its connections so I just need to change the wiring a bit and the code to match.  I haven't yet added any code to deal with the anemometer so I can move that to D3 and use D2 for the OW-Slave as set in the library.  The anemometer interrupt code should be short as it only has to increment a counter.  The counter would be reset after reading by the OW-Slave read data routine.

I shall need to decide how often to read the wind data and also what to do about wind gust speed.  If the data is read once per second, I think this would cater for gusts but would result in a lot of data.  This is a question of which data to process where.  I could process wind speed in the Nano and sample the data every 10 or 15 seconds.  Also the wind direction could be smoothed in the Nano and the average over 10-15s used as the data sent to the logger.  I don't think short-term wind direction changes are significant.

I think on the whole, I prefer the idea of doing a fair amount of data pre-processing in the Nano - might as well share the load a bit ?  There is little point in sending wind direction with a resolution of a degree over to the logger - 16 or 32 steps after averaging seems much more sensible.  In fact the direction measuring chip returns the angle with a resolution of a tenth of a degree.

Edited by Gina
Link to comment
Share on other sites

If I do pre-processing of the wind data in the Nano, the data would be as follows :-

  • Wind direction - one of 32 directions - 5 bits
  • Wind average speed - Beaufort scale - 4 bits
  • Wind gust speed - Beaufort scale - 4 bits

Total 13 bits.  If I have 16 bits available I could double the wind speed resolution giving 15 bits.  As the wind gust speed is always going to be more than the average I could send the difference rather than the absolute speed - I reckon that would save a data bit or maybe two.  I doubt the wind would be gusting more than 4 points on the Beaufort scale above the average.

Link to comment
Share on other sites

To get the average wind direction I propose sampling the direction each second and adding a count to one of 32 "boxes" then when the data is read, take the box with the most counts as the direction and clear all the boxes.  I might change to 16 boxes depending on how well it all works.

For the wind speed, a sample of the count each second, compute the maximum, read that at the data reading interval then reset.  For average, take the count at the end of the period, ie. when data is read, then reset.  To convert mph to Beaufort I plan to use a table with the maximum of 127 mph (anything over 127 will be limited to 127 - heavens forbid!!).  Though the Beaufort scale maximum of 12 is anything above 72 mph it might be interesting to add a few extra levels and as we are using binary coding the scale could go up to 15.  We have had winds of 80 or 90 mph in the past!

Link to comment
Share on other sites

Taken laptop out to observatory and there's plenty of WiFi signal :)  Hopefully then I should be able to do away with the cable feed.  So I shall want a WiFi adapter or shield for the Arduino.

Link to comment
Share on other sites

Found a WiFi shield but the trouble is, I don't know if it's compatible with the Data Logger Shield. 

ESP8266 ESP-12E UART WIFI Wireless Shield TTL Converter for Arduino UNO R3 Mega

I'm wondering though if I should have the data logger unit indoors, directly plugged into my main desktop machine say.  It seems a bit odd data logging at a remote site.  I have an underground CAT5e cable between house and observatory that I've used in the past for 1-wire.  It's in a 15mm plastic water pipe but I haven't checked it in the last few years and may have been attacked by rats.  I could always lay a new cable though as I have plenty of CAT5e cable.

Link to comment
Share on other sites

Makes good sense. My system comprises 2 RPis;

The outside RPi connects to the 1-wire sensors. It runs an owserver process that the indoor RPi connects to. Connects to household LAN via WiFi. It can be an RPi model B as it is not doing much processing.

The indoor RPi logs readings to the mySQL database. Also runs the web site and other processes e.g. Weather Underground upload. Connected via ethernet to household LAN. This is an RPi 3B+ as it is doing much more work.

  • Like 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.