Elektroda.com
Elektroda.com
X
Elektroda.com

Wi-Fi weather station. Bascom and Arduino.

pier 12795 10
This content has been translated » The original version can be found here
  • Wi-Fi weather station. Bascom and Arduino.
    Hello.

    I present a weather station for which I have been working for some time.
    The beginning of work is also my beginning of fun with Arduino.
    It started with a ready design of a tiny station with an oled display.
    Wi-Fi weather station. Bascom and Arduino.
    At that time, just uploading the program to ESP8266 was a feat for me. Later it started combining, correcting this and trying other soft products.
    A data receiver from the network was created based on this station.

    The next step was to make an external weather sensor.
    Three versions were created.
    First version.
    Wi-Fi weather station. Bascom and Arduino.

    Total failure. The system was powered by a Li-ion battery via a 3.3V buck-boost converter. Battery charged with TP4056 system with 2W solar cell. The system was also not cyclically dormant, which resulted in a continuous consumption of 80mA. The results could be read on the display and by connecting to the device on the browser page. This arrangement had no right to exist.

    Second version.
    Wi-Fi weather station. Bascom and Arduino.

    Almost everything has been improved in this version. ESP8266 got a cyclical awakening from the "Deepsleep" state every 30 minutes, I also gave up the converter in favor of the LDO stabilizer, the measurement results are sent to the BLYNK and Thingspeak server, the unchanged readability on the oled display has remained.
    I also added a battery voltage reading.
    Now the system consumes 80mA for a few seconds every half hour and about 2mA for the rest of the time due to the fact that the display is permanently switched on.

    Scheme:
    Wi-Fi weather station. Bascom and Arduino.

    The diagram still shows HTU21d and BMP280 in the final version changed to BME280.


    Third version.
    Wi-Fi weather station. Bascom and Arduino.

    In this version, only the sensor has been improved and changed. In earlier versions, the sensor was inside the housing, now it is in the radiation housing. HTU21d and BMP280 have been replaced by one BME280 sensor.
    Radiation housing traditionally made of flowerpot stands, bolted together on M3 stainless steel rods.
    Data from such a sensor can be read in four ways. Directly on the display, by smartphone using the Blynk application, on our Thingspeak channel and at the weather station itself.

    Final program.
    Code: c
    Log in, to see the code



    When I already had the measuring part, it was the turn of the station itself.
    For a long time I had a 3.5 'display on the SSD2119 controller. I bought it because it has a ready service procedure at Bascom and it lay in the drawer for two years. Now I would use a completely different Lcd because it is slow and needs a lot of I / 0 pins.
    The whole is controlled by atmega128 on some board. I don't even know what the record was for, I bought it. As the display only tolerates 3.3V power supply and this voltage is powered atmega it is also heavily overclocked, 16Mhz at 3.3V. I know this is an inflection, but before the whole station was created, I tested the whole thing for a long time and nothing bad happened.
    HTU21d, BH1750 and RTC DS3231 sensors are connected to the atmega after I2C.
    By default, mega reads data from them and sends it to the display. The light sensor is needed to automatically change the backlight intensity - atmega controls the PWM converter on the display board. I gave up time synchronization with the server because you have to change the winter / summer time in the program yourself, anyway DS3231 offers considerable accuracy. The controller also receives ESP data via serial.
    ESP8266 deals with the wireless part with the program in Arduino. ESP connects to the Wi-Fi network, reads weather forecasts for the current day and two days ahead from the Weatherunderground server and moon age, the latest values from my Thingspeak channel and time from the NTP server. As I wrote earlier, he does not use time. Then he formats and sends the data every minute after the series. Atmega receives this data and presents it on the display.
    The program is mostly a network ready. I stick it with probably four different and added sending data after the series.
    Bitmaps with icons of weather and moon phases are saved on the SD card.
    And the moon phase is calculated from its age. Of course, atmega does this.

    Well, I know it could be done more easily. ESP alone would calmly wind up with everything, but I wanted to use the parts I had. On the other hand, I don't think I saw a 3.5 'display that would work with ESP and I don't know if it would lack pins.

    5V power supply. Current consumption at a maximum backlight brightness of 480mA.

    The casing was made of laminate. Its individual components were designed in Eaglu and made like ordinary pcb. Connecting individual elements by soldering. The rear part is screwed. I just need to spray it with some varnish so that copper does not oxidize but now I have no conditions for it.


    When commenting on programs, especially this in Bascom, please take into account that I have never learned any programming language and it is written as it is. The one for ESP is simpler and therefore less messy by me.

    Program sources for atmega will be attached.

    Program for ESP8266:
    Code: c
    Log in, to see the code



    The station has been operating for several weeks and does not freeze. The only drawback I noticed is sometimes after the start of power Atmega "can't see" the SD card. This is indicated by a message on the display. It helps to reset or turn the power back on. This is probably due to overclocking.

    I know that the sensor itself was already presented in the diy department but then it was an independent device and now it has become part of the whole weather station.

    If I forgot something, write, ask.

    And something for the eye.

    Wi-Fi weather station. Bascom and Arduino.

    Wi-Fi weather station. Bascom and Arduino.

    Wi-Fi weather station. Bascom and Arduino.

    Wi-Fi weather station. Bascom and Arduino.

    Wi-Fi weather station. Bascom and Arduino.

    Wi-Fi weather station. Bascom and Arduino.


    Wi-Fi weather station. Bascom and Arduino.


    Wi-Fi weather station. Bascom and Arduino.

    Cool! Ranking DIY
    Can you write similar article? Send message to me and you will get SD card 64GB.
    About Author
    pier
    Level 23  
    Offline 
    pier wrote 1721 posts with rating 1488, helped 17 times. Live in city Biłgoraj. Been with us since 2006 year.
  • #2
    fotomh-s
    Level 22  
    Do these OLEDs also have procedures or libraries or any available Bascom code?
    I ask because they are quite cheap for graphic displays, but writing your own procedures just to display a string is a slight exaggeration, and I'm thinking about getting such an OLED module. In addition, two-color (yellow-blue) versions are available at the same price. Prices of these modules are probably around PLN 20 or even less.
  • #3
    gdL
    Level 27  
    Best wishes to the Meteo lover on the electrode. Very cool design. Are you planning its further development?
    As for the code, for some time I personally try to use classes. It helps me to organize everything logically and return to the project painlessly even after a long time.
    Of course you have my voice.
  • #4
    User removed account
    User removed account  
  • #5
    macka2
    Level 9  
    Usually, I buy most small sensors, screens etc. directly from a Chinese on eBay.
    Recently, I paid about PLN 20 for BH1750 and BME280 sensors together, and I bought small OLED displays for less than $ 3 a piece. Of course, you have to wait a bit until our mail delivers them, because usually the route takes the customs office the longest-> Polish post office-> customer: / The route from China to Poland often takes less than delivery by post.

    PS. Where did you get such a nice transparent, waterproof box? Do you have any link? Or did you do it yourself?
  • #6
    pier
    Level 23  
    macka2 wrote:

    PS. Where did you get such a nice transparent, waterproof box? Do you have any link? Or did you do it yourself?

    Gainta housing with TME.
  • #7
    Jacek Rutkowski
    Level 27  
    fotomh-s wrote:
    Do these OLEDs also have procedures or libraries or any available Bascom code?
    I ask because they are quite cheap for graphic displays, but writing your own procedures just to display a string is a slight exaggeration, and I'm thinking about getting such an OLED module. In addition, two-color (yellow-blue) versions are available at the same price. Prices of these modules are probably around PLN 20 or even less.

    The two colors are that the top 16 lines are yellow and the rest are blue etc. I haven't seen OLED with SSD1306 yet to change colors ...
    If you are interested I have an example of SSD1306 support after I2C under BASCOM AVR.
  • #8
    User removed account
    User removed account  
  • #9
    Jacek Rutkowski
    Level 27  
    R-MIK wrote:
    Jacek Rutkowski wrote:
    I haven't seen OLED with SSD1306 yet to change colors

    As I remember, SSD1306 can handle max 128x64 mono pixels.

    Exactly so, and two-color displays have just a part of the display, e.g. yellow, the rest blue.
  • #10
    krisRaba
    Level 30  
    pier wrote:
    The only drawback I noticed is sometimes after the start of power Atmega "can't see" the SD card.

    You didn't give the station diagram, so you can't check - do you have resistors polarizing individual lines at the SD card? Once I had a problem that every time the card did not initialize correctly when switching on the device. There is a procedure for selecting the communication method on the card. If you do not have a separate control of its power supply, then any transient states that occur before the MCU gets up can mix up and you won't get along after SPI. In my case, the polarization of the line helped with pull-up resistors. Since then, he has removed it with his hand :)
  • #11
    kalarepah
    Level 7  
    Can the BME280 sensor in the form of a module be used outdoors?
    Will it not be destroyed too soon?
    Is the accuracy and durability of such a sensor similar to SHT11?
    I am building a similar station but I planned to use SHT11 and here I see that BME280 can be bought at a similar price, so I wonder what its disadvantages are?

    Moderated By Mirek Z.:

    I have removed the prohibited link to the auction (and unnecessary / incorrect spaces before the question marks). https://www.elektroda.pl/rtvforum/faq.php - p. 3.1.13, p. 3.1.18.