Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

INDI mini cloud/weather monitor


wimvb

Recommended Posts

I recently posted my design for a weather station in this section.

https://stargazerslounge.com/topic/345153-indi-weather-station/

As I had bought several pressure/humidity sensors, as well as ir temperature sensors and ESP32 development boards, I wondered how small a weather monitor could get. The sensors are quite small, and so is the micro controller. Such a weather monitor wouldn't incorporate wind speed measurement nor a rain detector, since these take up more space. But otoh, there is seldom rain without clouds, so if you detect clouds, you should be safe.

Here it is, a miniature (9.8 x 5.9 x 2.7 cm) weather monitor. The device has built in wifi, is powered from a micro usb contact and is compatible with the INDI Weather Watcher driver.

The parts:

minimeteo_parts.jpg.4cd16e46a6bd7da48e8176510ed2fb3e.jpg

(the mat underneath has a 1 inch grid pattern)

BOM:

  • plastic box 9.8 x 5.8 x 2.7 cm
  • a piece of V-board, in my case with copper islands rather than strips
  • ESP32 development board with male headers
  • MLX90614 ir temperature sensor with I2C interface
  • BME280 environmental sensor with I2C interface
  • micro usb cable and power adapter, or a powerbank for wireless operation

Assembly is really easy and involves drilling a hole in the box, soldering the components in place and wiring to the ESP.

The finished monitor in place. As this is a box with a click lid, I used silicone to seal it. The holes on the sides and bottom are drilled at an angle to keep rain out.

minimeteo2.jpg.7ddba02051326b3823e1524c13b0bf03.jpg

As I built it, the electronics will heat the BME slightly, and because it is mounted inside the casing, it will be slow to reach ambient temperature should this change abruptly. Adding more holes near the ESP would take the inside temperature down. Otoh, temperature readings don't have to be that accurate, and you could use the MLX ambient reading for more accuracy.

Here's the INDI control panel for the weather monitor

489696119_Skrmklipp2020-02-0116_23_16.thumb.png.76a2da5d326cf916d48dc46285aa203f.png

(Wind and rain are simulated, because I was testing the driver when I took the screen shot)

Here is how it looks in Ekos scheduler. The red marker indicates that weather conditions are bad. In this case clouds = 100 %. If the tickbox next to "Weather" is checked, Ekos will allow weather conditions to control an imaging sequence.

1518201676_Skrmklipp2020-02-0116_23_36.thumb.png.1ade5cf3862a9a46691d0c3ad9957d0f.png

And in the ROR driver

393368686_Skrmklipp2020-02-0116_24_49.thumb.png.79bf5b4dbe0b5c671cd3c6d29bf1151c.png

