Jump to content

SkySurveyBanner.jpg.21855908fce40597655603b6c9af720d.jpg

YAAWS (Yet Another Arduino Weather Station)


wimvb

Recommended Posts

Astro darkness is still about half a month away, and I wanted to build a cloud warning system. With the addition of an environmental sensor, this became a simple weather station. It is based on an infrared thermometer and a Bosch environmental sensor:

The cloud warning system measures the sky temperature and the ambient temperature. If the sky is clear, these two temperatures differ (sky cooler than ambient). If they are about the same, the sky is probably clouded.

Nothing original with this probably, other than a creative use of home ventilation parts.

Housing projects of this kind is always somewhat of a challenge. The enclosure must protect the sensors from bugs and dust, but at the same time not shield them too much. I came up with the idea to use home ventilation covers and an aluminium strip to build a well ventilated box. The inside is lined with a course filter.

20190730_204853_res.jpg.a38c9636ce5be2371753f3564e585667.jpg

20190731_193947_res.jpg.c9077ac2fd6155c6a6a23a7436fa4959.jpg

The IR sensor is hot glued to the top of the enclosure.

Both sensors use I2C communication, so they are easy to hook up to an Arduino.

weather_station_bb.thumb.png.ac23fe53a6a23f7f773775328e8be0a8.png
(The IR sensor is the green part, and the environmental sensor is the red part. Note the two resistors that pull SCL and SDA high.)

I also added a 100 nF capaciter across the power wires. The sensors are connected to a piece of perf board that holds the resistors and capacitor.

I just modified the example code from SparkFun for each sensor. At the moment the weather station reports sky temperature, ambient temperature, relative humidity, and air pressure every 10 seconds.

CloudSensorTest.thumb.png.7ae7a725ed03925a42169d214cc74edc.png

(The values marked with red are after blowing into the enclosure for a few seconds. I am aware that the IR sensor and environmental sensor report different ambient temperatures, but the difference is too small to bother me.)

Next step is to make the station talk to INDI. I will probably use an open source protocol for this, so I don't have to write my own INDI driver software.

Edited by wimvb
  • Like 7
Link to comment
Share on other sites

Hooking up to INDI was easy. First I looked at several protocols from commercial weather stations, but none seemed to fit. Fortunately, there is already the Arduino Meteostation (indiduino). I just had to replace a few header files (the original meteostation uses Adafruit components, I use SparkFun), and I also simplified some of the code (sky temperature correction, dew point calculation). Uploaded the firmware and connected the Arduino to my Rock64 sbc. Then started up INDI with the Arduino Meteostation driver and telescope/ccd simulators. That's it. Here's the first result.

295930611_Screenshotat2019-08-0108-50-15.thumb.png.e7585ae632107cc7c56ebf799c8364f1.png

Now I just need to reexamine the firmware code to see if I missed anything, but so far, so good.

  • Like 1
Link to comment
Share on other sites

2 minutes ago, sloz1664 said:

Hi Wim,

Also add a rain sensor to the mix, better safe than sorry. Good project btw :)

Steve

Thanks, Steve. Yes, I plan to add a rain sensor. I just haven't ordered one yet. In the firmware, I will probably replace the irradiance (light) sensor with a rain sensor. The light sensor only reports day/night, which is pretty obvious. Sounding an alarm when it starts to rain is more important.

Link to comment
Share on other sites

11 minutes ago, Gina said:

Thanks for that Wim, when I get round to my weather station that could be very useful.

If you decide to re-engineer your station, you might want to print the enclosure in UV resistant material, if you haven't already. I don't think that the plasic vent covers that I use will last long outside. My experience is that it will hold together as long as it's not disturbed, but the plastic will crack when force is applied (as in unscrewing the lid). Connecting to INDI was easy, and using a standard driver has the advantage that I don't have to compile or install own software or reinstall software after an INDI upgrade. I could have connected the hardware directly to a Raspberry Pi /Rock64 GPIO bus, but I like to keep my hardware layer separate from the INDI server layer. That way, if a home brewn device or its firmware fails, it won't cripple my INDI server or crash an imaging session.

  • Thanks 1
Link to comment
Share on other sites

  • 11 months later...
On 01/08/2019 at 10:04, wimvb said:

