esp8266 a superkapacitor
- tiimsvk
- Dárce - Donátor
- Příspěvky: 801
- Registrován: 06. květen 2021, 07:03
- Dal poděkování: 72 poděkování
- Dostal poděkování: 65 poděkování
Re: esp8266 a superkapacitor
POZNÁMKY K SUPERCAP A PÔDNEMU SENZORU
Funkčné riešenie, ale nie je to to čo by som si uplne predstavoval. Budem tu robiť poznámky:
SUPERVIZOR:
- Zapojenie bez zvýšenia hysterézie bol problém aspoň pre moje esp8266 takže som postupoval podľa linku od kiklhorn https://www.ti.com/lit/an/slva360/slva360.pdf, postačovalo pridať ďeličku napätia aspoň v mojom nastavení kde som pridal 100kohm z napájania supervizora na gnd a z vcc trimer 103ku kde nastavujem hornú hranu spustenia (ďelička spravila zazráky čo sa týka spustena) + som pridal posun napätia pri vipnutí pomocou shotkyho diody z 3.0V na 3.2V
MOFSET:
- Mofset som skúšal IRFZ44N ako bežne dostupný, ale po skúšaní a prečitaní članku https://oscarliang.com/how-to-use-mosfe ... -tutorial/ som ho nahradil logickým mofsetom FQP30N60L,s ktorým začalo moje zariadenie fungovať.
ESP32-C3-12F vs ESP8266:
- Snažil som sa celý projekt postaviť na novom esp32-C-12F, ktorý je formátu ako klasická esp8266 12F ale bez úspechu.
Hlavný problém je asi napájanie ale bez kvalitného power profileru to neviem zistiť ako sa správa esp pri nábehu ale verím, že si stiahne dosť veľa napätia a tým pádom to nezvláda regulátor
- Ak to niekto vie skúsiť s týmto esp budem len rád za každú radu.
- Konfigurácia ESP32-C3-12F / LDO HT7833, 20uF vstup, 680uF výstup / Supervisor LMS33460 / a na vstupe 3.3V
- škoda pretože celkovo ten modul je úspornejši ako akékoľvek esp8266.
Pôdny senzor:
- Skúšal som lacný senzor pre snimanie vlhkosti pôdy https://vi.aliexpress.com/item/1005002010938691.html
- Problém s týmto senzorom je stabilizovanie až 20s cca + odčitavalo príliš vysokú hodnotu aj polosuchej pôde preičom na vzduchu bol diametrálny rozdiel, preto som sa rozhodol prejsť na kapacitný senzor.
Na laskakit ho predávaju za malo korun a je super už jeden projekt s nim mam postavený a funguje skvelo.
- Pristupil som k tomuto ale iným spôsobom, všetky súČiastky som z dosky dal dole a prirobil ich k PCB kde je esp + som použil hack zo stránky:
https://thecavepearlproject.org/2020/10 ... cy-output/
čim som vyhodil čitanie signalu cez ADC a čitam pwm signal. čital som, že pri dlhšom čase má senzor problém s pôdou tak uvidíme, aké hodnoty budú pri dlhšom použivaní. Jeden veľký uspech je ale, že namiesto pôvodných 4.5mA má teraz celý senzor pre pôdu pod 1mA.
TEPLOMER:
- z prvých pokusov merania je viditeľné že teplotný senzor ukotfený priamo na zariadení, ktoré je celé čierne nie je dobrý nápad. Teploty veľmi ulietaju pri vysokých vonkajšich teplotách.
- v pláne je vyriešiť pomocou externej pripojky a senzor umiestniť do radiačného štítu to by malo ovplyvniť teplotu k presnejšim hodnotám.
LUX meter:
- Ak by som použil namiesto ADC temt6000 senzoru bh1750 ktory je na i2c zbernici a trochu zmenšil nároky a sledovanie napätia na mcu/solar/baterky tak by som vedel vyhodiť celý ADS1115 modul čo by asi ušetrilo ďalšie cenné mAh
SPOTREBA:
Plán, ktorý by som asi ešte zvážil:
- nahradiť AM2301 za i2c low power consumption teplomer a vlhkomer
- nahradiť lux adc temt6000 za bh1750 na i2c zbernici
- ušetrenim jedného pinu pre teplomer by som ho využil na vzopinanie a vipinanie merania baterie (teraz je zbytočne dlhy čas merania, nakoľko je spoločný s ostatnymi senzormi počas merania.
- vyhodiť ADS1115 obetujem meranie napätia mcu a solarneho panelu a zachovam iba supercap
Naposledy upravil(a) tiimsvk dne 01. červen 2023, 10:43, celkem upraveno 6 x.
- tiimsvk
- Dárce - Donátor
- Příspěvky: 801
- Registrován: 06. květen 2021, 07:03
- Dal poděkování: 72 poděkování
- Dostal poděkování: 65 poděkování
Re: esp8266 a superkapacitor
Už sa to pomaly rysuje:
Stále poznámky budú v príspevku vyššie.
Schémy aj kód postnem neskôr keď bude všetko fungovať zatial to vyzera slubne. Stále poznámky budú v príspevku vyššie.
- tiimsvk
- Dárce - Donátor
- Příspěvky: 801
- Registrován: 06. květen 2021, 07:03
- Dal poděkování: 72 poděkování
- Dostal poděkování: 65 poděkování
Re: esp8266 a superkapacitor
"Finálna verzia" radšej v uvodzovkách nakoľko predpokladám, že až ta tretia "finálna verzia" bude posledná
(už sme na druhej! //// a už sme na tretej )
HW Verzia 2 s radiačným štítom pre teplomer
Meranie záhrady
Čo dokáže:
- Meranie teploty, vlhkosti, tlaku vzduchu
- Meranie teploty a vlhkosti pôdy
- Meranie napätia na superkondezátoroch, solarnom panely a mcu
- Meranie jasu
Čo potrebujeme:
Moduly:
- Solárny panel 5V (najlepšie by bol 5.5V)
- Superkondenzátory 2x22uF 2.7V
- Esp8266 12F
- BH1750
- Dallas temperature sensor
- Capacitive Soil Moisture Sensor V2.0
- AHT22
- BMP280
Súčiastky:
Dioda 1N5817 2x
Tranzistor PNP 2N3906 2x
Rezistor 220k 2x
Rezistor 220
Rezistor 100k 2x
Rezistor 470k 2x
Rezistor 470
Rezistor 10k 4x
Rezistor 4k7 3x (je možné nahradiť 10k)
Rezistor 1M 2x ( je možné nahradiť aj vyššim)
Rezistor 1k 2x
Rezistor 2k
Led 3mm červená
Logic power mofset NPN FQP30N60L >0.5A (je možné nahradiť iným podobným logic mofsetom)
Logic power mofset NPN 2N7000 >0.2A 2x ( je možné nahradiť aj transiztorom)
PNP transistor 2N2907
Kondenzátor foĺiový 470uF 2x (alebo vyššim)
Trim 103
supervizor LMS33460
timer LM555CN (alebo original použiť z kapacitného senzoru)
keramický kondezátor 20uF (alebo podobný)
keramický kondezátor 0.33uF (alebo podobný)
keramický kondezátor 10nF 2x (alebo podobný)
keramický kondezátor 100nF (alebo podobný)
Poistku PPCT 0.5A (nie je potrebná ak sa nebojíte zapájania)
Tlačidlo smd 4pinové
PCB sot23 pre supevizor
PCB pre ldo
PCB adapter pre esp8266
headery pre ldo, supervizor, esp, supercap, solarny panel, dallas, moisture senzor, am2301, temt6000
Vodotesnú krabicu s prehľadným vekom + stojan do pôdy
PCB 5x7 2.54mm
Kábliky, dupont konektory
Všetky súčiastky sú neni potrebné ak niektoré veci nechcete merať + sa daju upravovať podľa potreby
Prevedenie:
V príspevku vyššie
Schéma: Schéma je priamo na pcb ak by chcel lepšie niekto schému viem dať PDFko alebo priamo dwg
Kód:
Meranie vlhkosti pôdy je veľká veda tak ak vie niekto ako by sme mohli vylepšiť kód tak sem s tym v kóde sú aj užitočné články na to. Ja som to zatial spravil jednoducho voda vs vzduch a percentá.
EDIT: úprava kódu + zmena na kapacitny senzor pôdy.
EDIT2:
- Pridaný riadiačný štít
- Úprava kódu pre korekntné posielanie hodnôt vlhkosti pôdy
- Vyzerá to tak, že bude treba dať väčši kondenzátor nakoľko vydrži celú noc ale svietilo celý den slnko. Uvidíme správanie sa počas oblačnosti a hlavne už je letný čas v zime by to senzor nedával.
EDIT3:
- nahradený svetelny senzor temt6000 za i2c bh1750
- nahradený teplotny senzor am3201 za aht22 + bmp280
- odstránený adc ads1115 senzor
- meranie iba napätia na supercap
- úprava kóde beh teraz iba 12s
(už sme na druhej! //// a už sme na tretej )
HW Verzia 2 s radiačným štítom pre teplomer
Meranie záhrady
Čo dokáže:
- Meranie teploty, vlhkosti, tlaku vzduchu
- Meranie teploty a vlhkosti pôdy
- Meranie napätia na superkondezátoroch, solarnom panely a mcu
- Meranie jasu
Čo potrebujeme:
Moduly:
- Solárny panel 5V (najlepšie by bol 5.5V)
- Superkondenzátory 2x22uF 2.7V
- Esp8266 12F
- BH1750
- Dallas temperature sensor
- Capacitive Soil Moisture Sensor V2.0
- AHT22
- BMP280
Súčiastky:
Dioda 1N5817 2x
Tranzistor PNP 2N3906 2x
Rezistor 220k 2x
Rezistor 220
Rezistor 100k 2x
Rezistor 470k 2x
Rezistor 470
Rezistor 10k 4x
Rezistor 4k7 3x (je možné nahradiť 10k)
Rezistor 1M 2x ( je možné nahradiť aj vyššim)
Rezistor 1k 2x
Rezistor 2k
Led 3mm červená
Logic power mofset NPN FQP30N60L >0.5A (je možné nahradiť iným podobným logic mofsetom)
Logic power mofset NPN 2N7000 >0.2A 2x ( je možné nahradiť aj transiztorom)
PNP transistor 2N2907
Kondenzátor foĺiový 470uF 2x (alebo vyššim)
Trim 103
supervizor LMS33460
timer LM555CN (alebo original použiť z kapacitného senzoru)
keramický kondezátor 20uF (alebo podobný)
keramický kondezátor 0.33uF (alebo podobný)
keramický kondezátor 10nF 2x (alebo podobný)
keramický kondezátor 100nF (alebo podobný)
Poistku PPCT 0.5A (nie je potrebná ak sa nebojíte zapájania)
Tlačidlo smd 4pinové
PCB sot23 pre supevizor
PCB pre ldo
PCB adapter pre esp8266
headery pre ldo, supervizor, esp, supercap, solarny panel, dallas, moisture senzor, am2301, temt6000
Vodotesnú krabicu s prehľadným vekom + stojan do pôdy
PCB 5x7 2.54mm
Kábliky, dupont konektory
Všetky súčiastky sú neni potrebné ak niektoré veci nechcete merať + sa daju upravovať podľa potreby
Prevedenie:
V príspevku vyššie
Schéma: Schéma je priamo na pcb ak by chcel lepšie niekto schému viem dať PDFko alebo priamo dwg
Kód:
Kód: Vybrat vše
#-------------------------------------------
# BUG AND REPAIR AND PLANNED
#-------------------------------------------
#-------------------------------------------
# REVISION
#-------------------------------------------
# 2023.05.1.1.0
# - replace AMS2301 by BME280
# - replace TEMT600 by BH1750
# - disconnect ADS1115
# - measure only supercap voltage on ADC pin
#-------------------------------------------
# SUBTITUTIONS - basic definitions and description of the device
#-------------------------------------------
substitutions:
device_name: plant-garden
friendly_name: Plant-Garden
created_by: StudioTiiM 2023
device_description: "Soil sensor measure weather and soil powered supercap and solar"
#-------------------------------------------
# POWER CONSUMPTION - whit multimeter
# not yet measured.
# partial consumption below
#-------------------------------------------
# Power consumption 3.3V
# First booting MCU:
# Booting MCU after connected to mqtt:
# Measure sensors:
# Normal: > 68 mA ~ 12s
# Deep sleep: >19µA 3600s
#-------------------------------------------
# DEFINE PINS AND VARIABILES
# CIRCUIT AND MODULES - basic definitions and description of the device
#-------------------------------------------
# ----- MCU -----
# Module: Ai-Thinker ESP8266-12F
# Circuit: Solder on adapter esp8266
# Power Consumption: Peak ~ 330mA / Normal wifi: 120 ~ 170mA / Normal: ~ 70mA / DeepSleep: ~ 20μA
# Specification: Chip Family: ESP8266 / Chip Model: ESP8266EX / Chip ID: 00BC7BB7 / MAC Address: A4:E5:7C:BC:7B:B7 / Number of Cores: 1 / CPU Frequency: 80MHz / Ram: 80kB / Flash: 1Mb
# Description pins:
# PINS ESP8266 | FUNCTION | INPUT | OUTPUT | ADC | PWM | I2C(only one) | SPI | RESISTOR | BOOT | FLASH | HIGH AT BOOT | BOOT FAILS |
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
# EN | | 10.0k PULLUP adapter | |
# RST | | 12.0k PULLUP internal| |
# ADC0 A0 | ANALOG ADC0 | | | OK | | | | | | | |
# GPIO0 D3 | STRAPPING | OK! | OK! | | OK | OK | | 10.0k PULLUP | PULLUP | pulldown | HIGH 110ms*6 | LOW
# GPIO01 TX | TX | OK!*1 | OK | | OK | OK | | | | | HIGH | LOW
# GPIO02 D4 | ON BOARD LED | OK | OK | | OK | OK | | 10.0k PULLUP | PULLUP | | HIGH 70ms*6 | LOW
# GPIO03 RX | RX | OK | OK!* | | OK | OK | | | | | HIGH |
# GPIO04 D2 | SDA | OK | OK | | OK | OK*2 | | | | | |
# GPIO05 D1 | SCL | OK | OK | | OK | OK*2 | | | | | |
# GPIO06 | INTERNAL SPI | | | | | | CLK | | | | |
# GPIO07 | INTERNAL SPI | | | | | | MISO | | | | |
# GPIO08 | INTERNAL SPI | | | | | | MOSI | | | | |
# GPIO09 | INTERNAL SPI | | | | | | HD | | | | HIGH |
# GPIO10 | INTERNAL SPI | | | | | | WP | | | | HIGH |
# GPIO11 | SPI CSC/CMD | | | | | | CS | | | | |
# GPIO12 D6 | | OK | OK | | OK | OK | MISO | | | | HIGH 110ms |
# GPIO13 D7 | | OK | OK | | OK | OK | MOSI | | | | HIGH 110ms |
# GPIO14 D5 | | OK | OK | | OK | OK | SCLK | | | | HIGH 110ms |
# GPIO15 D8 | STRAPPING | OK! | OK! | | OK | OK | CS | 10k PULLDOWN adapter | PULLDOWN | | LOW 110ms | HIGH
# GPIO16 D0 | STRAPPING | OK*4 | OK*5 | | OK | OK | | 470 -> RST*3 | PULLUP | PULLUP | HIGH 110ms*5 |
# *1 Disable hardware uart. logger baud_rate: 0
# *2 recommended I2C
# *3 Enable deep sleep
# *4 No interrupt
# *5 after boot falls ~110ms to ~ 1V
# *6 oscillates
# GPIO08 and GPIO09 pulldown invalid on boot
# Current draw 12mA max per GPIO
# ESP8266 GPIO Behaviour at Boot: https://rabbithole.wwwdotorg.org/2017/03/28/esp8266-gpio.html
# ----- ELECTRICITY -----
# ----- POWER SUPPLY -----
# Module: Super capacitor
# Specification: 2.7V 22F
# Circuit: 2x connected in series out 5V
# Converting energy:
# F - mAh
# mAh = (F * Delta V / 3600) * 1000 = (22 * 2 /3600) * 1000 = 12.2mAh
# Teoretical Life on SuperCap:
# Battery Capacity: 12.2mAh
# Voltage: 3.3V
# Running Time: 12s
# Running current: 80mA
# Idle Time: 3584s
# Idle Current: 20μA
# Average Consumption: 375.5μA
# Battery Life: 1.353d
# Watt-hours: 40.26mWh
# ADC Voltage supercap
battery_pin: A0
battery_measure_pin: GPIO13
# -----------------
# ADC reading whit transistor
# Enable bipolar transistor: 2N3906 PNP and 2N7000 mofset NPN
# Base resistor calculate:
# hFE: 60
# iL (load A): 0.001A
# Vi (base): 3.3V
# Base resistor: Vi/(iL/hFE)/1000 = 3.3/(0.001/60)/1000 = 198kΩ => 220kΩ
# -----------------
# ----- SOLAR PANEL -----
# Module: Solar panel 2Wp polycrystalline 5V
# Specification: Pmax 2W / Voltage Vmp: 5.0V Voc: 5.0V / Imp: 400mA Isc: 400mA / dimension: 94x157x2mm / Operating temperature: -40 ~ +85°C / Wafer: class A polysilicon / Process: EVA lamination
# Circuit: protected shotky diode 1N5817 drop 0.2V
width_panel: "0.07" # m
height_panel: "0.14" # m
# ----- SUPERVISOR -----
# Module: LMS33460 3V under voltage detector
# Specification: Vin 0.8 ~ 7V / open drain out / SC70-5 package / Out current 30mA /
# Power consumption: disable 35µA / enable 45µA
# Settings:
# Default: Falling 2.85 ~ 3.15V / Rising (change using divider): 0.095 ~ 0.215V / Delay time: 70 ~ 130µs
# Circuit:
# Voltage divider: Supercap -> Protect diode 1N5817 -> VCC -> Trim 103 (7.07kΩ) -> In -> 100kΩ -> GND (VCC -> 470kΩ -> Out)
# Mofset: Logic power mofset NPN FQP30N06L Gate -> 220Ω -> Out supervisor
# HYSTERESIS OFF ON
# SuperCAP: 3.3V 3.56V
# ----- LDO -----
# Module: Holtek HT7833
# Specification: Voltage in 0 ~ 8V out fixed 3.3V 2% / max voltage drop 360mV / current max 0.5A /
# Protection: overtemperature / current limiting
# Power consumption: Quiescent current 4µA
# Circuit: VIN -> 2x ceramic 10μF -> GND / VOUT -> PPTC FUSE 0.5A 6V -> VOUT / VOUT -> 470μF 6.3V + 680μF 25V -> GND
# ----- LEDS -----
# Modul: Status led
# Specification: on esp board smd red led
# Modification: remove on board led and solder red whit additional 1KΩ resistor (+ on board 470Ω - down power consumption)
# Power consumption: 328µA
status_led: GPIO02
# Modul: led red diode
# Specification: red led 3mm
# Circuit: GPIO -> LED -> 2kΩ -> VCC(after deep sleep no light on)
# Power consumption: 500µA
indicator_led: GPIO0
# ----- POWER SENSORS -----
# Modul: NPN power transistor 2N7000
# Specification: power all measure modules (reduction of consumption)
# Circuit: GND -> Collector / GPIO -> 1kΩ -> Base / Emitter -> GND out sensor
power_pin: GPIO15
# ----- SOIL MOISTURE SENSOR -----
# OLD WHIT MOISTURE ADC
# Module: Soil moisture sensor
# Specification: Voltage 3.3 ~ 12V / Current working: 20mA, Output 30mA / Dimension: 36x15x7 mm / PCB module whit LM393 comparator
# Modification: unsolder leds (reducer consumption)
# Power consumption: 1.6mA
# Settings:
#moisture_dry: 3.0V
#moisture_wet: 1.85V
#moisture_adc_pin: A0_GND
#moisture_enable_pin: GPIO12
#moisture_stabilize_time: 15s
# NEW WHIT PWM SIGNAL INPUT
# Module: Capacitive Soil Moisture Sensor v2.0
# Specification: Voltage 3.3 ~ 5.5V / Current working: 4.5mA / Dimension: 99x16 mm / PCB module whit TLC555 timer
# Modification: https://thecavepearlproject.org/2020/10/27/hacking-a-capacitive-soil-moisture-sensor-for-frequency-output/
# Unsolder all smd chips on board
# Create new circuit on PCB whit LMC555 timer
# Output PWM signal
# Power consumption: 1.6µA
# Settings:
moisture_dry: 310kHz
moisture_wet: 33kHz
# dry sand: 246kHz
# middle wet soil: 210kHz
moisture_pwm_pin: GPIO12
# How to measure moisture soil:
# https://www.mdpi.com/1424-8220/21/15/5110
# https://thecavepearlproject.org/2020/10/27/hacking-a-capacitive-soil-moisture-sensor-for-frequency-output/
# https://makersportal.com/blog/2020/5/26/capacitive-soil-moisture-calibration-with-arduino
# ----- AMBIENT LIGHT SENSOR -----
# OLD WHIT ADC
# Module: TEMT6000
# Specification: Voltage max. 6V / silicon NPN epitaxial planar phototransistor / Operating Temperature: -40 ~ +85°C / Angle of Half sensitivity: 60° / Wavelength of Peak Sensitivity: 570nm / Range of Spectral Bandwidth: 360 ~ 970nm
# Conection: on module GND -> 10kΩ -> GPIO -> NPN -> VCC
# Power consumption: 20mA (change whit intensity light)
# Measure and formula calculate lux https://devices.esphome.io/devices/temt6000
# I = adc_value/10000kΩ
# The datasheet for the TEMT6000 specifies a proportional correlation between current and illuminance: Every 2 µA of current correlates to 1 lx in the illuminance.
#temt6000_resistor: "10000" #Ω
#temt6000_amps: "2000000" #mA
# max lux = 3.3V * 2000000 /10000 = 660lux / we adjust as much as possible using the cover
# No real calibration is currently used.
# Calibration designed for the exterior.
#temt6000_adc_pin: A1_GND
# NEW WHIT I2C
# Module: BH1750 GY-302 lux meter
# Specifications: 3V ~ 3.6V / Range: 1 ~ 65 535 lx
# Circuit: Interface: I2C address: 0x23
# Consumption: normal 4.4mA
# Modification: unsolder ldo 602K
# http://wiki.sunfounder.cc/index.php?title=GY-302_BH1750_Digital_Light_Intensity_Module
# LUX wiki
# Illuminance (lux) | Surfaces illuminated by
# -----------------------------------------------
# 0.0001 | Moonless, overcast night sky (starlight)[5]
# 0.002 | Moonless clear night sky with airglow[5]
# 0.05–0.3 | Full moon on a clear night[6]
# 3.4 | Dark limit of civil twilight under a clear sky[7]
# 20–50 | Public areas with dark surroundings[8]
# 50 | Family living room lights (Australia, 1998)[9]
# 80 | Office building hallway/toilet lighting[10][11]
# 100 | Very dark overcast day[5]
# 150 | Train station platforms[12]
# 320–500 | Office lighting[9][13][14][15]
# 400 | Sunrise or sunset on a clear day.
# 1000 | Overcast day;[5] typical TV studio lighting
# 10,000–25,000 | Full daylight (not direct sun)[5]
# 32,000–100,000 | Direct sunlight
# ----- TEMPERATURE / PRESSURE SENSOR -----
# OLD WHIT TX
# Module: ASAIR AM2301
# Specifications: Voltage: 3.3 ~ 5.2V / Operational Range: Temperature: -40 ~ +80°C Humidity: 0~100% / Resolution: Humidity: 0.1%RH, Temperature 0.1°C / Accuracy: Temperature: +-1°C Humidity: +-3% / Sample period: 2s
# Circuit: Interface: one wire SDA
# Power consumption: Dormancy: 15μA / Measuring: 500μA / Average: 300μA / whit multimeter 760μA
# Measure after enable min. 2s
#am2301_pin: GPIO13
# NEW WHIT I2C
# Module: BMP280 - pressure / temperature
# Specifications: Voltage: 1.8 ~ 3.6V / Operational Range: Temperature: -40 ~ +85°C Pressure: 300~1100 hPa / Accuracy: Temperature: +-0.01°C Pressure: +-1.3Pa
# Circuit: Interface: I2C address: 0x77
# Power consumption: normal: 0.4mA measure: 0.7mA sleep: 0.2μA
# Cabling: yellow: vcc / brown: gnd / green: sda / white: scl
# ----- HUMIDITY SENSOR -----
# Module: AHT22 - humidity / temperature
# Specifications: Voltage: 2.0 ~ 5.5V / Operational Range: Temperature: -40 ~ +85°C Humidity: 0~100% / Accuracy: Temperature: +-0.3°C Humidity: 0.2%RH
# Circuit: Interface: I2C address: 0x33
# Power consumption: normal: 0.25μA measure: 23μA
# Cabling: yellow: vcc / brown: gnd / green: sda / white: scl
# Module: Dallas DS18B20
# Circuit: 4.7kΩ resistor data pin to VCC
# Power consumption: 50uA
# Measure: Soil
# UPDATE AFTER BOOT: 1s
dallas_pin: GPIO14
# ----- UPDATE TIME -----
update_interval: never
stabilize_time: 2300ms
#-------------------------------------------
# PROTOCOLS
#-------------------------------------------
# Circuit: I2C 4.7k pullup
# ----- PROTOCOLS PINS -----
# I2C
i2c_sda: GPIO04
i2c_scl: GPIO05
# ----- PROTOCOLS SETTINGS -----
i2c:
sda: $i2c_sda
scl: $i2c_scl
scan: False
dallas:
- pin: "$dallas_pin"
update_interval: 10s # Does not work component.update
#-------------------------------------------
# ESP main settings
#-------------------------------------------
# preferences:
# flash_write_interval: 10min # reduce writings to the flash to preserve its health, adjust it on demand
esphome:
name: ${device_name}
project:
name: "studiotiim.plant-garden"
version: 2023.05.1.1.0
platform: esp8266
board: esp12e
platformio_options:
board_build.f_cpu: 80000000L
on_boot:
- priority: 900.0
then:
# Wake up info
- lambda: |-
id(wake_up_reason) = ESP.getResetInfoPtr()->reason;
# Thanks: https://www.homeassistant-cz.cz/viewtopic.php?t=257&hilit=ldo&sid=40796e1ff02dc925e2c1f1bd375a9918&start=20
# OTA UPDATE: 4
# WAKE DEEP SLEEP: 5
# RESET: 6
# POWER ON: 0
- priority: 600.0
then:
# control battery status
- switch.turn_on: switch_measure_battery
- delay: 55ms
- if:
condition:
sensor.in_range:
id: battery_temp_global
below: 3.5
then:
deep_sleep.enter: deep_sleep_component
- priority: 300.0
then:
# wait mqtt
- wait_until:
condition: mqtt.connected
timeout: 30s
- text_sensor.template.publish: # Send online state when mqtt is connected
id: online_status
state: "Online"
# prevent enter deepsleep on boot user switch sleep/loop measure button
- if:
condition:
- lambda: "return id(wake_up_reason) == 4;"
then:
- switch.turn_on: deepsleep_switch
# measure after boot
- if:
condition:
switch.is_off: deepsleep_switch
then:
- switch.turn_on: switch_measure_sensors
- light.turn_on: indicatorled
- delay: 50ms
- light.turn_off: indicatorled
- component.update: soil_moisture
- component.update: ambient_light
- component.update: signal_strange
- delay: $stabilize_time
- component.update: temp_air1
- component.update: temp_air2
- component.update: soil_moisture
# prevent enter deepsleep on boot user switch sleep/loop measure button
- if:
condition:
not:
- lambda: "return id(wake_up_reason) == 4;"
then:
- delay: 10ms
- switch.turn_off: switch_measure_sensors
on_shutdown: # send offline state when mcu power off or go to deep sleep
priority: 0.0 # tested more settings the server does not always receive the value
then:
- text_sensor.template.publish:
id: online_status
state: "Offline"
# Enable logging
logger:
#-------------------------------------------
# MQTT
#-------------------------------------------
mqtt:
broker: '192.168.31.212'
username: !secret mqtt_username
password: !secret mqtt_password
discovery: true
reboot_timeout: 30s
# online first message
birth_message:
topic: $device_name/status_on
payload: online
# drop connected message
will_message:
topic: $device_name/status_unavailable
payload: unavailable
# offline last message
shutdown_message:
topic: $device_name/status_off
payload: offline
# OTA message
on_message:
- topic: "$device_name/ota_mode"
payload: 'ON'
then:
- deep_sleep.prevent: deep_sleep_component
- switch.turn_on: deepsleep_switch
- logger.log: "OTA blocking deep sleep"
- topic: $device_name/ota_mode
payload: 'OFF'
then:
- logger.log: "Ota finished back to deep sleep allow"
- deep_sleep.allow: deep_sleep_component
ota:
password: !secret ota_pass
on_end:
then:
- mqtt.publish:
topic: $device_name/ota_mode
payload: 'OFF'
retain: true
#-------------------------------------------
# WIFI
#-------------------------------------------
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
#power_save_mode: light
fast_connect: True
#output_power: 8.5dB
manual_ip:
static_ip: 192.168.31.222
gateway: 192.168.31.1
subnet: 255.255.255.0
ap:
ssid: "$device_name Hotspot"
password: "passplantgarden"
captive_portal:
#-------------------------------------------
# GLOBALS
#-------------------------------------------
globals:
#-------------------------------------------
# Global set wake up
#-------------------------------------------
- id: wake_up_reason
type: int
restore_value: no
initial_value: '0'
#-------------------------------------------
# Restore global battery value
#-------------------------------------------
- id: battery_global_value
type: float
restore_value: yes
initial_value: '4.0'
#-------------------------------------------
# DEEP SLEEP
#-------------------------------------------
deep_sleep:
id: deep_sleep_component
sleep_duration: 3600sec
run_duration: 30sec
#-------------------------------------------
# STATUS LED
#-------------------------------------------
status_led:
pin:
number: ${status_led}
inverted: True
#-------------------------------------------
# SENSORS
#-------------------------------------------
sensor:
#-------------------------------------------
# Uptime
#-------------------------------------------
- platform: uptime
device_class: duration
name: ${friendly_name} Uptime Sensor
id: time_since_boot
#update_interval: 60s
#-------------------------------------------
# Who enable MCU
#-------------------------------------------
- platform: template
name: "${friendly_name} Who enable"
id: kdo_mne_budi
accuracy_decimals: 0
internal: true
lambda: |-
return (id(wake_up_reason));
on_value:
- if:
condition:
lambda: return id(kdo_mne_budi).state;
then:
- if:
condition:
lambda: "return id(wake_up_reason) == 4;"
then:
text_sensor.template.publish:
id: start_enable
state: "OTA"
- if:
condition:
lambda: "return id(wake_up_reason) == 5;"
then:
text_sensor.template.publish:
id: start_enable
state: "DEEP SLEEP"
- if:
condition:
lambda: "return id(wake_up_reason) == 6;"
then:
text_sensor.template.publish:
id: start_enable
state: "RESET"
#- if:
# condition:
# lambda: "return id(wake_up_reason) == 0;"
# then:
# text_sensor.template.publish:
# id: start_enable
# state: "POWER"
else:
text_sensor.template.publish:
id: start_enable
state: "POWER"
#-------------------------------------------
# Wifi signal component
#-------------------------------------------
- platform: wifi_signal
name: "${friendly_name} MCU Signal"
id: "signal_strange"
update_interval: never
#-------------------------------------------
# ADC - Battery
# 2x Supercap 5.5V 22F
#-------------------------------------------
- platform: adc
pin: $battery_pin
name: "${friendly_name} Voltage Battery"
id: battery
update_interval: never
unit_of_measurement: "V"
accuracy_decimals: 2
filters:
- multiply: 5.75
on_value:
then:
- component.update: battery_percent
- globals.set:
id: battery_global_value
value: !lambda 'return x;'
device_class: battery
entity_category: diagnostic
icon: mdi:home-battery
#-------------------------------------------
# Template - Battery percent
#-------------------------------------------
- platform: template
name: "${friendly_name} Battery"
unit_of_measurement: "%"
id: battery_percent
update_interval: never
lambda: "return id(battery).state;"
filters:
- calibrate_linear:
- 3.4 -> 0
- 5.0 -> 100
- lambda: 'return max((float)0.0, x);' # No value lower than 0
- lambda: 'return min((float)100.0, x);' # No value greater than 100
device_class: battery
entity_category: diagnostic
#-------------------------------------------
# Template - Battery global set
#-------------------------------------------
- platform: template
name: "${friendly_name} Battery global"
id: battery_temp_global
accuracy_decimals: 1
lambda: |-
return (id(battery_global_value));
internal: true
#-------------------------------------------
# Ambient light sensor - LUX sensor - BH1750
#-------------------------------------------
- platform: bh1750
name: "${friendly_name} Outdoor Illuminance"
address: 0x23
accuracy_decimals: 0
update_interval: never
id: ambient_light
device_class: illuminance
#-------------------------------------------
# Temperature pressure sensor - BMP280
#-------------------------------------------
- platform: bmp280
id: temp_air1
temperature:
name: "${friendly_name} Outdoor Temperature"
oversampling: 1x
pressure:
name: "${friendly_name} Outdoor Pressure"
oversampling: 1x
address: 0x77
update_interval: never
#-------------------------------------------
# Temperature humidity sensor - AHT22
#-------------------------------------------
- platform: aht10
id: temp_air2
temperature:
id: temp_aht
internal: True
humidity:
name: "${friendly_name} Outdoor Humidity"
id: humidity_sensor
update_interval: never
#-------------------------------------------
# DALLAS - Temperature sensor
# DS18B20
# connected 4.7k to VCC
#-------------------------------------------
# Temperature solar panel
- platform: dallas
address: 0xa13c24f648b38e28
name: "${friendly_name} Soil Temperature"
id: temp_soil
unit_of_measurement: "°C"
icon: mdi:thermometer
filters:
filter_out: nan
#-------------------------------------------
# PULSE COUNTER - Soil moisture sensor
#-------------------------------------------
- platform: pulse_counter
pin: $moisture_pwm_pin
name: "${friendly_name} Soil Moisture"
id: soil_moisture
update_interval: never
unit_of_measurement: "%"
accuracy_decimals: 1
icon: mdi:water-percent
filters:
- calibrate_linear:
- 310000.0 -> 0
- 33000.0 -> 100
- lambda: 'return max((float)0.0, x);' # No value lower than 0
- lambda: 'return min((float)100.0, x);' # No value greater than 100
on_value:
if:
condition:
switch.is_off: deepsleep_switch
then:
- text_sensor.template.publish:
id: online_status
state: "Offline"
- delay: 1150ms
- deep_sleep.enter: deep_sleep_component
#-------------------------------------------
# SWITCHES
#-------------------------------------------
switch:
#-------------------------------------------
# Deep Sleep and continual measure enable switch
#-------------------------------------------
- platform: template
name: "${friendly_name} Sleep/Loop Measure"
#icon: mdi:power-sleep
icon: mdi:move-resize-variant
id: deepsleep_switch
entity_category: config
optimistic: True
on_turn_on:
then:
- deep_sleep.prevent: deep_sleep_component
- logger.log:
format: "DEEP SLEEP DISABLE"
level: warn
- switch.turn_on: switch_measure_sensors
on_turn_off:
then:
- logger.log:
format: "DEEP SLEEP ENABLE"
level: warn
- switch.turn_off: switch_measure_sensors
- delay: 2s
- deep_sleep.enter: deep_sleep_component
#-------------------------------------------
# Power mofset switch
# DALLAS, MOISTURE
#-------------------------------------------
- platform: gpio
name: "${friendly_name} Measure Sensors"
icon: mdi:move-resize-variant
restore_mode: ALWAYS_OFF
pin: $power_pin
id: switch_measure_sensors
entity_category: config
internal: true
#-------------------------------------------
# Power mofset switch
# BATTERY
#-------------------------------------------
- platform: gpio
name: "${friendly_name} Measure Battery"
id: switch_measure_battery
restore_mode: ALWAYS_OFF
pin: GPIO13
entity_category: config
on_turn_on:
then:
- delay: 50ms
- component.update: battery
- switch.turn_off: switch_measure_battery
#-------------------------------------------
# BUTTONS
#-------------------------------------------
button:
#-------------------------------------------
# RESTART
# restart = reset prevent deepsleep
#-------------------------------------------
- platform: restart
name: "${friendly_name} MCU Restart"
entity_category: diagnostic
#-------------------------------------------
# INTERVALS - measurement cycling battery
#-------------------------------------------
interval:
# cycling measure
- interval: 5s
then:
- if:
condition:
- switch.is_on: deepsleep_switch
then:
- switch.turn_on: switch_measure_battery
- component.update: ambient_light
- component.update: signal_strange
- component.update: temp_air1
- component.update: temp_air2
- component.update: soil_moisture
# led status blinking
- interval: 2s
then:
- if:
condition:
mqtt.connected
then:
- light.turn_on: indicatorled
- delay: 50ms
- light.turn_off: indicatorled
#-------------------------------------------
# TEXT SENSORS
#-------------------------------------------
text_sensor:
#-------------------------------------------
# Defines who started esp
#-------------------------------------------
- platform: template
name: "${friendly_name} MCU Enable"
id: start_enable
icon: "mdi:power-standby"
entity_category: diagnostic
lambda: return {"Loading"};
update_interval: never
#-------------------------------------------
# Online state mcu
# bug no send online or offline does always state
#-------------------------------------------
- platform: template
id: online_status
name: "${friendly_name} MCU Status"
lambda: |-
return {"Loading"};
icon: "mdi:power-standby"
update_interval: never
entity_category: diagnostic
#-------------------------------------------
# BINARY SENSORS
#-------------------------------------------
binary_sensor:
#-------------------------------------------
# LIGHT
#-------------------------------------------
light:
#-------------------------------------------
# Led Red - infolight
#-------------------------------------------
- platform: binary
name: "${friendly_name} Led Indicator"
output: indicator_led
id: indicatorled
internal: True
restore_mode: ALWAYS_OFF
#-------------------------------------------
# OUTPUTS
#-------------------------------------------
output:
#LED
- id: indicator_led
platform: gpio
pin: "$indicator_led"
inverted: True
EDIT: úprava kódu + zmena na kapacitny senzor pôdy.
EDIT2:
- Pridaný riadiačný štít
- Úprava kódu pre korekntné posielanie hodnôt vlhkosti pôdy
- Vyzerá to tak, že bude treba dať väčši kondenzátor nakoľko vydrži celú noc ale svietilo celý den slnko. Uvidíme správanie sa počas oblačnosti a hlavne už je letný čas v zime by to senzor nedával.
EDIT3:
- nahradený svetelny senzor temt6000 za i2c bh1750
- nahradený teplotny senzor am3201 za aht22 + bmp280
- odstránený adc ads1115 senzor
- meranie iba napätia na supercap
- úprava kóde beh teraz iba 12s
- tiimsvk
- Dárce - Donátor
- Příspěvky: 801
- Registrován: 06. květen 2021, 07:03
- Dal poděkování: 72 poděkování
- Dostal poděkování: 65 poděkování
Re: esp8266 a superkapacitor
Dnes som spravíl menši/väčši upgrade na pôdnom senzore:
- všetky i2c zariadenia som prehodil na mofset nakoľko aj pri deepsleep mode esp8266 malo zariadenie spotrebu okolo 17mA (táto spotreba bola predovšetkým na senzore jasu)
- nakoľko som neprišiel na to ako po nahodení esp8266 po spánku oneskoriť aj nahodenie i2c tak pin na zapnutie mofsetu je hneď po štarte a vipne sa pred uspaním
- ďalej neviem z akého dôvodu sa senzory neaktualizuju manualne čiže po spustení component.update predovšetkým pôdna sonda potrebuje 2x aktualizaciu s 100ms offsetom a svetelný senzor bh1750 bez nastavenia update_interval vobec nefungovala.
- vymenil som krabičku ta predošla dobre netesnila a kondenzovala v nej voda
- pri pôdnom snezore som zistil, že je potrebný aspoň jeden den v ustálenej pôde aby začal dobre ukazovať vlhkost.
Teraz spotreba, ktorú neviem presne zmerať multimetrom nakoľko esp8266 nevie fungovať po pripojení merania prúdu tak len to čo som výčital z vyrobeného domáceho zdroja je spotreba menej ako 100uA.
Nevadí idem testovať výdrž
Tu je nový kód:
- všetky i2c zariadenia som prehodil na mofset nakoľko aj pri deepsleep mode esp8266 malo zariadenie spotrebu okolo 17mA (táto spotreba bola predovšetkým na senzore jasu)
- nakoľko som neprišiel na to ako po nahodení esp8266 po spánku oneskoriť aj nahodenie i2c tak pin na zapnutie mofsetu je hneď po štarte a vipne sa pred uspaním
- ďalej neviem z akého dôvodu sa senzory neaktualizuju manualne čiže po spustení component.update predovšetkým pôdna sonda potrebuje 2x aktualizaciu s 100ms offsetom a svetelný senzor bh1750 bez nastavenia update_interval vobec nefungovala.
- vymenil som krabičku ta predošla dobre netesnila a kondenzovala v nej voda
- pri pôdnom snezore som zistil, že je potrebný aspoň jeden den v ustálenej pôde aby začal dobre ukazovať vlhkost.
Teraz spotreba, ktorú neviem presne zmerať multimetrom nakoľko esp8266 nevie fungovať po pripojení merania prúdu tak len to čo som výčital z vyrobeného domáceho zdroja je spotreba menej ako 100uA.
Nevadí idem testovať výdrž
Tu je nový kód:
Kód: Vybrat vše
#-------------------------------------------
# BUG AND REPAIR AND PLANNED
#-------------------------------------------
# control power consumption
#-------------------------------------------
# REVISION
#-------------------------------------------
# 2023.05.1.1.0
# - replace AMS2301 by BME280
# - replace TEMT600 by BH1750
# - disconnect ADS1115
# - measure only supercap voltage on ADC pin
#-------------------------------------------
# SUBTITUTIONS - basic definitions and description of the device
#-------------------------------------------
substitutions:
device_name: plant-garden
friendly_name: Plant-Garden
created_by: StudioTiiM 2023
device_description: "Soil sensor measure weather and soil powered supercap and solar"
#-------------------------------------------
# POWER CONSUMPTION - whit multimeter
# not yet measured.
# partial consumption below
#-------------------------------------------
# Power consumption 3.3V
# First booting MCU:
# Booting MCU after connected to mqtt:
# Measure sensors:
# Normal: > 68 mA ~ 12s
# Deep sleep: >19µA 3600s
#-------------------------------------------
# DEFINE PINS AND VARIABILES
# CIRCUIT AND MODULES - basic definitions and description of the device
#-------------------------------------------
# ----- MCU -----
# Module: Ai-Thinker ESP8266-12F
# Circuit: Solder on adapter esp8266
# Power Consumption: Peak ~ 330mA / Normal wifi: 120 ~ 170mA / Normal: ~ 70mA / DeepSleep: ~ 20μA
# Specification: Chip Family: ESP8266 / Chip Model: ESP8266EX / Chip ID: 00BC7BB7 / MAC Address: A4:E5:7C:BC:7B:B7 / Number of Cores: 1 / CPU Frequency: 80MHz / Ram: 80kB / Flash: 1Mb
# Description pins:
# PINS ESP8266 | FUNCTION | INPUT | OUTPUT | ADC | PWM | I2C(only one) | SPI | RESISTOR | BOOT | FLASH | HIGH AT BOOT | BOOT FAILS |
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
# EN | | 10.0k PULLUP adapter | |
# RST | | 12.0k PULLUP internal| |
# ADC0 A0 | ANALOG ADC0 | | | OK | | | | | | | |
# GPIO0 D3 | STRAPPING | OK! | OK! | | OK | OK | | 10.0k PULLUP | PULLUP | pulldown | HIGH 110ms*6 | LOW
# GPIO01 TX | TX | OK!*1 | OK | | OK | OK | | | | | HIGH | LOW
# GPIO02 D4 | ON BOARD LED | OK | OK | | OK | OK | | 10.0k PULLUP | PULLUP | | HIGH 70ms*6 | LOW
# GPIO03 RX | RX | OK | OK!*1 | | OK | OK | | | | | HIGH |
# GPIO04 D2 | SDA | OK | OK | | OK | OK*2 | | | | | |
# GPIO05 D1 | SCL | OK | OK | | OK | OK*2 | | | | | |
# GPIO06 | INTERNAL SPI | | | | | | CLK | | | | |
# GPIO07 | INTERNAL SPI | | | | | | MISO | | | | |
# GPIO08 | INTERNAL SPI | | | | | | MOSI | | | | |
# GPIO09 | INTERNAL SPI | | | | | | HD | | | | HIGH |
# GPIO10 | INTERNAL SPI | | | | | | WP | | | | HIGH |
# GPIO11 | SPI CSC/CMD | | | | | | CS | | | | |
# GPIO12 D6 | | OK | OK | | OK | OK | MISO | | | | HIGH 110ms |
# GPIO13 D7 | | OK | OK | | OK | OK | MOSI | | | | HIGH 110ms |
# GPIO14 D5 | | OK | OK | | OK | OK | SCLK | | | | HIGH 110ms |
# GPIO15 D8 | STRAPPING | OK! | OK! | | OK | OK | CS | 10k PULLDOWN adapter | PULLDOWN | | LOW 110ms | HIGH
# GPIO16 D0 | STRAPPING | OK*4 | OK*5 | | OK | OK | | 470 -> RST*3 | PULLUP | PULLUP | HIGH 110ms*5 |
# *1 Disable hardware uart. logger baud_rate: 0
# *2 recommended I2C
# *3 Enable deep sleep
# *4 No interrupt
# *5 after boot falls ~110ms to ~ 1V
# *6 oscillates
# GPIO08 and GPIO09 pulldown invalid on boot
# Current draw 12mA max per GPIO
# ESP8266 GPIO Behaviour at Boot: https://rabbithole.wwwdotorg.org/2017/03/28/esp8266-gpio.html
# ----- ELECTRICITY -----
# ----- POWER SUPPLY -----
# Module: Super capacitor
# Specification: 2.7V 22F
# Circuit: 2x connected in series out 5V
# Converting energy:
# F - mAh
# mAh = (F * Delta V / 3600) * 1000 = (22 * 2 /3600) * 1000 = 12.2mAh
# Teoretical Life on SuperCap:
# Battery Capacity: 12.2mAh
# Voltage: 3.3V
# Running Time: 12s
# Running current: 80mA
# Idle Time: 3584s
# Idle Current: 20μA
# Average Consumption: 375.5μA
# Battery Life: 1.353d
# Watt-hours: 40.26mWh
# ADC Voltage supercap
battery_pin: A0
battery_measure_pin: GPIO13
# -----------------
# ADC reading whit transistor
# Enable bipolar transistor: 2N3906 PNP and 2N7000 mofset NPN
# Base resistor calculate:
# hFE: 60
# iL (load A): 0.001A
# Vi (base): 3.3V
# Base resistor: Vi/(iL/hFE)/1000 = 3.3/(0.001/60)/1000 = 198kΩ => 220kΩ
# -----------------
# ----- SOLAR PANEL -----
# Module: Solar panel 2Wp polycrystalline 5V
# Specification: Pmax 2W / Voltage Vmp: 5.0V Voc: 5.0V / Imp: 400mA Isc: 400mA / dimension: 94x157x2mm / Operating temperature: -40 ~ +85°C / Wafer: class A polysilicon / Process: EVA lamination
# Circuit: protected shotky diode 1N5817 drop 0.2V
width_panel: "0.07" # m
height_panel: "0.14" # m
# ----- SUPERVISOR -----
# Module: LMS33460 3V under voltage detector
# Specification: Vin 0.8 ~ 7V / open drain out / SC70-5 package / Out current 30mA /
# Power consumption: disable 35µA / enable 45µA
# Settings:
# Default: Falling 2.85 ~ 3.15V / Rising (change using divider): 0.095 ~ 0.215V / Delay time: 70 ~ 130µs
# Circuit:
# Voltage divider: Supercap -> Protect diode 1N5817 -> VCC -> Trim 103 (7.07kΩ) -> In -> 100kΩ -> GND (VCC -> 470kΩ -> Out)
# Mofset: Logic power mofset NPN FQP30N06L Gate -> 220Ω -> Out supervisor
# HYSTERESIS OFF ON
# SuperCAP: 3.3V 3.56V
# ----- LDO -----
# Module: Holtek HT7833
# Specification: Voltage in 0 ~ 8V out fixed 3.3V 2% / max voltage drop 360mV / current max 0.5A /
# Protection: overtemperature / current limiting
# Power consumption: Quiescent current 4µA
# Circuit: VIN -> 2x ceramic 10μF -> GND / VOUT -> PPTC FUSE 0.5A 6V -> VOUT / VOUT -> 470μF 6.3V + 680μF 25V -> GND
# ----- LEDS -----
# Modul: Status led
# Specification: on esp board smd red led
# Modification: remove on board led and solder red whit additional 1KΩ resistor (+ on board 470Ω - down power consumption)
# Power consumption: 328µA
status_led: GPIO02
# Modul: led red diode
# Specification: red led 3mm
# Circuit: GPIO -> LED -> 2kΩ -> VCC(after deep sleep no light on)
# Power consumption: 500µA
indicator_led: GPIO0
# ----- POWER SENSORS -----
# Modul: NPN power transistor 2N7000
# Specification: power all measure modules (reduction of consumption)
# Circuit: GND -> Collector / GPIO -> 1kΩ -> Base / Emitter -> GND out sensor
power_pin: GPIO15
# ----- SOIL MOISTURE SENSOR -----
# OLD WHIT MOISTURE ADC
# Module: Soil moisture sensor
# Specification: Voltage 3.3 ~ 12V / Current working: 20mA, Output 30mA / Dimension: 36x15x7 mm / PCB module whit LM393 comparator
# Modification: unsolder leds (reducer consumption)
# Power consumption: 1.6mA
# Settings:
#moisture_dry: 3.0V
#moisture_wet: 1.85V
#moisture_adc_pin: A0_GND
#moisture_enable_pin: GPIO12
#moisture_stabilize_time: 15s
# NEW WHIT PWM SIGNAL INPUT
# Module: Capacitive Soil Moisture Sensor v2.0
# Specification: Voltage 3.3 ~ 5.5V / Current working: 4.5mA / Dimension: 99x16 mm / PCB module whit TLC555 timer
# Modification: https://thecavepearlproject.org/2020/10/27/hacking-a-capacitive-soil-moisture-sensor-for-frequency-output/
# Unsolder all smd chips on board
# Create new circuit on PCB whit LMC555 timer
# Output PWM signal
# Power consumption: 1.6µA
# Settings:
moisture_dry: 35kHz
moisture_wet: 10kHz
# No stabilization time
# dry sand: 246kHz
# middle wet soil: 210kHz
# Whit 1 day stabilization time:
# Dry > 35 000
# Wet < 10 000
moisture_pwm_pin: GPIO12
# How to measure moisture soil:
# https://www.mdpi.com/1424-8220/21/15/5110
# https://thecavepearlproject.org/2020/10/27/hacking-a-capacitive-soil-moisture-sensor-for-frequency-output/
# https://makersportal.com/blog/2020/5/26/capacitive-soil-moisture-calibration-with-arduino
# ----- AMBIENT LIGHT SENSOR -----
# OLD WHIT ADC
# Module: TEMT6000
# Specification: Voltage max. 6V / silicon NPN epitaxial planar phototransistor / Operating Temperature: -40 ~ +85°C / Angle of Half sensitivity: 60° / Wavelength of Peak Sensitivity: 570nm / Range of Spectral Bandwidth: 360 ~ 970nm
# Conection: on module GND -> 10kΩ -> GPIO -> NPN -> VCC
# Power consumption: 20mA (change whit intensity light)
# Measure and formula calculate lux https://devices.esphome.io/devices/temt6000
# I = adc_value/10000kΩ
# The datasheet for the TEMT6000 specifies a proportional correlation between current and illuminance: Every 2 µA of current correlates to 1 lx in the illuminance.
#temt6000_resistor: "10000" #Ω
#temt6000_amps: "2000000" #mA
# max lux = 3.3V * 2000000 /10000 = 660lux / we adjust as much as possible using the cover
# No real calibration is currently used.
# Calibration designed for the exterior.
#temt6000_adc_pin: A1_GND
# NEW WHIT I2C
# Module: BH1750 GY-302 lux meter
# Specifications: 3V ~ 3.6V / Range: 1 ~ 65 535 lx
# Circuit: Interface: I2C address: 0x23
# Consumption: normal 4.4mA
# Modification: unsolder ldo 602K
# http://wiki.sunfounder.cc/index.php?title=GY-302_BH1750_Digital_Light_Intensity_Module
# LUX wiki
# Illuminance (lux) | Surfaces illuminated by
# -----------------------------------------------
# 0.0001 | Moonless, overcast night sky (starlight)[5]
# 0.002 | Moonless clear night sky with airglow[5]
# 0.05–0.3 | Full moon on a clear night[6]
# 3.4 | Dark limit of civil twilight under a clear sky[7]
# 20–50 | Public areas with dark surroundings[8]
# 50 | Family living room lights (Australia, 1998)[9]
# 80 | Office building hallway/toilet lighting[10][11]
# 100 | Very dark overcast day[5]
# 150 | Train station platforms[12]
# 320–500 | Office lighting[9][13][14][15]
# 400 | Sunrise or sunset on a clear day.
# 1000 | Overcast day;[5] typical TV studio lighting
# 10,000–25,000 | Full daylight (not direct sun)[5]
# 32,000–100,000 | Direct sunlight
# ----- TEMPERATURE / HUMIDITY / PRESSURE SENSOR -----
# OLD WHIT TX
# Module: ASAIR AM2301
# Specifications: Voltage: 3.3 ~ 5.2V / Operational Range: Temperature: -40 ~ +80°C Humidity: 0~100% / Resolution: Humidity: 0.1%RH, Temperature 0.1°C / Accuracy: Temperature: +-1°C Humidity: +-3% / Sample period: 2s
# Circuit: Interface: one wire SDA
# Power consumption: Dormancy: 15μA / Measuring: 500μA / Average: 300μA / whit multimeter 760μA
# Measure after enable min. 2s
#am2301_pin: GPIO13
# OLD WHIT I2C
# Module: BMP280 - pressure / temperature
# Specifications: Voltage: 1.8 ~ 3.6V / Operational Range: Temperature: -40 ~ +85°C Pressure: 300~1100 hPa / Accuracy: Temperature: +-0.01°C Pressure: +-1.3Pa
# Circuit: Interface: I2C address: 0x77
# Power consumption: normal: 0.4mA measure: 0.7mA sleep: 0.2μA
# Cabling: yellow: vcc / brown: gnd / green: sda / white: scl
# Module: AHT22 - humidity / temperature
# Specifications: Voltage: 2.0 ~ 5.5V / Operational Range: Temperature: -40 ~ +85°C Humidity: 0~100% / Accuracy: Temperature: +-0.3°C Humidity: 0.2%RH
# Circuit: Interface: I2C address: 0x33
# Power consumption: normal: 0.25μA measure: 23μA
# Cabling: yellow: vcc / brown: gnd / green: sda / white: scl
# NEW WHIT I2C
# Module: HTU21D - humidity / temperature
# Specifications: Voltage: 1.5 ~ 3.6V / Operational Range: Temperature: -40 ~ +125°C Humidity: 0~100% / Accuracy: Temperature: +-0.3°C Humidity: +-2%RH
# Circuit: Interface: I2C address: 0x40
# Power consumption: measure: 0.5mA sleep: 0.1μA
# Cabling: yellow: vcc / brown: gnd / green: sda / white: scl
# Module: Dallas DS18B20
# Circuit: 4.7kΩ resistor data pin to VCC
# Power consumption: 50uA
# Measure: Soil
# UPDATE AFTER BOOT: 1s
dallas_pin: GPIO14
# ----- UPDATE TIME -----
update_interval: never
stabilize_time: 8000ms
#-------------------------------------------
# PROTOCOLS
#-------------------------------------------
# Circuit: I2C 4.7k pullup
# ----- PROTOCOLS PINS -----
# I2C
i2c_sda: GPIO04
i2c_scl: GPIO05
# ----- PROTOCOLS SETTINGS -----
dallas:
- pin: "$dallas_pin"
update_interval: 2s # Does not work component.update
#-------------------------------------------
# ESP main settings
#-------------------------------------------
# preferences:
# flash_write_interval: 10min # reduce writings to the flash to preserve its health, adjust it on demand
esphome:
name: ${device_name}
project:
name: "studiotiim.plant-garden"
version: 2023.09.4.1.0
platform: esp8266
board: esp12e
platformio_options:
board_build.f_cpu: 80000000L
on_boot:
#- priority: 1000
# then:
# - lambda: |-
# pinMode(15, OUTPUT);
# digitalWrite(15, HIGH);
# delay(100);
- priority: 900.0
then:
# Wake up info
- lambda: |-
id(wake_up_reason) = ESP.getResetInfoPtr()->reason;
# Thanks: https://www.homeassistant-cz.cz/viewtopic.php?t=257&hilit=ldo&sid=40796e1ff02dc925e2c1f1bd375a9918&start=20
# OTA UPDATE: 4
# WAKE DEEP SLEEP: 5
# RESET: 6
# POWER ON: 0
- priority: 800.0
then:
# control battery status
- switch.turn_on: switch_measure_battery
- delay: 55ms
- if:
condition:
sensor.in_range:
id: battery_temp_global
below: 3.5
then:
- switch.turn_off: switch_measure_sensors
- delay: 50ms
- deep_sleep.enter: deep_sleep_component
#else:
#- switch.turn_on: switch_measure_sensors
#- delay: 100ms
#- lambda: |-
# Wire.begin();
#delay(100);
#solves the problem with BH1750
- priority: 300.0
then:
# prevent enter deepsleep on boot user switch sleep/loop measure button
- if:
condition:
- lambda: "return id(wake_up_reason) == 4;" #ota
then:
- switch.turn_on: deepsleep_switch
- wifi.enable:
# measure after boot
- if:
condition:
switch.is_off: deepsleep_switch
then:
- light.turn_on: indicatorled
- delay: 50ms
- light.turn_off: indicatorled
- delay: $stabilize_time
- wifi.enable:
# wait mqtt
- wait_until:
condition: mqtt.connected
timeout: 30s
- text_sensor.template.publish: # Send online state when mqtt is connected
id: online_status
state: "Online"
- delay: 350ms
# - component.update: soil_moisture
- logger.log: "signal"
- component.update: signal_strange
- logger.log: "temp_air"
- component.update: temp_air1
- logger.log: "temp_soil"
- component.update: temp_soil
- delay: 100ms
- logger.log: "light1"
- component.update: ambient_light
- delay: 100ms
- logger.log: "light2"
- component.update: ambient_light
- logger.log: "soil1"
- component.update: soil_moisture
- delay: 100ms
- logger.log: "light3"
- component.update: ambient_light
- logger.log: "soil2"
- component.update: soil_moisture
#- delay: 1s
#- component.update: soil_moisture
# prevent enter deepsleep on boot user switch sleep/loop measure button
- if:
condition:
not:
- lambda: "return id(wake_up_reason) == 4;"
then:
- delay: 10ms
- switch.turn_off: switch_measure_sensors
on_shutdown: # send offline state when mcu power off or go to deep sleep
priority: 0.0 # tested more settings the server does not always receive the value
then:
- text_sensor.template.publish:
id: online_status
state: "Offline"
# Enable logging
logger:
#-------------------------------------------
# MQTT
#-------------------------------------------
mqtt:
broker: '192.168.31.212'
username: !secret mqtt_username
password: !secret mqtt_password
discovery: true
reboot_timeout: 60s
# online first message
birth_message:
topic: $device_name/status_on
payload: online
# drop connected message
will_message:
topic: $device_name/status_unavailable
payload: unavailable
# offline last message
shutdown_message:
topic: $device_name/status_off
payload: offline
# OTA message
on_message:
- topic: "$device_name/ota_mode"
payload: 'ON'
then:
- deep_sleep.prevent: deep_sleep_component
- switch.turn_on: deepsleep_switch
- logger.log: "OTA blocking deep sleep"
- topic: $device_name/ota_mode
payload: 'OFF'
then:
- logger.log: "Ota finished back to deep sleep allow"
- deep_sleep.allow: deep_sleep_component
ota:
password: !secret ota_pass
on_end:
then:
- mqtt.publish:
topic: $device_name/ota_mode
payload: 'OFF'
retain: true
#-------------------------------------------
# WIFI
#-------------------------------------------
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
#power_save_mode: light
enable_on_boot: false
fast_connect: True
#output_power: 8.5dB
manual_ip:
static_ip: 192.168.31.222
gateway: 192.168.31.1
subnet: 255.255.255.0
ap:
ssid: "$device_name Hotspot"
password: "passplantgarden"
captive_portal:
#-------------------------------------------
# GLOBALS
#-------------------------------------------
globals:
#-------------------------------------------
# Global set wake up
#-------------------------------------------
- id: wake_up_reason
type: int
restore_value: no
initial_value: '0'
#-------------------------------------------
# Restore global battery value
#-------------------------------------------
- id: battery_global_value
type: float
restore_value: yes
initial_value: '4.0'
#-------------------------------------------
# DEEP SLEEP
#-------------------------------------------
deep_sleep:
id: deep_sleep_component
sleep_duration: 3600sec
run_duration: 60sec
#-------------------------------------------
# STATUS LED
#-------------------------------------------
status_led:
pin:
number: ${status_led}
inverted: True
#-------------------------------------------
# SENSORS
#-------------------------------------------
sensor:
#-------------------------------------------
# Uptime
#-------------------------------------------
- platform: uptime
device_class: duration
name: ${friendly_name} Uptime Sensor
id: time_since_boot
#update_interval: 60s
#-------------------------------------------
# Who enable MCU
#-------------------------------------------
- platform: template
name: "${friendly_name} Who enable"
id: kdo_mne_budi
accuracy_decimals: 0
internal: true
lambda: |-
return (id(wake_up_reason));
on_value:
- if:
condition:
lambda: return id(kdo_mne_budi).state;
then:
- if:
condition:
lambda: "return id(wake_up_reason) == 4;"
then:
text_sensor.template.publish:
id: start_enable
state: "OTA"
- if:
condition:
lambda: "return id(wake_up_reason) == 5;"
then:
text_sensor.template.publish:
id: start_enable
state: "DEEP SLEEP"
- if:
condition:
lambda: "return id(wake_up_reason) == 6;"
then:
text_sensor.template.publish:
id: start_enable
state: "RESET"
#- if:
# condition:
# lambda: "return id(wake_up_reason) == 0;"
# then:
# text_sensor.template.publish:
# id: start_enable
# state: "POWER"
else:
text_sensor.template.publish:
id: start_enable
state: "POWER"
#-------------------------------------------
# Wifi signal component
#-------------------------------------------
- platform: wifi_signal
name: "${friendly_name} MCU Signal"
id: "signal_strange"
update_interval: never
#-------------------------------------------
# ADC - Battery
# 2x Supercap 5.5V 22F
#-------------------------------------------
- platform: adc
pin: $battery_pin
name: "${friendly_name} Voltage Battery"
id: battery
update_interval: never
unit_of_measurement: "V"
accuracy_decimals: 2
filters:
- multiply: 5.75
on_value:
then:
- component.update: battery_percent
- globals.set:
id: battery_global_value
value: !lambda 'return x;'
#device_class: battery
entity_category: diagnostic
icon: mdi:home-battery
#-------------------------------------------
# Template - Battery percent
#-------------------------------------------
- platform: template
name: "${friendly_name} Battery"
unit_of_measurement: "%"
id: battery_percent
update_interval: never
lambda: "return id(battery).state;"
filters:
- calibrate_linear:
- 3.5 -> 0 # 3.4
- 5.0 -> 100
- lambda: 'return max((float)0.0, x);' # No value lower than 0
- lambda: 'return min((float)100.0, x);' # No value greater than 100
device_class: battery
entity_category: diagnostic
#-------------------------------------------
# Template - Battery global set
#-------------------------------------------
- platform: template
name: "${friendly_name} Battery global"
id: battery_temp_global
accuracy_decimals: 1
lambda: |-
return (id(battery_global_value));
internal: true
#-------------------------------------------
# Ambient light sensor - LUX sensor - BH1750
#-------------------------------------------
- platform: bh1750
name: "${friendly_name} Outdoor Illuminance"
address: 0x23
accuracy_decimals: 0
update_interval: 10s
id: ambient_light
device_class: illuminance
#-------------------------------------------
# Temperature pressure sensor - HTU21D
#-------------------------------------------
- platform: htu21d
id: temp_air1
temperature:
name: "${friendly_name} Outdoor Temperature"
humidity:
name: "${friendly_name} Outdoor Humidity"
update_interval: 2s
#-------------------------------------------
# DALLAS - Temperature sensor
# DS18B20
# connected 4.7k to VCC
#-------------------------------------------
# Temperature solar panel
- platform: dallas
address: 0xa13c24f648b38e28
name: "${friendly_name} Soil Temperature Raw"
id: temp_soil_dallas
#unit_of_measurement: "°C"
#icon: mdi:thermometer
filters:
filter_out: nan
#internal: True
- platform: template
name: "${friendly_name} Soil Temperature"
id: temp_soil
unit_of_measurement: "°C"
icon: mdi:thermometer
lambda: "return id(temp_soil_dallas).state;"
update_interval: never
#-------------------------------------------
# PULSE COUNTER - Soil moisture sensor
#-------------------------------------------
- platform: pulse_counter
pin: $moisture_pwm_pin
name: "${friendly_name} Soil Moisture"
id: soil_moisture
update_interval: never
unit_of_measurement: "%"
accuracy_decimals: 0
icon: mdi:water-percent
filters:
- calibrate_linear:
- 35000.0 -> 0
- 10000.0 -> 100
- lambda: 'return max((float)0.0, x);' # No value lower than 0
- lambda: 'return min((float)100.0, x);' # No value greater than 100
on_raw_value:
- if:
condition:
sensor.in_range:
id: soil_moisture
below: 45000 # opraviť
then:
text_sensor.template.publish:
id: soil_status
state: "In Soil"
else:
text_sensor.template.publish:
id: soil_status
state: No Soil / Stable 1 Day
- if:
condition:
switch.is_off: deepsleep_switch
then:
- text_sensor.template.publish:
id: online_status
state: "Offline"
- delay: 1150ms
- deep_sleep.enter: deep_sleep_component
#-------------------------------------------
# SWITCHES
#-------------------------------------------
switch:
#-------------------------------------------
# Deep Sleep and continual measure enable switch
#-------------------------------------------
- platform: template
name: "${friendly_name} Sleep/Loop Measure"
#icon: mdi:power-sleep
icon: mdi:move-resize-variant
id: deepsleep_switch
restore_mode: DISABLED
entity_category: config
optimistic: True
on_turn_on:
then:
- deep_sleep.prevent: deep_sleep_component
- logger.log:
format: "DEEP SLEEP DISABLE"
level: warn
- wifi.enable:
#- switch.turn_on: switch_measure_sensors
on_turn_off:
then:
- logger.log:
format: "DEEP SLEEP ENABLE"
level: warn
- switch.turn_off: switch_measure_sensors
- delay: 2s
- deep_sleep.enter: deep_sleep_component
#-------------------------------------------
# Power mofset switch
# DALLAS, MOISTURE
#-------------------------------------------
- platform: gpio
name: "${friendly_name} Measure Sensors"
icon: mdi:move-resize-variant
restore_mode: ALWAYS_ON
pin: $power_pin
id: switch_measure_sensors
entity_category: config
internal: true
#-------------------------------------------
# Power mofset switch
# BATTERY
#-------------------------------------------
- platform: gpio
name: "${friendly_name} Measure Battery"
id: switch_measure_battery
restore_mode: ALWAYS_OFF
pin: GPIO13
entity_category: config
on_turn_on:
then:
- delay: 50ms
- component.update: battery
- switch.turn_off: switch_measure_battery
#-------------------------------------------
# BUTTONS
#-------------------------------------------
button:
#-------------------------------------------
# RESTART
# restart = reset prevent deepsleep
#-------------------------------------------
- platform: restart
name: "${friendly_name} MCU Restart"
entity_category: diagnostic
#-------------------------------------------
# INTERVALS - measurement cycling battery
#-------------------------------------------
interval:
# cycling measure
- interval: 5s
then:
- if:
condition:
- switch.is_on: deepsleep_switch
then:
- switch.turn_on: switch_measure_battery
- component.update: ambient_light
- component.update: signal_strange
- component.update: temp_air1
- component.update: soil_moisture
- component.update: temp_soil
# led status blinking
- interval: 2s
then:
- if:
condition:
mqtt.connected
then:
- light.turn_on: indicatorled
- delay: 50ms
- light.turn_off: indicatorled
#-------------------------------------------
# TEXT SENSORS
#-------------------------------------------
text_sensor:
#-------------------------------------------
# Soil Moisture
#-------------------------------------------
- platform: template
name: "${friendly_name} Soil status"
icon: mdi:flower
id: soil_status
lambda: |-
return {"Loading"};
update_interval: never
#-------------------------------------------
# Defines who started esp
#-------------------------------------------
- platform: template
name: "${friendly_name} MCU Enable"
id: start_enable
icon: "mdi:power-standby"
entity_category: diagnostic
lambda: return {"Loading"};
update_interval: never
#-------------------------------------------
# Online state mcu
# bug no send online or offline does always state
#-------------------------------------------
- platform: template
id: online_status
name: "${friendly_name} MCU Status"
lambda: |-
return {"Loading"};
icon: "mdi:power-standby"
update_interval: never
entity_category: diagnostic
#-------------------------------------------
# BINARY SENSORS
#-------------------------------------------
binary_sensor:
#-------------------------------------------
# LIGHT
#-------------------------------------------
light:
#-------------------------------------------
# Led Red - infolight
#-------------------------------------------
- platform: binary
name: "${friendly_name} Led Indicator"
output: indicator_led
id: indicatorled
internal: True
restore_mode: ALWAYS_OFF
#-------------------------------------------
# OUTPUTS
#-------------------------------------------
output:
#LED
- id: indicator_led
platform: gpio
pin: "$indicator_led"
inverted: True
# ----- PROTOCOLS SETTINGS -----
i2c:
sda: $i2c_sda
scl: $i2c_scl
scan: True
-
- Moderátor
- Příspěvky: 901
- Registrován: 03. červenec 2021, 18:35
- Dal poděkování: 107 poděkování
- Dostal poděkování: 210 poděkování
Re: esp8266 a superkapacitor
Zkus tam nějak zaimplementovat I2C reset - SCL devětkrát on off, na cca nastavené frekvenci I2C (běžně 400 kHz )
Nevím jak s časováním - asi nacpat někam do on_boot části s hodnotou priority ideálně kdy už bude dostupné GPIO ale ještě ne I2C - pokud taková existuje
Nevím jak s časováním - asi nacpat někam do on_boot části s hodnotou priority ideálně kdy už bude dostupné GPIO ale ještě ne I2C - pokud taková existuje
Vše co si přinesu domů je buď Shelly, nebo to skončí buď pod ESPhome nebo pod Zigbee2mqtt.
Ajťák co pamatuje BBS a OS/2 Warp a je mu jedno o jaký systém nebo síťařinu běží.
HA OS jako jedna z Proxmox VM na Odroid H3+/64GB https://github.com/tteck/Proxmox
Ajťák co pamatuje BBS a OS/2 Warp a je mu jedno o jaký systém nebo síťařinu běží.
HA OS jako jedna z Proxmox VM na Odroid H3+/64GB https://github.com/tteck/Proxmox
-
- Nováček na fóru
- Příspěvky: 4
- Registrován: 10. září 2023, 15:49
- Dal poděkování: 1 poděkování
Re: esp8266 a superkapacitor
Ak máš Instagram tak skus si pozrieť toto https://www.instagram.com/mohitbhoite/
- tiimsvk
- Dárce - Donátor
- Příspěvky: 801
- Registrován: 06. květen 2021, 07:03
- Dal poděkování: 72 poděkování
- Dostal poděkování: 65 poděkování
Re: esp8266 a superkapacitor
To s tym resetom mtslus nieco v tomto zmysle?kiklhorn píše: ↑09. září 2023, 17:48 Zkus tam nějak zaimplementovat I2C reset - SCL devětkrát on off, na cca nastavené frekvenci I2C (běžně 400 kHz )
Nevím jak s časováním - asi nacpat někam do on_boot části s hodnotou priority ideálně kdy už bude dostupné GPIO ale ještě ne I2C - pokud taková existuje
https://community.home-assistant.io/t/e ... p/402980/3 na konci s digital write a lambdou?
Ale zadefinovat gpio pin pre scl zapnutie a vipnute s frekvenciou ako pises? Teda ten presny zapis si neviem predstavit.
Co sa týka priority i2c sa spusti asi zaroven s gpio musim vyskusat
PS s tymto nastavenim ktore mam vyssie je za noc v dnesnom obdobi pokles 5.5V na 4.6V ( pri 3.7 3.6 sa modul uz nespusti) uvidim co to bude robit v zime v zamracenom pocasi (ak to da celu noc aj pri zlych podmienkach tak asi to netreba tahat potom do extremnej uspory)
- tiimsvk
- Dárce - Donátor
- Příspěvky: 801
- Registrován: 06. květen 2021, 07:03
- Dal poděkování: 72 poděkování
- Dostal poděkování: 65 poděkování
Re: esp8266 a superkapacitor
Skúsil som teda reset i2c pomocou tohto:
Nejak som zlepil niečo čo som načital na iunternete samozrejme nefunguje to pri botovani dlho trva pokial nacita i2c a pri pripojení napajania sa zariadenie nerozbehne.
Skúšam manualne resetovanie kedykolvek pocas behu esp
frekvenciu mam nastavenu na 100khz
Este nejaky link kde su drobne informacie http://www.forward.com.au/pfod/ArduinoP ... index.html[/url]
Kód: Vybrat vše
- platform: template
name: "${friendly_name} Reset i2c"
on_press:
then:
- lambda: |-
ESP_LOGI("display", "Starting I2C bus recovery...");
delay(2000);
pinMode(4, OUTPUT);//keeping SDA high during recovery
digitalWrite(4, HIGH);
pinMode(5, OUTPUT);
for (int i = 0; i < 10; i++) { //9nth cycle acts as NACK
digitalWrite(5, HIGH);
delayMicroseconds(5);
digitalWrite(5, LOW);
delayMicroseconds(5);
}
ESP_LOGI("display", "bus recovery done, starting scan in 2 secs");
pinMode(4, INPUT);
pinMode(5, INPUT);
delay(2000);
Wire.begin(5);
Wire.begin(4);
Skúšam manualne resetovanie kedykolvek pocas behu esp
frekvenciu mam nastavenu na 100khz
Este nejaky link kde su drobne informacie http://www.forward.com.au/pfod/ArduinoP ... index.html[/url]
- tiimsvk
- Dárce - Donátor
- Příspěvky: 801
- Registrován: 06. květen 2021, 07:03
- Dal poděkování: 72 poděkování
- Dostal poděkování: 65 poděkování
Re: esp8266 a superkapacitor
Ešte na ofiko fore mi poradili toto ešte som to neskúšal:
Kód: Vybrat vše
- lambda: |-
Wire.end();
delay(500);
Wire.begin();
- tiimsvk
- Dárce - Donátor
- Příspěvky: 801
- Registrován: 06. květen 2021, 07:03
- Dal poděkování: 72 poděkování
- Dostal poděkování: 65 poděkování
Re: esp8266 a superkapacitor
Ahojte len sa podelim o spotrebu aku som dosiahol pri pouziti 22F 5.5V superkondenzatorov.
Je to naozaj slubne a to dnes skoro celý den zamracene.
Takze odpajanie zariadeni pri spanku modulu vyrazne pomohlo. (GPIO15 + Mofset)
Je to naozaj slubne a to dnes skoro celý den zamracene.
Takze odpajanie zariadeni pri spanku modulu vyrazne pomohlo. (GPIO15 + Mofset)