(I know it says Dome, but the ROR driver is derived from the dome driver, and it's still under development. Besides, this is the simulator driver.)

The code for the esp is on my github page:

https://github.com/wberlo/indi_meteostation

You need the files:

  • bme280.py
  • mlx90614.py
  • boot.py (replace the ssid and password with your own, or comment/uncomment lines to create an access point)
  • main_mini.py (which you will have to rename to main.py before uploading to the esp board)

 

  • Like 3
Link to comment
Share on other sites

I figured out that if it's only temperature and clouds you want to monitor, just having the mlx sensor will do. The mlx also senses ambient temperature. No need for the bme. But if you want dew control, you'll need it. 

Link to comment
Share on other sites

21 minutes ago, Gina said:

Great Wim - just what I would like to do after getting my dual imaging sorted out.

This should be easy for you, Gina. You can print your own enclosure. If I had that possibility, I'd probably shield off the esp from the sensors, to prevent heat transfer, have ventilation for the esp, and improve air flow around the bme. But nothing too fancy, this is supposed to be simple. Probably more holes, but not larger. You don't want to make it a spider hotel.

It's possible to put the esp in sleep mode to keep it cool, but that will turn off wifi, and disrupt communication with Ekos.

  • Like 1
Link to comment
Share on other sites

Probably. The sensors are simple i2c types, not at all difficult to set up. The ESP32 is an intruiging little device. Much smaller, cheaper, more powerful than an Arduino (not smaller than a Nano). It has built in Wifi AND bluetooth. I like my hardware controllers to be separated from software controlling the imaging rig. If anything goes wrong with the hardware, at least I know that it won't jeopardise an imaging session. The ESP32 also has 3 native UART ports/channels of which only one is used for USB. I plan to connect my just-received wind speed meter to that. This device uses RS485 and modbus. Always more to learn ...

  • Like 1
Link to comment
Share on other sites

I had left the cloud monitor outside in the rain last night. Some time during the night, Ekos had lost contact, and I also couldn't see it in the web browser. But it did show up in the connected devices list of my router. The esp I used is a cheap Chinese knock off unbranded model (2 for the price of one). The original Espressif that I use in my sqm seems much more stable. More stability testing needed. 

  • Like 1
Link to comment
Share on other sites

Vcc of the sensors is connected to 3.3V on the esp board, Gnd can of course be connected to any one of the ground pins, easiest is the pin directly next to 3.3V

I2C pins are: SCL is pin D5 and SDA is pin D4. Both these pins are on the same side of the board as 3.3V Since distances are short, these pins can be directly connected to the corresponding pins on the BME board and the MLX board. These pins are marked with SCL, SDA, Vcc and Gnd. There's no need for extra resistors or capacitors as the distance to the esp board is only a few inches. I connected the MLX board with short leads, because this device needs to be glued in a hole in the enclosure. The BME board can be soldered onto the V-board (strip board). The layout was very much like the picture I posted in my original post, with the BME just above the esp, and the MLX connected with leads. 

I sealed the enclosure with silicone, otherwise I could have opened it and taken a picture. But maybe this helps.

IMG_20200204_004821.thumb.jpg.a4520d4c40fada799879f93a563959a4.jpg

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

@ninosr:

I use Thonny ide.

https://thonny.org/

Also have a look here 

https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/

I have the impression that it gives me more streamlined code than the arduino ide, but I could be wrong of course. Anyway, the ide is simple and easy to use. Rather than uploading files, you save them as if the esp were a storage device. For the meteo station, I can even have icon image files uploaded. But you do need to first burn firmware to the esp. It's all in the tutorial (2nd link). 

Edited by wimvb
Link to comment
Share on other sites

  • 1 year later...

Hi Wim,

i have a problem, uploading your files on the ESP32 - Board.
I prepared the ESP32 with uPyCraft V1.1 and the firmware for micropython.
Then, i opend Thonny and connect to the device. He show me the "boot.py" - file on the device.
After this step, i make a right click on the "BME280.py", the "mlx90614.py" and the "main.py" and upload it to the device.
But, if i want to upload your "boot.py" - file, the controler don't react.

When i start uPyCraft again and connect to the controler, he want to install the firmware for micropython again.

I haven't any idea to fix the problem... .

I know only the Arduino IDE for programing.

Thanks a lot !

Best regards

André
 

 

Link to comment
Share on other sites

I answered to the github address, but copy here.

Hi,

I’m not at my computer right now, and won’t have access to an ESP32 for the next few days. So I can’t test right now. A few suggestions though.

Have you tried uploading other code to the esp to verify that uploading works?

When I reinstall the esp firmware, I always use the command line tool, esptool. I have used uPyCraft for a while, but then switched to Thonny and the command line tool. (Can’t really recall what made me switch.) Nevertheless, once you have the firmware installed, upload code and verify that the esp works. As soon as I’m back at my computer, I can do some tests.

 

Good luck,

 

Wim

Edited by wimvb
Link to comment
Share on other sites

Hi Wim,

i tried to install the micropython - firmware with uPyCraft and with "flash downlaod tool".
Then upload your files. Both ways have the same errors like before.

Tried also an other ESP32 Module (ESP32 Mini D1 - Boards). The same.

So i flash the mp - firmware on the ESP. I take uPyCraft for this step.
After the flash, the device have the "boot.py" as a part of the system - files on board.

I upload the "blink.py" from the examples. I load the file up to the microcontroller.
The i run the file and blue led is blinking.

But your code doesn't work.


That's all very strange...

Best regards and thank you for your support...

André

Edited by Stargazer32584
Link to comment
Share on other sites

Ok, now I tested my setup

I took a clean ESP32 device and erased its flash from the command line:

  esptool.py --chip esp32 --port COM4 erase_flash

worked ok

installed a stable firmware version from the command line

  esptool.py --chip esp32 --port COM4 write_flash -z 0x1000 esp32-idf4-20210202-v1.14.bin

Then I opened Thonny and connected to the device. There was already a boot.py file on it which I deleted.

Uploaded mlx90614.py to the device by saving "Save As ..."

192956910_Skrmklipp2021-08-1000_15_13.thumb.png.054915042525dc44b70f34a13d8453f5.png

Notice the text highlighted in blue. When ever this showed, the file that I was about to save wouldn't save properly. I clicked the red STOP button until I got the REPL prompt back. When I hit Save As ... again, the save dialog would show which files were already on the device, and saving worked.

If the File Save dialog doesn't show which files are on the device, the save will fail. Hit the red STOP button to get back to the REPL prompt.

I don't know why this is. My guess is that the ESP32 USB interface is not stable. All four files are now on the device. The "Main.py" file is the main-mini.py file on GitHub.

I can't test if everything works, since I don't have any sensors connected to this ESP32.

I hope this solves your issue.

 

Cheers,

Link to comment
Share on other sites

Hi Wim, I replaced the guts of my old davis station with an esp8266-12,  the wind speed sensor just provides a digital counter input on pin 14 and the direction sensor comes in via Adc0. 

Using the bme280 means the expensive mlx part is not used. 

Added a hygreon rain counter on another digital pin and it drives the ascom observing conditions monitor in node red. 

It's a neat and tidy solution using the esp. 

Edited by skybadger
So, names
  • Like 2
Link to comment
Share on other sites

Hi Wim,

thank you for testing it !

I take the binary from your screenshot for the Firmware of the esp32, the esp32-idf4-20210202-v1.14.bin.
Make the fileupload with thonny. Now, it seems to be easier than before. Now, he make the connection to the wifi-network
and give me the whole adress of the controller.

But if i go to the adress with the browser, there is no index.html. I uploaded the index.html to the controller. Is this right ?

The worlds between the Arduino IDE and micropython are greater that i thought.

Thanks a lot..

 

André
 

Link to comment
Share on other sites

You will need to load the index.html file if you use the regular version. For the mini version, you don't need this file. But on the esp32, this file must be named main.py. You will also need to set your network name and passphrase in the boot.py file of course.

Link to comment
Share on other sites

Quote

You will need to load the index.html file if you use the regular version. For the mini version, you don't need this file. But on the esp32, this file must be named main.py. You will also need to set your network name and passphrase in the boot.py file of course.

Yes, everything is done with the boot.py. There are the parameters of our network signed in.
Tomorrow, i will test it with the sensors.

Thank you and after the test, i will report the result here.

André

Edited by Stargazer32584
Link to comment
Share on other sites

Hi,

in the evening, i had the chance to test it with the both sensors.
With the following result:
 

('192.168.178.122', '255.255.255.0', '192.168.178.1', '192.168.178.1')
Warning: I2C(-1, ...) is deprecated, use SoftI2C(...) instead
Traceback (most recent call last):
  File "main.py", line 68, in <module>
  File "main.py", line 36, in DewPoint
ValueError: math domain error
MicroPython v1.14 on 2021-02-02; ESP32 module with ESP32
Type "help()" for more information.

Can i ignore the warning ?

And a problem with the calculation of the dewpoint.

Best regards

André

 

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