{"id":816,"date":"2021-04-25T16:17:30","date_gmt":"2021-04-25T14:17:30","guid":{"rendered":"https:\/\/outpost.garf.de\/wordpress\/?p=816"},"modified":"2021-04-25T16:17:31","modified_gmt":"2021-04-25T14:17:31","slug":"outdoor-solar-powered-weather-station-part-1","status":"publish","type":"post","link":"https:\/\/outpost.garf.de\/wordpress\/index.php\/2021\/04\/25\/outdoor-solar-powered-weather-station-part-1\/","title":{"rendered":"Outdoor solar powered weather station &#8211; part 1"},"content":{"rendered":"<p>I built this type of weather station before. But unlike the last times, when I blogged only after I completed it, this time I will blog during building it. I do not spend too much time on this. Still working from home I often lack the energy going back to my desk in the evening and writing code or designing stuff. So I spend about 30 minutes each day, making this a slow build. But hey, even when working slowly I will complete this. <\/p>\n\n\n\n<p>This is the fourth version of my outdoor weather station. The following hardware concecpts I tried so far:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Battery and solar powered ESP8266. Using Wifi for data transmission which uses way to much power. In summer time it worked, but in winter I only had about two hours of data. <\/li><li>Battery (two standard AAs) and solar powered <a href=\"https:\/\/store.arduino.cc\/arduino-mkr-wan-1300-lora-connectivity-1414\">Arduino MKRWAN 1300<\/a>. Using LoRaWan for transmission this one worked fine for about two years, then it stopped working for whatever reason.  Code can still be found <a href=\"https:\/\/github.com\/wtremmel\/arduino-lora-sensors\">here<\/a>.<\/li><li>LiPo battery and solar (4 small panels) powered <a href=\"https:\/\/www.adafruit.com\/product\/3178\">Adafruit LoRaWan Feather M0<\/a> &#8211; this one is so good I built it twice. The original one still works without touching for more than two years now. The second one also works fine. Some details I already blogged, the code is <a href=\"https:\/\/github.com\/wtremmel\/adafruit-lora-sensors\">here<\/a>. <\/li><\/ol>\n\n\n\n<p>For this version I decided to try a new microcontroller board &#8211; the <a href=\"https:\/\/heltec.org\">Heltec<\/a> <a href=\"https:\/\/heltec.org\/project\/htcc-ab01\/\">Cubecell Board<\/a> (they have a number of boards available, just check). This board is a makers dream:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>LiPo battery connector, solar panel input, built in charger<\/li><li>RGB Led if you want to display status in different colors<\/li><li>Open source software and deep sleep code which actually works<\/li><\/ul>\n\n\n\n<p>And this feature neither Arduino nor Adafruit has:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Power output pin to power sensors and periphery <strong>which you can turn off by software<\/strong>.<\/li><\/ul>\n\n\n\n<p>On other boards you can power down the board, if you are lucky the memory stays powered and you do not have to re-connect to the LoRa network, but your sensors are constantly drawing current. With the Cubecell V<sub>ext<\/sub> connector, you can power down your sensors when the board goes into deep sleep and power them up again when it awakes. Of course some sensors need re-initialization after that but it still is way more energy efficient then keeping them running. <\/p>\n\n\n\n<p>Ok, lets to back to building a weather station. This blog entry follows my process and does not immediately present the finished product. So my first steps are:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Assemble the hardware<\/li><li>Write the code<\/li><li>Test the setup<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Assemble the hardware<\/h2>\n\n\n\n<p>On hardware you need:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Microcontroller. I decided for the Heltec Cubecell HTCC-AB01. Cost about EUR 15.<\/li><li>Sensors. I want to measure temperature, humidity, light, atmospheric pressure and  beginning of rainfall. So I decided for:<ul><li>BMP280 &#8211; combined sensor. I2C bus. Cost about EUR 3.<\/li><li>GY49 &#8211; light level sensor, but any light sensor with I2C output will do. Cost also below EUR 3.<\/li><li>ADSL1115 &#8211; analog digital converter. Not in the picture as I added it later. Some microcontrollers have A\/D inputs, Cubecell also has one but it is used for checking the battery level.<\/li><\/ul><\/li><li>Battery. Any LiPo battery which brings the system over the night in winter. Rather over-provision, larger LiPos are not more expensive just a little more bulky. I am using a 1000mAh one here. Cost about EUR 7.<\/li><li>Solar panel. Larger means faster charging. Output should be around 6V. Cost about EUR 8.<\/li><\/ul>\n\n\n\n<p>For trial I just put everything together with cables and connectors. Even in the finished product I avoid soldering if I can, because if something gets wet or wears out, plugging in a new part is way easier then to re-solder. You can see my setup in the picture above.<\/p>\n\n\n\n<p>Connect all sensors via I2C bus and connect power to the Vext pin of the controller. Solar panel goes to V* and the battery to the battery connector on the back. Next is uploading software and testing.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create the software<\/h2>\n\n\n\n<p>If you start from scratch this is the hardest part. But I built LoRa based weather stations before so I could re-use a lot of my code. The only thing Heltec (as everybody) does differently is the LoRa part of the code. Fortunately they provide many examples in their <a href=\"https:\/\/github.com\/HelTecAutomation\/CubeCell-Arduino\">Github repository<\/a>.<\/p>\n\n\n\n<p>You can check my code also <a href=\"https:\/\/github.com\/wtremmel\/heltec-cubecell-lora-sensors\">at Github<\/a>. The idea of the software is very easy:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Boot. <\/li><li>Connect via LoRa to TheThingsNetwork.<\/li><li>Power up sensors<\/li><li>Check sensors<\/li><li>Read sensors<\/li><li>Read LoRa for commands (I defined a number of commands I can send to the station, like switching on the LED)<\/li><li>Power down sensors<\/li><li>Go to deep sleep for 2-4 minutes (this depends on battery, solar level, etc.)<\/li><li>Go to step 3<\/li><\/ol>\n\n\n\n<p>I mentioned <a href=\"https:\/\/www.thethingsnetwork.org\">TheThingsNetwork<\/a> &#8211; this is a commercial LoRa network provider who also have a community edition. I operate a gatewayat home and can use all other gateways of the network for free. <\/p>\n\n\n\n<p>So this is now sitting near a window and transmitting data. Next step will be building a 3D printed case for it.<\/p>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>I built this type of weather station before. But unlike the last times, when I blogged only after I completed it, this time I will blog during building it. I do not spend too much time on this. Still working from home I often lack the energy going back to my desk in the evening [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":812,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"zakra_page_container_layout":"customizer","zakra_page_sidebar_layout":"customizer","zakra_remove_content_margin":false,"zakra_sidebar":"customizer","zakra_transparent_header":"customizer","zakra_logo":0,"zakra_main_header_style":"default","zakra_menu_item_color":"","zakra_menu_item_hover_color":"","zakra_menu_item_active_color":"","zakra_menu_active_style":"","zakra_page_header":true,"footnotes":""},"categories":[113],"tags":[],"class_list":["post-816","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microcontrollers"],"_links":{"self":[{"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=816"}],"version-history":[{"count":8,"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/816\/revisions"}],"predecessor-version":[{"id":824,"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/816\/revisions\/824"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/media\/812"}],"wp:attachment":[{"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/outpost.garf.de\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}