Solar Powered Weather Station

Software

The code and 3D models can be downloaded from github: WeatherStation

The code is Arduino based. There are two projects. One for the actual solar weather station which will be outside and one for a small battery powered humidity sensor for the bathroom (which will be ignored here).

The Arduino IDE has to have the ESP8266 board support installed. For the two projects the following libraries are needed:

  • DHT sensor library by Adafruit
  • Adafruit BMP086 library
  • Adafruit MQTT library

Node-RED Flow

This is the current Node-RED flow for the prototypes:

[{"id":"a6e66e24.246eb","type":"ui_chart","z":"83b78c60.0bd6f","name":"Temperature Chart","group":"c467b276.39485","order":2,"width":"4","height":"3","label":"","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"-10","ymax":"40","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":921.1670455932617,"y":275.333553314209,"wires":[[],[]]},{"id":"56590d76.972014","type":"mqtt in","z":"83b78c60.0bd6f","name":"","topic":"weatherStation/temperature","qos":"1","broker":"171132c7.ece67d","x":419.1669006347656,"y":239.00030136108398,"wires":[["a6e66e24.246eb","4e7da728.df7028","f62c1c11.ee6cb"]]},{"id":"aa8c644f.d09798","type":"mqtt in","z":"83b78c60.0bd6f","name":"","topic":"weatherStation/humidity","qos":"1","broker":"171132c7.ece67d","x":411.00018310546875,"y":149.0001983642578,"wires":[["af9c7600.6c5cf8","f62c1c11.ee6cb"]]},{"id":"f2c9049d.343428","type":"ui_chart","z":"83b78c60.0bd6f","name":"Humidity Chart","group":"c467b276.39485","order":4,"width":"4","height":"3","label":"","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":912.0002098083496,"y":182.00018405914307,"wires":[[],[]]},{"id":"af9c7600.6c5cf8","type":"smooth","z":"83b78c60.0bd6f","name":"","action":"mean","count":"100","round":"","mult":"single","x":657.1667861938477,"y":149.00007438659668,"wires":[["f2c9049d.343428","ab3492b0.fa195"]]},{"id":"175b6880.a5b6c8","type":"mqtt in","z":"83b78c60.0bd6f","name":"","topic":"weatherStation/voltage","qos":"1","broker":"171132c7.ece67d","x":394.0003128051758,"y":608.0003957748413,"wires":[["fae0350f.a5f1c8"]]},{"id":"6ffbf102.708af","type":"mqtt in","z":"83b78c60.0bd6f","name":"","topic":"weatherStation/pressure","qos":"1","broker":"171132c7.ece67d","x":410.0001525878906,"y":338.00010204315186,"wires":[["494cb1a9.47f47"]]},{"id":"494cb1a9.47f47","type":"function","z":"83b78c60.0bd6f","name":"pascal to hecto","func":"msg.payload *= 0.01;\nreturn msg;","outputs":1,"noerr":0,"x":673.166877746582,"y":339.66680812835693,"wires":[["31d0bf64.cd69a","f62c1c11.ee6cb"]]},{"id":"ab3492b0.fa195","type":"ui_gauge","z":"83b78c60.0bd6f","name":"","group":"c467b276.39485","order":3,"width":"2","height":"3","gtype":"wave","title":"Humidity","label":"%","format":"{{value|number:1}}","min":0,"max":"100","colors":["#5a5a5a","#34b92d","#0202ff"],"seg1":"","seg2":"","x":889.1668815612793,"y":132.0001096725464,"wires":[]},{"id":"4e7da728.df7028","type":"ui_gauge","z":"83b78c60.0bd6f","name":"","group":"c467b276.39485","order":1,"width":"2","height":"3","gtype":"gage","title":"Temperature","label":"°C","format":"{{value|number:1}}","min":"-20","max":"50","colors":["#0000ff","#e6e600","#ca3838"],"seg1":"0","seg2":"30","x":901.1668891906738,"y":230.0001163482666,"wires":[]},{"id":"31d0bf64.cd69a","type":"ui_gauge","z":"83b78c60.0bd6f","name":"","group":"c467b276.39485","order":7,"width":"2","height":"3","gtype":"gage","title":"Pressure","label":"hPa","format":"{{value|number:2}}","min":"900","max":"1100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":895.1668815612793,"y":340.00018310546875,"wires":[]},{"id":"442a7dcc.09d934","type":"mqtt in","z":"83b78c60.0bd6f","name":"","topic":"weatherStation/light","qos":"1","broker":"171132c7.ece67d","x":390.0001449584961,"y":420.0001468658447,"wires":[["dff18ee1.f7d5d","f62c1c11.ee6cb","c93b1e3a.d4f99"]]},{"id":"dff18ee1.f7d5d","type":"ui_gauge","z":"83b78c60.0bd6f","name":"","group":"c467b276.39485","order":5,"width":"2","height":"3","gtype":"gage","title":"Light","label":"","format":"{{value|number:2}}","min":"0","max":"1","colors":["#000080","#c0c0c0","#ffff80"],"seg1":"","seg2":"","x":886.0003776550293,"y":406.000186920166,"wires":[]},{"id":"e1dc9a15.31a108","type":"function","z":"83b78c60.0bd6f","name":"state to finished html icon","func":"\nvar moon = \"&#127769;\";\nvar rain = \"&#127783;\";\nvar sun = \"&#127774\";\nvar cloud = \"&#9925;\";\n\ncontext.humidity = context.humidity || 50;\ncontext.light = context.light || 0.5;\ncontext.pressure = context.pressure || 1000;\n\nif(msg.topic === 'humidity' && msg.payload != 'nan')\n context.humidity = msg.payload;\nif(msg.topic === 'light' && msg.payload != 'nan')\n context.light = msg.payload;\nif(msg.topic === 'pressure' && msg.payload != 'nan')\n context.pressure = msg.payload;\n\nif(context.humidity < 50)\n{\n if(context.light > 0.1)\n msg.payload = sun;\n else\n msg.payload = moon;\n}\nelse \nif(context.humidity < 80)\n{\n //if(context.light > 0.1)\n msg.payload = cloud;\n //else\n // msg.payload = moon;\n}\nelse\n{\n msg.payload = rain;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":960.0000610351562,"y":537.0000295639038,"wires":[["85c7cf27.1e66e"]]},{"id":"f62c1c11.ee6cb","type":"change","z":"83b78c60.0bd6f","name":"translate topic","rules":[{"t":"change","p":"topic","pt":"msg","from":"weatherStation/humidity","fromt":"str","to":"humidity","tot":"str"},{"t":"change","p":"topic","pt":"msg","from":"weatherStation/temperature","fromt":"str","to":"temperature","tot":"str"},{"t":"change","p":"topic","pt":"msg","from":"weatherStation/light","fromt":"str","to":"light","tot":"str"},{"t":"change","p":"topic","pt":"msg","from":"weatherStation/pressure","fromt":"str","to":"pressure","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":720.0000457763672,"y":534.0000305175781,"wires":[["e1dc9a15.31a108"]]},{"id":"85c7cf27.1e66e","type":"ui_template","z":"83b78c60.0bd6f","group":"c467b276.39485","name":"Weather symbol","order":8,"width":"3","height":"3","format":"<div ng-bind-html=\"msg.payload\" style=\"font-size: 50pt\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1218.000072479248,"y":535.0000290870667,"wires":[[]]},{"id":"c93b1e3a.d4f99","type":"ui_chart","z":"83b78c60.0bd6f","name":"Light Chart","group":"c467b276.39485","order":6,"width":"4","height":"3","label":"","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"1","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":900.0001449584961,"y":464.00006771087646,"wires":[[],[]]},{"id":"fae0350f.a5f1c8","type":"function","z":"83b78c60.0bd6f","name":"scale","func":"msg.payload *= 3.304 / 2788;\nreturn msg;","outputs":1,"noerr":0,"x":672.0000381469727,"y":612.000036239624,"wires":[["1112abd4.01dd04"]]},{"id":"1112abd4.01dd04","type":"debug","z":"83b78c60.0bd6f","name":"","active":false,"console":"false","complete":"false","x":921.1669006347656,"y":612.0000350475311,"wires":[]},{"id":"c467b276.39485","type":"ui_group","z":"","name":"Outside","tab":"7894fc0d.fc8084","order":1,"disp":true,"width":"7"},{"id":"171132c7.ece67d","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"7894fc0d.fc8084","type":"ui_tab","z":"","name":"Climate","icon":"dashboard","order":1}] 

Hardware

As hardware WeMos D1 mini microcontroller is used with some shields and one photoresistor. To enable wake-up for the deep sleep pin D0 and RST are connected. The weather station is powered by a LiFePO4 battery with a nominal voltage of 3.2 connected to the 3.3V pin. This set up does not need any regulation and can be very energy efficient.
The battery, WeMos (and the sensors) are also connected to a charging circuit that converts possible 5V form the solar cells to the needed 3.6V charging voltage of the battery.

The solar charging circuit is built like this:

WeMos microcontroller:
http://s.click.aliexpress.com/e/jUfAmUF
http://ebay.to/2skrCE1
http://amzn.to/2saaoKL

Photoresistors:
http://s.click.aliexpress.com/e/IUJYVrN

DHT11 Shield:
http://s.click.aliexpress.com/e/33J6QR3

DHT22 Shield:
http://s.click.aliexpress.com/e/bUJAYRj

LiFePo4 18650:
http://s.click.aliexpress.com/e/mAAMnIy

LiFePo4 AA:
http://s.click.aliexpress.com/e/6uR7Aa2

Solar cells:
http://s.click.aliexpress.com/e/MbEAEiY

XT30 Connectors:
http://s.click.aliexpress.com/e/JybIeYN

These links support my work at no additional cost to you. They are just a reference so you can find the right parts.

3d Files

The 3D files are also found in the github repository

Inset

Solar holder

More?

Please ask if you are missing some infos…