Greenhouse Climate Monitor
A year or so ago I had an idea to build a solar-powered IP camera that I could mount on a bird table or feeder so my kids could get a close up view of the birds in our garden. For reasons I'll cover later that didn't happen, but the kit was re-purposed in to a greenhouse climate monitor that:
- Wakes up once an hour to take readings
- Takes a photograph of the plants
- Records the temperature
- Records the humidity
- Posts the photo and data to a website
- Makes the photos and data visible on a website
To keep the size of the solar panel 'reasonable' I had to look at low power solutions,
which immediately ruled out the (relatively) power-hungry Raspberry Pi. Otherwise a Pi, with its excellent camera module, would have been perfect.
I already had experience with ESP wi-fi enabled microcontrollers, especially the Wemos development boards. These boards are low power, and support 'deep sleep' modes for even lower power consumption while idling. I picked up a (retired) LOLIN32 board that's based on the ESP32. It has plenty of IO pins, and includes a battery charging circuit (more on that later).
To take photos I used the OV7670 camera module, a low power CMOS image sensor that others had already integrated with Arduino style boards, so I was fairly confident it would work. It's fairly basic, configured via I2C but requires a clock signal from the board, monitoring of horizontal, vertical and pixel sync signals and reconstruction of the pixel data from the 8 bit data bus. It also has a 'powerdown' function that can be hooked in to the LOLIN32's deep sleep to reduce power consumption further.
The camera is quite low resolution, and the runtime memory available on the LOLIN32 (to hold the bitmap) is quite restrictive.
It's not the best quality image, especially with movement, and the LOLIN32 isn't capable of streaming video at any framerate.
For these reasons, the bird watching idea stalled. But a low quality image of the stationary greenhouse is fine.
Here's an example of the images I'm able to get with the OV7670 LOLIN32 combination.
I wanted the project to run independently, without the need to recharge batteries, etc. Phone charger solar panels are available cheaply, outputting 5v via USB, perfectly compatible with the LOLIN32 board. To continue monitoring overmight and handle the odd overcast day (this is Scotland) I included a 900mAh battery, making use of the integrated charging circuit to store excess power from the solar panel (when it's available) for use later.
To capture temperature and humidity I picked up a DHT22 sensor.
It's slightly more expensive than the DHT11, but the temperature range of the DHT11 isn't
enough for Scotland's climate! Adafruit also provide a handy Arduino package to interact with the sensor.
It's the white box attached to the right-side of the project box in the image below.
I put it all together in a little project box and it now looks like this.
What's hidden from view is the wiring mess! And this isn't even finished...
The photograph and data is posted to my website and stored in a database. A simple dashboard displays the latest photograph, temperature and humidity
as well as the last 48 hours of temperature and humidity data graphed using Google's Visualization API.
If you're interested in what's been going on in my greenhouse, you can view the dashboard here: https://andy.lamb.scot/weather/data