Solar Weather Station [WiFi, MQTT, Smart Home, ESP8266]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi in this episode we will create the hardware for our solar-powered weather station measuring temperature humidity air pressure and light the weather station will be placed outdoors and use Wi-Fi to publish the sensor readings to our MQTT broker node-red will process the data and display conveniently on all devices I decided to stick to the women's micro controller since it's really cheap and provides great amount of accessories these are the components we need in addition to the micro controller a bmp180 shield mainly for air pressure and precise temperature a dht22 shield for humidity for light measurement we need a photo resistor and a 3.3 kilo ohms resistor as power buffer we taken 18 650 lithium ion phosphate battery and a battery case an lm317 voltage regulator a 3.3 K ohms resistor a 10k ohms potentiometer and the Schottky diode to regulate the solar power we need also some connectors of your choice for the convenience from 5 volt solar cells a PVC pipe with a cap as case and the brick as always you will find the link in the description to the project page containing some details the code that really files the flows and links to some parts let's start it's sufficient to stack all the shoes together at least as a first test if they ESP runs permanently it's heating up so it's rather recommended to stack the shield side-by-side to get a precise temperature reading the bmp180 is very battery friendly it consumes less than a micro amp while it's not used not much more to do there initially I started with the more common dht11 shield but looking at the specs I found that the minimum supply voltage should be 4 volts but it's powered from the 3.3 volt rail on the shield this could explain the discrepancy in sensor readings I got in the past testing the power consumption it's also draining the battery all the time with a base current of 50 micro amps so I decided to check out a dht22 module it cost just at all more but it's higher precision works with 3.3 volts and consumes only 5 micro amps on standby the photoresistor is optional since the esp8266 has only one analog input we can either measure the brightness or the battery voltage we could run it monitoring the battery voltage until we are sure the system is sustainable and switch to the photoresistor later if we like the photoresistor setup is easy the analog input takes the voltage between 0 & 1 volt just like in a smart washing machine video we set up a voltage divider such that we get meaningful readings 3.3 kilo ohms works for me the resistor is connected between ground and the analog input and the photo resistor is connected between VCC and the analog input let's take a look at our power consumption we like to balance between the frequency of the sensor updates and the size of the batteries and the solar panel while running the setup consumes around 75 milli amps the Wi-Fi is quite power-hungry and updating the values each segment is an overkill since the weather doesn't change so often a good possibility to save some power is to use the deep sleep capabilities of the ESB it consists of a real-time clock which can wake it up again while in deep sleep we can disable the Wi-Fi with only the real-time clock running we still consume around 280 micro amps to use the deep sleep without the real-time clock we would need some kind of external set-up that triggers the reset to wake the ESP up again just like we did in a smoke detector tutorial the real-time clock is not hardwired to the reset so we need to add an connection between pin d0 which is GPIO 16 and the reset pin now to the power supply the lithium ion phosphate battery is a good choice since its nominal voltage is close to 3.3 volts and we like to connect it directly to the 3.3 volt rail any power regulation in between means a power loss lithium ion phosphate are also very robust which is good since we also like to use it in a harsh environment the solar cells I have here are rated to 5 volts I have tested what currents we get outside during October in Central Europe at different weathers changing the load we can see what current to expect at what voltage two o'clock direct Sun around 50 milliamps just after sunset around 450 micro amps overcast and rain around 5 milliamps while monitoring the power consumption the device needs around 7.5 seconds to start up connect the Wi-Fi and to publish the sensor values this consumes around seventy five milliamps while it's sleeping it consumes 280 micro amps let's say we want to let it publish every minute this will consume eight point six milliamps on average this is also the current we need to harvest from the Sun let's assume the battery has an actual capacity of one thousand milliamps let's check how long it can last when we get no Sun at all five days but do we really need an update every minute I guess every five minutes could also be sufficient average consumption will be two point one milli amps much better let's assume we get the worst case eight hours of rainy weather every day this will result in an average of 1 point 6 milliamps per cell I decided to use two cells in parallel setting the update rate to 5 minutes will be on the safe side this way now we need to regulate the input power I tried a few things the only thing working at few milliamps input was the lm317 we can regulate down the solar cell voltage to the charging voltage of around 3 point 6 volts of the battery I'm not sure if it's ok to top off the battery all the time if you are more experienced posted in the comments but I will give it a try and share my experience there still is a slight problem of backward current to the regulator if there is no input power this can be solved using a diode but diodes have a voltage drop depending on the curve the higher the current the higher the drop so there is a trade-off between fully charging or risking an overcharge at low currents I picked a Schottky diode with a small forward voltage to keep the variation in low and adjusted to three point six volts at minimal load on the microcontroller this is the charging circuit 3.3 K ohms between adjust and the output pin potentiometer between adjust and ground and a diode at the output quite simple let's put everything together I decided to separate the sensors from the microcontroller for the BMP we need to wire d1 d2 3.3 volts and ground the DHT is usually connected to d4 but this is also the LED pin so I connected to d5 to not waste power on the LED then we also need 3.3 volts and ground for the photo resistor we wrapped the voltage divider in heat-shrink and give it along a wire to mount it outside on the compartment [Music] the rain proof case we can simply use a PVC pipe from the hardware store just jam everything in or take the insert I designed and 3d printed [Music] the mesh will provide enough air to measure the temperature and humidity correctly but will prevent birds from creating a nest here these walls will protect the other parts from corrosion a bit more we could also cover everything in hot glue except for the sensors but I still might want to tweak it so I leave it as it is for now we shorten the pipe taper the open end and put everything in such that the cables of the photoresistor and the solar cells are leaving the pipe the open end I also designed a socket for the solar cells but 3d printing is not essential here duct tape and a stick would also do we can use cable ties to fix it to the brick which will prevent the winds to take it I put the solar on my lab mount the station in a shadowy corner and connect everything there is not much happening in the code of the microcontroller I've used the Arduino IDE this time with the esp8266 board extension and some libraries you can find all the details on the project page link below the code basically connects to Wi-Fi connects to the MQTT broker and publishes the sensor readings after that it turns off the Wi-Fi and goes into deep sleep all the parameters can be set at the top of the file let's check if it's doing anything it seems to work the user interface on my phone is provided by note red which we set up last episode the node red flow receives the published values from the MQTT broker and fits the gauges and charts you can explore my flows those can also be found on the project page that's it for this episode if you liked it please share and subscribe to not miss what's coming next see you next time bye [Music]
Info
Channel: bitluni
Views: 184,561
Rating: undefined out of 5
Keywords: smart home, weather, air pressure, diy, esp8266, esp32, humidity, rain, photoresistor, light, build, wifi, wireless, solar, home automation, mqtt, node-RED, arduino, microcontroller, dht11, dht22, bmp180, wemos, wemos d1 mini, lm317, lifepo4, lifepo, charging, solar charger, outdoor, make, maker
Id: at7wmm9t8UE
Channel Id: undefined
Length: 11min 5sec (665 seconds)
Published: Mon Oct 30 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.