This shows you the differences between two versions of the page.
iothings:proiecte:2021:retroweatherstation [2022/01/19 01:02] florin.dragulin |
iothings:proiecte:2021:retroweatherstation [2022/01/27 22:10] (current) florin.dragulin |
||
---|---|---|---|
Line 3: | Line 3: | ||
<sub>author Dragulin Florin Catalin</sub> | <sub>author Dragulin Florin Catalin</sub> | ||
<sub>ACES 2022</sub> | <sub>ACES 2022</sub> | ||
+ | |||
+ | [[https://github.com/DFCatalin/Retro-Look-Weather-Station|Github Project Repo]] | ||
=== I. Short Description === | === I. Short Description === | ||
- | One network composed from one core station which will display ambient data on a VFD (Vacuum Fluorescent Display) and 1 or 2 more station powered by Li-Ion cell which will sample data from outside and inside the house. Key ambient parameters are temperature, humidity and atmospheric pressure. | + | One network composed from one core station which will display ambient data on a VFD (Vacuum Fluorescent Display) and 1 or 2 more station powered by Li-Ion cell which will sample data from outside and inside the house. Key ambient parameters are temperature, humidity, atmospheric pressure and light illuminance. |
=== II. Hardware === | === II. Hardware === | ||
Line 22: | Line 24: | ||
{{:iothings:proiecte:2021:samsung_sve_11ms21.png?400| Samsung SVE 11MS21}} | {{:iothings:proiecte:2021:samsung_sve_11ms21.png?400| Samsung SVE 11MS21}} | ||
- | Due to limited amount on the ESP32 bord, to drive those 20 pins I used a special IC which can handle higher voltages, Microchip HV5812, a serial 20-bit shift register with VDD = 4.5-5.5V for logic circuits and VPP = 20 – 80V for high voltage. | + | Due to limited amount on the ESP32 board, to drive those 20 pins I used a special IC which can handle higher voltages, Microchip HV5812, a serial 20-bit shift register with VDD = 4.5-5.5V for logic circuits and VPP = 20 – 80V for high voltage. |
Data-In, CLK and Strobe will be driven by ESP32. To obtain 30-32V from my 9V DC power I used a switch mode power supply (SMPS) with MT3608 IC to have a higher efficiency. | Data-In, CLK and Strobe will be driven by ESP32. To obtain 30-32V from my 9V DC power I used a switch mode power supply (SMPS) with MT3608 IC to have a higher efficiency. | ||
Line 34: | Line 36: | ||
*2. Slave station | *2. Slave station | ||
- | It will be placed outside to sample temperature, humidity and pressure. To have communication with core station, I used the same microcontroller, ESP32 dev board. External parameters are capture using BMP280 with I2C interface at 3.3V logic level. | + | It will be placed outside to sample temperature, humidity and pressure. To have communication with core station, I used the same microcontroller, ESP32 dev board. External parameters are capture using BMP280 with I2C interface at 3.3V logic level |
Outside outlets are not every time easy to get so a cordless station is needed. For that cheapest and fastest solution is to use a Li-Ion connected to 1W solar panel. Li-Ion cells have a maximum voltage at 4.2 – 4.3V when are at 100% state of charge (SOC), keep a steady voltage between 80% and 20% SOC, at 3.7V and then drop almost linearly to 2.3V. | Outside outlets are not every time easy to get so a cordless station is needed. For that cheapest and fastest solution is to use a Li-Ion connected to 1W solar panel. Li-Ion cells have a maximum voltage at 4.2 – 4.3V when are at 100% state of charge (SOC), keep a steady voltage between 80% and 20% SOC, at 3.7V and then drop almost linearly to 2.3V. | ||
Line 44: | Line 46: | ||
=== III. Software === | === III. Software === | ||
- | Because cycling from inside parameters to outside parameters, over and over again, I decided to add clock function as idle function. To get current time and date I used ESP32 connected on internet to request NTP packets from a NTP server. | + | Because cycling from inside parameters to outside parameters, over and over again, I decided to add clock function as idle function. To get current time and date I used ESP32 connected on internet to request NTP packets from a NTP server. |
- | Communication between core and slave station is done using a low power protocol developed by Espressif, ESP-NOW. Connectivity is made via 2.4GHz wireless and is peer to peer, after an initial setup there is not requirements for other handshaking method. | + | Communication between core and slave station is done using a low power protocol developed by Espressif, ESP-NOW. Connectivity is made via 2.4GHz wireless and is peer to peer, after an initial setup there is not requirements for other handshaking method. ESP-NOW supports the following features |
- | ESP-NOW supports the following features: | + | |
- | - Encrypted and unencrypted unicast communication. | + | - Encrypted and unencrypted unicast communication. |
- | - Mixed encrypted and unencrypted peer devices. | + | - Mixed encrypted and unencrypted peer devices. |
- | - Up to 250-byte payload can be carried. | + | - Up to 250-byte payload can be carried. |
- | - The sending callback function that can be set to inform the application layer of | + | - The sending callback function that can be set to inform the application layer of transmission success or failure. |
- | transmission success or failure. | + | - Limited encrypted peers to 10 and up to 20 for unencrypted peers |
- | - Limited encrypted peers to 10 and up to 20 for unencrypted peers | + | |
- | Peers don’t need to be connected on internet; communication is made using MAC address of each peer in the mesh. Payload limit can be a downsize, but the transmission is fast so it can be done in multiple steps. | + | Peers don’t need to be connected on internet; communication is made using MAC address of each peer in the mesh. Payload limit can be a downsize, but the transmission is fast (default at 1 Mbps) so it can be done in multiple steps. |
How code works? | How code works? | ||
Line 60: | Line 62: | ||
*1. Core station | *1. Core station | ||
- | It’s used to grep data from slave station, get and display time and date, display all inside and outside parameters. In this stage at every 10 minutes starting from 0, core station prints in this order | + | It’s used to grep data from slave station, get and display time and date, display all inside and outside parameters. In this stage at every 10 minutes starting from 0, core station prints in this order: |
- Inside temperature | - Inside temperature | ||
Line 67: | Line 69: | ||
- Outside temperature from DS18B20 | - Outside temperature from DS18B20 | ||
- Outside air pressure | - Outside air pressure | ||
+ | - Outside light illuminance | ||
- Li Ion cell voltage | - Li Ion cell voltage | ||
At every start of a new hour, ESP32 is set to print on display date in YYYY-MM-DD format. Time is displayed in HH-MM-SS 24h format. | At every start of a new hour, ESP32 is set to print on display date in YYYY-MM-DD format. Time is displayed in HH-MM-SS 24h format. | ||
Another function implemented it dims display brightness based on time interval. Because I use the station daily, during night it lights the room like a green bulb. To avoid that issue, between 20 and 7 brightness is reduce using multiplexing time. | Another function implemented it dims display brightness based on time interval. Because I use the station daily, during night it lights the room like a green bulb. To avoid that issue, between 20 and 7 brightness is reduce using multiplexing time. | ||
+ | |||
+ | If the battery level is low, a message indicator light will stay on until the battery is replaced or charged. The cell min threshold is 3.6V which is the minimum voltaged that can supply a steady 3.3V at LDO output pin. | ||
+ | |||
+ | To have access to sensors values at any time we can view them on a HTML page hosted by core station. To access the page, when power on the module, it will print IP address for 5 seconds. Values on page are updated using AJAX at every 10 seconds. | ||
+ | |||
+ | |||
+ | {{:iothings:proiecte:2021:html_page_rlws.png?500| HTML Page}} | ||
*2. Slave station | *2. Slave station | ||
Line 76: | Line 86: | ||
To maximize battery life, which is mandatory for an outside unit, ESP32 is in deep sleep for most of time. It’s weak up every 5 minutes and executes: read from sensors, send values and the re-enters sleep. | To maximize battery life, which is mandatory for an outside unit, ESP32 is in deep sleep for most of time. It’s weak up every 5 minutes and executes: read from sensors, send values and the re-enters sleep. | ||
In deep sleep, it’s supposed to consume 10uA, because only RTC timer is on, but due to poor board implementation, LDO and attached sensor, consumption is higher, measured around 0.1mA and when power on current bursts around 200-250mA. To filter high current spikes and effort on LDO, I place an auxiliary cap as a power reservoir. | In deep sleep, it’s supposed to consume 10uA, because only RTC timer is on, but due to poor board implementation, LDO and attached sensor, consumption is higher, measured around 0.1mA and when power on current bursts around 200-250mA. To filter high current spikes and effort on LDO, I place an auxiliary cap as a power reservoir. | ||
+ | |||
+ | |||
+ | {{:iothings:proiecte:2021:flowchart_core_slave.png?1000| Flowchart for both modules}} | ||
=== IV. Schematic, Layout, PCB and Housing === | === IV. Schematic, Layout, PCB and Housing === | ||
Line 84: | Line 97: | ||
- | === V. Bibliography === | + | Without a green fillter some unwanted lines are iluminated due to multiplexing. |
+ | |||
+ | {{:iothings:proiecte:2021:core_final.png?1000| Core Station Display}} | ||
+ | |||
+ | |||
+ | === V. Challenges, conclusion and further development === | ||
+ | |||
+ | As a challenges I will say that having 4 voltages rails in a single circuit it's pretty hard to managed. Driving a VFD requires more knowledge and resources than a simple mini OLED or LCD screen. Another challenge is to optimise power consumption in slave station; using a generic ESP32 board is not the best solution to save power and another problem is represented by solar cell, which in my case is to small to overcame the sink current from the modules when ESP32 is in sleep. | ||
+ | |||
+ | In the end, the project is functional, and I used it every day, with no issues, since my last code upload. My vintage clock colection has now a need veritable member. | ||
+ | |||
+ | As future updates I will put on my list the following: | ||
+ | * Get a bigger or more vented case for core station. Sometimes due to the ESP32's heatshield, which is running at full speed to multiplex the VFD and power all Wi-Fi connections, is getting hot and influence BMP180 readings. | ||
+ | * Find a way to use power gating for sensors and ESP32 from slave station to maximise power consumption. I will try to do that using a P-MOS and a low power programmable timer or an PIC/AVR microcontroller which has a small current draw. | ||
+ | * Use a higher quality solar cell to power the Li-Ion charge IC. | ||
+ | * Add more sensors, build more stations and customise user interface from HTML page, maybe adding some custom commands to modify sleep time for slave ESP32, threshold values for battery and display text. | ||
+ | |||
+ | === VI. Bibliography === | ||
+ | |||
+ | - [[https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf|ESP32-WROOM-32D datasheet]] | ||
+ | - [[https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_now.html|ESP-NOW DOC]] | ||
+ | - [[https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/| ESP-NOW start guide and exemple]] | ||
+ | - [[https://lastminuteengineers.com/esp32-deep-sleep-wakeup-sources/| ESP32 sleep modes]] | ||
+ | - [[https://randomnerdtutorials.com/esp32-ntp-client-date-time-arduino-ide/| NTP server]] | ||
+ | - [[https://www.noritake-elec.com/technology/general-technical-information/vfd-operation| VFD Fundamental]] |