Solar E-ink Weather Station
by _nl2299_ in Circuits > Microcontrollers
6941 Views, 68 Favorites, 0 Comments
Solar E-ink Weather Station
Today i show you how i made this weather station with integrated e-ink screen.
Background
Two years ago I build a Wemos D1 based weather station with two DHT22 sensors and the same eink display.
I need it to monitor the temperature of my turtles i keep in the garden :) One sensor measures the outside temperature and the other one measures the temperature in the greenhouse. As this is all working with mqtt so i combined it with tasmota powered sockets to automate heaters or lamps.
Over this 2 years i learned a lot which i want to improve with this build
- DHT sensors are good for learning / education but not for real usage - the humidity measurement is just garbage values are most of the time 99% or the sensors hang.
- if the wifi connection is not possible it trys to reconnect until the battery is empty.
- better connection or external antenna would be nice so no need to use an wifi repeater.
- reduce the boards - it already used a printed pcb but also an charge controller pcb
- better enclosure - old one uses a junction box - as I own a 3d printer now this should be easy to do.
About this build
Main idea based on the fantastic idea from opengreenenergy and his Solar Powered WiFi Weather Station V2.0
Combined with the awesome software from 3kudelta
definitely check out both guys, really appreciate there work!
So this is basically a mix of both mentioned projects and my own ideas.
Features
- measure temperature, humidity and pressure with 2 BME280 sensors ( onboard and external)
- calculate forecast based on the measured data
- battery monitoring
- display both temperatures on an 1,54" b/w e-ink display
- powered by an 0,9W solar panel and an 18650 battery
- send data to mosquito mqtt broker store it in influxDB and visualize it with Grafana (everything is running on RPI docker (IOTstack)
Overall i'm a hobbyist trying to get things done. I'm not a developer or designer. At the end this build is working and serve my needs. So please keep it in mind. Every modification or improvement is welcome.
Step 1: Components
The components i used are almost the same as in the build from opengreenenergy
1x Wemos D1 mini
1x TP 4056 charger
2x BME280 sensors
Headers (male and female) and jumpers
1x screw terminal
1x 100k resistor
1x Waveshare 1,54" b/w e-ink display
1x 18650 battery and holder
PCB (more in PCB section)
optional: 3D printer and PLA filament
4 wire cable (usb extension) to connect external sensor
switch
(optional DHT11 or DHT22 sensors and 2x 10k resistors)
for the backend:
rpi 3 or 4
sd card
power supply
Step2: Sensors
I used 2 bme280 sensors from Bosch. This tiny sensor is just mind-blowing. the actual sensor is only 2x2mm with the breakout board it's easy to wiring it up and connects it via I2C to the port on the PCB.
The first idea was to use 2 DHT22 sensors but as they make always issues in long-term use I go directly for the bme280 which are more precise and reliable - that's why there these S_INT and S_EXT ports and resistors on the board.
How to use 2 bme sensors with the esp ?
I2C is a master-slave bus system. So the master (in our case the esp) requests the slave (bme280) by its address.
So every I2C device needs a different address to communicate properly.
The BME sensors are configured with the default address 0x76 so by default 2 sensors will not work. So we need to change the address. If you take a look at the sensor breakout board you will notice 3 solder pads.
Picture 1: by default pad 1 and pad 2 are internally connected -> results in address 0x76
Picture 2: with a knife, you can scrape the copper trace between pads 1 and 2.
Use a multimeter to prove that it's disconnected.
Picture 3: solder pin 2 and 3 together -> results in address 0x77
Wiring external sensor
i2C is not known to archive long distances. I used a 3m 4 wire cable (eg old USB extension cable) and soldered the sensor on one side and covered it in a printed housing and mounted it into the greenhouse. On the other end I soldered directly to 4 male headers used some shrink tube and connect it to the I2C port on the board.
PCB(I2C port) -> sensor
3v3 -> VCC
GND -> GND
D1 -> SCL
D2 -> SDA
Housing for external sensor
you can find some BME sensor housings on Thingiverse. I quickly design my own which is thicker and more robust. I mounted the sensor with a printed pin. Snap both parts together and we are done.
Other sensors?
Of course, you can use other sensors that are not communicating via I2C as both ports are in use. In the next version, I would definitely include more I2C ports for additional sensors like GY-1145 for UV measurements.
On this board you can theoretically add:
- air quality sensor
- wind speed wind direction and rain meter
- DHT sensors ( the ports S_INT and S_EXT are already prepared on the PCB)
- Light sensor (analog LDR)
All extra sensors can be added on Ports P1,P2, P3,P4
Step3: E Ink Display
I added an E-Ink display to check the temperature locally on the station itself - quick and easy.
E ink displays are super low power consumption. They only need power to refresh the display. In our case, that's only every 10 minutes. The rest of the time it uses no power from the battery. It features a good contrast to read it under direct sunlight.
The one I used is a 1.54" b/w display with a resolution of 200x200 pixels. It's the same one from my first station.
It seems that it has been replaced by a newer revision The new one has a rev. the number at the right corner.
So in case you have the new one, you need to change the display type in the code.
You can easily slide it in the front part. I added a small piece of transparent plastic to secure the display from rain.
Everything holds in place with some double-sided tape.
The Brain
This project uses a D1 mini pro, an ESP-8266EX based microcontroller with 16MB of flash, and an external antenna connector. Its a clone of the original lollin wemos d1 mini. The best option in size and usable Pins.
They are cheap and it pays out to buy a pack of them.
These boards features a ceramic antenna or an external antenna connector. To use the antenna you need to change the 0 Ohm resistor. Check with a multimeter if the connection is possible.
Powering
The following components are used to power the system
120x60mm solar Panel with 6V and 150mA
TP4056 charger handle the battery charging
18650 battery with 3500mA
Battery voltage is measured with a voltage divider network. If the battery is below 3,3v the esp gets into sleep mode. The esp features an build-in resistor of 220k so you need to add a 100k resistor on PCB "R3" location.
As the esp is going to deep sleep between the measurements (every 15 minutes) the battery should last over 50 days without an solar panel connected. So with the panel it should be charged enough trough the day even on cloudy days.
I added a screw terminal to the pcb to connect the solar panel. Do a misalligment you are not able to access the usb port of the charger module to recharge the battery with a power adapter.
PCB
I used a custom PCB to make a clean buildup which should last forever. And even for long-term applications, I'm a fan of printed PCB's instead of perf board. Here can you find the Gerber files for ordering. I can really recommend JLCPCB.
The PCB contain the following parts
Screw terminal - connect solar panel
TP4056 module - handles charging
battery holder for 18650 cell
the Wemos D1 mini
Jumper JP2 - to enable / disable deep sleep
Jumper JP1 - not used but need to be connected (design mistake)
Port E-INK for the display
Port S_INT and S_EXT + resistors (R1+R2) for optional DHT sensors
U4 Port for onboard BME280
I2C Port for external BME280 & Ports P1; P2;P3; P6 for optional sensors
Switch to turn on/off the esp. I just soldered in a header and connect a jumper to close it.
After this finished build i would not use this design again. I definitely would redesign it.
In the next version, I would remove the DHT sensor Ports and add much more I2C Ports.
Also, rearrange the components to make life easier (flash while connected, charge via usb...).
But anyways I publish this version because I know it's working.
Housing
The best housing for a weather station would be an Stevenson screen. Like this one. I decided to not use them because it takes so many hours for printing and consumes a lot of filament. Even it is not ideal for housing a display. So I decide to go with the housing from open green energy as an inspiration.
I build it up from the ground in shapr3d.
Features
- fit an 120x60mm solar panel with screw terminals
- Thick wall between solar panel and the PCB to absorbing the heat.
- extra Plate with printed bolts for the PCB its only lay it in without extra mounting directly to the case
- ventilation holes on the side and front and bottom
- outlet for external sensor
- 2 part front door with display mount and quick access.
- printed with withe PLA to not heat up unnecessary. (recommend PETG for better heat resistance
Print settings
printer: Artillery sidewinder X1
slicer: pursa slicer
filament: GEEETECH PLA 1.75mm white
print speed: 90 mm/s
extruder temp: 200°C bed: 60°C
infill: 15%
print time: 10h for case 1,5h for front door
files:
case.stl - main housing
front.stl - front door 2 parts
pcb_mount.stl separate plate to mount the pcb on it.
pcb_pins.stl 3 pins to mount the pcb and the bme sensor
sensor_housing.stl - case for me sensor
The Code
As explained in the introduction I used the code provided by U3Kdelta and modified it for my own needs.
you can download it HERE
basic function (simplified)
Every 15 minutes the esp awakes from the deep sleep
check battery -> still over 3,3V?
connecting to wifi -> MQTT broker
initializing sensors
measure temp, hum, pressure from internal sensor
calculate dewpoint, trend, forecast int sensor
measure temp, hum from external sensor
calculate dewpoint for better accuracy (ext sensor)
draw GUI for degree character and arrows ( in and out sign)
print temp int and ext on display
print time in right bottom corner to know when it was last refreshed
publish everything to MQTT topics
go to sleep
Modify the settings
in the sketch settings.h file you can find all relevant settings
Wifi SSID and PW
MQTT broker IP user and password
language (for forecast) and NTP server settings
if you want to modify the MQTT topics you can do this in the sketch itself.
Backend
As I decided to host everything on my own and not using cloud services (Blynk, thingspeak) a bunch of services needs to run in the background.
services I used
-> Mosquitto mqtt (broker handles all messages )
-> telegraf a collector for all kinds of metrics also support mqtt (connector broker -> database)
-> Influx DB stores all the data
-> Grafana visualize everything -> Download Dashboard
How the backend part works
- the station publish the topics (temp1,humi1,...) to the broker (mosquitto)
- telegraf connects (subscribes) to the defined topics of the broker and sends it to influx DB
- influx DB stores all values (time-based) and is the data source for Grafana to build a dashboard to visualize everything.
Installing all these services on a pc that runs 24/7 takes a lot of time, can cause errors and drive your energy costs high :)
There is where the Raspberry comes in, together with Docker, you can actually search for the "IOT Stack" project it's an easy way to install everything. The big advantage of docker containers
- they do not interfere each other
- did not affect any changes on the host os
- easy / fast setup ( docker-compose)
- easy setup / restore just run the docker-compose up command to download all images from the repository and mount your data folder
- small backup - all relevant data like DB and config files are stored in the /volumes mount so you only need to backup this part
This setup is cheap, easy, and consumes less than 20€ of energy per year. And also the pi is powerful enough to run almost 10 containers.
Conclusion & Future Updates
If you all done correctly your weather station should be working.
I hope my guide helps you with realizing parts of the project or even the whole build.
There are a lot of possibilities and features to implement.
Even I'm no developer designer, I'm just a hobbyist trying to bring everything to life.
Possible improvements
- restructure PCB (more I2C Ports, remove DHT sensors)
- more Infos on the display (e.g. forecast text or weather icons, battery level, humidity...)
- if you want to to use a Sparkfun Weather Meter check out Solar Powered WiFi Weather Station V3.0 with RJ11 connectors and advanced esd protection.