Hooking up to INDI was easy. First I looked at several protocols from commercial weather stations, but none seemed to fit. Fortunately, there is already the Arduino Meteostation (indiduino). I just had to replace a few header files (the original meteostation uses Adafruit components, I use SparkFun), and I also simplified some of the code (sky temperature correction, dew point calculation). Uploaded the firmware and connected the Arduino to my Rock64 sbc. Then started up INDI with the Arduino Meteostation driver and telescope/ccd simulators. That's it. Here's the first result.

295930611_Screenshotat2019-08-0108-50-15.thumb.png.e7585ae632107cc7c56ebf799c8364f1.png

Now I just need to reexamine the firmware code to see if I missed anything, but so far, so good.

Hi @wimvb

I've been following this, and the thread of @Gina, with huge interest, so much so that I was even inspired (lockdown project anyone!!) so make a similar weather station. In my case I don't have an observatory so it's not used for automation. At the moment the Arduino is plugged into a Pi housed on my flat roof (with an all-sky cam running over stellarmate and a wired network).

I'd be keen to hear more about exactly how you integrated the Arduino into INDI? Is it as simple as just plugging it in via USB? In which case I could just plug it directly into my imaging rig (which has another Pi/Stellarmate) but I wonder if there's any way to connect the imaging rig profile to the weatherstation over a network connection? (save me moving it!). Spent hours last night googling for ideas but without much sucess.

Any thoughts/ideas?

Cheers!

Link to comment
Share on other sites

11 hours ago, AstroPhil said:

I'd be keen to hear more about exactly how you integrated the Arduino into INDI? Is it as simple as just plugging it in via USB? In which case I could just plug it directly into my imaging rig (which has another Pi/Stellarmate) but I wonder if there's any way to connect the imaging rig profile to the weatherstation over a network connection? (save me moving it!). Spent hours last night googling for ideas but without much sucess.

Any thoughts/ideas?

I haven't got my telescope control computer (Rock64 sbc) hooked up at the moment, so I don't have access to the Ekos profile. The INDI driver that I tested the weather station with is the Weather Watcher. This driver can access a file on the weather station controller (ESP32 in my case), or it can access a web server.

https://indilib.org/weather/weather-watcher.html

I intended to use the indiduino driver/setup for this project, but it seems that it is no longer maintained, and the information is quite sketchy. The Weather Watcher driver turned out to be a better option.

The latest I have tested it with and got to work in Ekos, is to have the ESP32 create a html file that the driver can read. This can be done over wifi. You just give the INDI driver the IP address of the file.

I have more info here:

https://www.indilib.org/forum/general/6099-wifi-weather-station-with-esp32.html

https://www.indilib.org/forum/ekos/6382-weather-watcher-question.html

Hope this helps.

Link to comment
Share on other sites

Hello Wim,

Thanks for the quick and super helpful reply - this sounds great. I agree that the indiduino setup looked rather tricky, I spent a while reading up on it and got nowhere so I'll try the Weather Watcher. The station I came up with uses the Arduino MKR1010 and a Ethernet shield and already posts the data to a simple webserver, so it sounds like it should be easy to port to the INDI. Thanks alot!

P.S. The ESP32 looks interesting... I actually just ordered on to play with as well.

Link to comment
Share on other sites

Here's an update.

First of all, I replaced the Arduino Uno with an ESP32 wifi mcu.

I have also been playing with several versions of firmware for the station. Atm, I have a fancy web page, and no connection to INDI. But it's very easy to change the firmware.

The web server works ok, but after a while the station stops responding. I found out that the web socket methods that are used (microPython), are blocking. This means that if a method doesn't respond, the whole web page / station locks. Now I've added timeouts and very basic error handling to the station, and this seems to solve the problem. If the web page on the client side doesn't get updated, you just have to hit the reload button in your web client.

Here's the section of code that does the trick. It's part of the main.py file.

The time out is set to a generous 10 seconds, and I've also added garbage collection (memory recovery)

----------------------------------------------------

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(10.0)
s.bind(('', 80))
s.listen(5)

while True:
    gc.collect()
    conn, addr = s.accept()
    print('Got a connection from %s' % str(addr))
    try:
        request = conn.recv(1024)
        response = web_page()
        conn.send('HTTP/1.1 200 OK\n')
        conn.send('Content-Type: text/html\n')
        conn.send('Connection: close\n\n')
        conn.sendall(response)
    except OSError as e:
        print('threw an exception')
        conn.close()
    finally:
        conn.close()
    time.sleep(4)

 

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.