mirror of https://github.com/arendst/Tasmota.git
Supports for MQ analog sensor for air quality
It's support the analog sensor for quality air (also for esp-32) -added on list of assignable pins in module -with adcparams can choose wich mqx you have with seconds param ex: adcparam 10 4 (you have the mq-04)
This commit is contained in:
parent
33ff4fa056
commit
e72248899e
|
@ -872,6 +872,7 @@ const char HTTP_SNS_CURRENT[] PROGMEM = "{s}" D_CURRENT "{
|
|||
const char HTTP_SNS_POWER[] PROGMEM = "{s}" D_POWERUSAGE "{m}%s " D_UNIT_WATT "{e}";
|
||||
const char HTTP_SNS_ENERGY_TOTAL[] PROGMEM = "{s}" D_ENERGY_TOTAL "{m}%s " D_UNIT_KILOWATTHOUR "{e}";
|
||||
const char HTTP_SNS_PH[] PROGMEM = "{s}%s " D_PH "{m}%s " "{e}";
|
||||
const char HTTP_SNS_MQ[] PROGMEM = "{s}" D_MQ"-%s" "{m}%s " D_UNIT_PARTS_PER_MILLION "{e}";
|
||||
const char HTTP_SNS_ORP[] PROGMEM = "{s}%s " D_ORP "{m}%s " D_UNIT_MILLIVOLT "{e}";
|
||||
const char HTTP_SNS_EC[] PROGMEM = "{s}%s " D_EC "{m}%s " D_UNIT_MICROSIEMENS_PER_CM "{e}";
|
||||
const char HTTP_SNS_O2[] PROGMEM = "{s}%s " D_O2 "{m}%s " D_UNIT_PERCENT "{e}";
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Wagwoord"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Poort"
|
||||
#define D_POWER_FACTOR "Krag faktor"
|
||||
#define D_POWERUSAGE "Krag"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Парола"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Порт"
|
||||
#define D_POWER_FACTOR "Фактор на мощността"
|
||||
#define D_POWERUSAGE "Мощност"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Heslo"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Účiník"
|
||||
#define D_POWERUSAGE "Příkon"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Passwort"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Leistungsfaktor"
|
||||
#define D_POWERUSAGE "Leistung"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Κωδικός"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Θύρα"
|
||||
#define D_POWER_FACTOR "Συντελεστής Ισχύος"
|
||||
#define D_POWERUSAGE "Ισχύς"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Password"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Power Factor"
|
||||
#define D_POWERUSAGE "Power"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Clave"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Puerto"
|
||||
#define D_POWER_FACTOR "Factor de Potencia"
|
||||
#define D_POWERUSAGE "Potencia"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Potencia"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Mot de passe"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Fact de puiss"
|
||||
#define D_POWERUSAGE "Puissance"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Manette"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Wachtwurd"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Poort"
|
||||
#define D_POWER_FACTOR "Krêftfaktor"
|
||||
#define D_POWERUSAGE "Krêft"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "סיסמא"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "פורט"
|
||||
#define D_POWER_FACTOR "גורם כוח"
|
||||
#define D_POWERUSAGE "כוח"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Jelszó"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Teljesítménytényező"
|
||||
#define D_POWERUSAGE "Energiafelhasználás"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "비밀번호"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "포트"
|
||||
#define D_POWER_FACTOR "Power Factor"
|
||||
#define D_POWERUSAGE "전원"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Wachtwoord"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Poort"
|
||||
#define D_POWER_FACTOR "Arbeidsfactor"
|
||||
#define D_POWERUSAGE "Vermogen"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Hasło"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Cosinus fi"
|
||||
#define D_POWERUSAGE "Moc"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC Moc CT"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Dżojstik"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Senha"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Porta"
|
||||
#define D_POWER_FACTOR "Fator de potência"
|
||||
#define D_POWERUSAGE "Potência"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Palavra Chave"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Porta"
|
||||
#define D_POWER_FACTOR "Factor de Potência"
|
||||
#define D_POWERUSAGE "Potência"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Parolă"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Factor de Putere"
|
||||
#define D_POWERUSAGE "Putere"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Пароль"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Порт"
|
||||
#define D_POWER_FACTOR "Коэффициент мощности"
|
||||
#define D_POWERUSAGE "Мощность"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Heslo"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Účinník"
|
||||
#define D_POWERUSAGE "Príkon"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Lösenord"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Spänningsfaktor"
|
||||
#define D_POWERUSAGE "Spänning"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Şifre"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Güç Faktörü"
|
||||
#define D_POWERUSAGE "Güç"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Гасло"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Порт"
|
||||
#define D_POWER_FACTOR "Коефіцієнт потужності"
|
||||
#define D_POWERUSAGE "Потужність"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "Mật khẩu"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "Cổng"
|
||||
#define D_POWER_FACTOR "Hệ số công suất"
|
||||
#define D_POWERUSAGE "Công suất"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "密码"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "端口"
|
||||
#define D_POWER_FACTOR "功率因数"
|
||||
#define D_POWERUSAGE "功率"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#define D_ORP "ORP"
|
||||
#define D_PASSWORD "密碼"
|
||||
#define D_PH "pH"
|
||||
#define D_MQ "MQ"
|
||||
#define D_PORT "通訊埠"
|
||||
#define D_POWER_FACTOR "功率因數"
|
||||
#define D_POWERUSAGE "用電量"
|
||||
|
@ -788,6 +789,7 @@
|
|||
#define D_SENSOR_ADC_CT_POWER "ADC CT Power"
|
||||
#define D_SENSOR_ADC_JOYSTICK "ADC Joystick"
|
||||
#define D_SENSOR_ADC_PH "ADC pH"
|
||||
#define D_SENSOR_ADC_MQ "ADC MQ"
|
||||
#define D_GPIO_WEBCAM_PWDN "CAM_PWDN"
|
||||
#define D_GPIO_WEBCAM_RESET "CAM_RESET"
|
||||
#define D_GPIO_WEBCAM_XCLK "CAM_XCLK"
|
||||
|
|
|
@ -180,6 +180,7 @@ enum UserSelectablePins {
|
|||
GPIO_SOLAXX1_RTS, // Solax Inverter Serial interface
|
||||
GPIO_OPTION_E, // Emulated module
|
||||
GPIO_SDM230_TX, GPIO_SDM230_RX, // SDM230 Serial interface
|
||||
GPIO_ADC_MQ, // Analog MQ Sensor
|
||||
GPIO_SENSOR_END };
|
||||
|
||||
enum ProgramSelectablePins {
|
||||
|
@ -399,7 +400,8 @@ const char kSensorNames[] PROGMEM =
|
|||
D_SENSOR_SOLAXX1_RTS "|"
|
||||
D_SENSOR_OPTION " E|"
|
||||
D_SENSOR_SDM230_TX "|" D_SENSOR_SDM230_RX
|
||||
;
|
||||
D_SENSOR_ADC_MQ "|"
|
||||
;
|
||||
|
||||
const char kSensorNamesFixed[] PROGMEM =
|
||||
D_SENSOR_USER;
|
||||
|
@ -973,6 +975,7 @@ const uint16_t kGpioNiceList[] PROGMEM = {
|
|||
AGPIO(GPIO_ADC_CT_POWER) + MAX_ADCS, // Current
|
||||
AGPIO(GPIO_ADC_JOY) + MAX_ADCS, // Joystick
|
||||
AGPIO(GPIO_ADC_PH) + MAX_ADCS, // Analog PH Sensor
|
||||
AGPIO(GPIO_ADC_MQ) + MAX_ADCS, // Analog MQ Sensor
|
||||
#endif // ESP32
|
||||
|
||||
#ifdef USE_SHIFT595
|
||||
|
@ -999,6 +1002,7 @@ const uint16_t kAdcNiceList[] PROGMEM = {
|
|||
AGPIO(GPIO_ADC_CT_POWER), // Current
|
||||
AGPIO(GPIO_ADC_JOY), // Joystick
|
||||
AGPIO(GPIO_ADC_PH), // Analog PH Sensor
|
||||
AGPIO(GPIO_ADC_MQ), // Analog MQ Sensor
|
||||
};
|
||||
#endif // ESP8266
|
||||
|
||||
|
@ -1014,6 +1018,7 @@ enum UserSelectableAdc {
|
|||
ADC_CT_POWER, // Current
|
||||
ADC_JOY, // Joystick
|
||||
ADC_PH, // Analog PH Sensor
|
||||
ADC_MQ, // Analog MQ Sensor
|
||||
// ADC_SWITCH, // Switch
|
||||
// ADC_SWITCH_INV,
|
||||
ADC_END };
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#define ANALOG_RESOLUTION 10 // 12 = 4095, 11 = 2047, 10 = 1023
|
||||
#define ANALOG_RANGE 1023 // 4095 = 12, 2047 = 11, 1023 = 10
|
||||
#define ANALOG_PERCENT 10 // backward compatible div10 range
|
||||
#define ANALOG_BOARD "ESP8266"
|
||||
#endif // ESP8266
|
||||
#ifdef ESP32
|
||||
#undef ANALOG_RESOLUTION
|
||||
|
@ -36,6 +37,8 @@
|
|||
#define ANALOG_RANGE 4095 // 4095 = 12, 2047 = 11, 1023 = 10
|
||||
#undef ANALOG_PERCENT
|
||||
#define ANALOG_PERCENT ((ANALOG_RANGE + 50) / 100) // approximation to 1% ADC range
|
||||
#undef ANALOG_BOARD
|
||||
#define ANALOG_BOARD "ESP-32"
|
||||
#endif // ESP32
|
||||
|
||||
#define TO_CELSIUS(x) ((x) - 273.15)
|
||||
|
@ -111,6 +114,30 @@
|
|||
// Multiplier used to store pH with 2 decimal places in a non decimal datatype
|
||||
#define ANALOG_PH_DECIMAL_MULTIPLIER 100.0
|
||||
|
||||
//means mq type (ex for mq-02 use 2, mq-131 use 131)
|
||||
#define ANALOG_MQ_TYPE 2
|
||||
//exponential regression a params
|
||||
#define ANALOG_MQ_A 574.25
|
||||
//exponential regression b params
|
||||
#define ANALOG_MQ_B -2.222
|
||||
/*
|
||||
Exponential regression:
|
||||
Gas | a | b
|
||||
LPG | 44771 | -3.245
|
||||
CH4 | 2*10^31| 19.01
|
||||
CO | 521853 | -3.821
|
||||
Alcohol| 0.3934 | -1.504
|
||||
Benzene| 4.8387 | -2.68
|
||||
Hexane | 7585.3 | -2.849
|
||||
NOx | -462.43 | -2.204
|
||||
CL2 | 47.209 | -1.186
|
||||
O3 | 23.943 | -1.11
|
||||
*/
|
||||
//ratio for alarm, NOT USED yet (RS / R0 = 15 ppm)
|
||||
#define ANALOG_MQ_RatioMQCleanAir 15.0
|
||||
// Multiplier used to store pH with 2 decimal places in a non decimal datatype
|
||||
#define ANALOG_MQ_DECIMAL_MULTIPLIER 100.0
|
||||
|
||||
struct {
|
||||
uint8_t present = 0;
|
||||
uint8_t type = 0;
|
||||
|
@ -189,6 +216,12 @@ void AdcInitParams(uint8_t idx) {
|
|||
Adc[idx].param3 = ANALOG_PH_CALSOLUTION_HIGH_PH * ANALOG_PH_DECIMAL_MULTIPLIER; // PH of the calibration solution 2, which is the one with the higher PH
|
||||
Adc[idx].param4 = ANALOG_PH_CALSOLUTION_HIGH_ANALOG_VALUE; // Reading of AnalogInput while probe is in solution 2
|
||||
}
|
||||
else if (ADC_MQ == Adc[idx].type) {
|
||||
Adc[idx].param1 = ANALOG_MQ_TYPE; // Could be MQ-002, MQ-004, MQ-131 ....
|
||||
Adc[idx].param2 = (int)(ANALOG_MQ_A * ANALOG_MQ_DECIMAL_MULTIPLIER); // Exponential regression
|
||||
Adc[idx].param3 = (int)(ANALOG_MQ_B * ANALOG_MQ_DECIMAL_MULTIPLIER); // Exponential regression
|
||||
Adc[idx].param4 = (int)(ANALOG_MQ_RatioMQCleanAir * ANALOG_MQ_DECIMAL_MULTIPLIER); // Exponential regression
|
||||
}
|
||||
}
|
||||
if ((Adcs.type != Adc[idx].type) || (0 == Adc[idx].param1) || (Adc[idx].param1 > ANALOG_RANGE)) {
|
||||
if ((ADC_BUTTON == Adc[idx].type) || (ADC_BUTTON_INV == Adc[idx].type)) {
|
||||
|
@ -234,6 +267,9 @@ void AdcInit(void) {
|
|||
if (PinUsed(GPIO_ADC_PH, i)) {
|
||||
AdcAttach(Pin(GPIO_ADC_PH, i), ADC_PH);
|
||||
}
|
||||
if (PinUsed(GPIO_ADC_MQ, i)) {
|
||||
AdcAttach(Pin(GPIO_ADC_MQ, i), ADC_MQ);
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < MAX_KEYS; i++) {
|
||||
if (PinUsed(GPIO_ADC_BUTTON, i)) {
|
||||
|
@ -334,6 +370,32 @@ uint16_t AdcGetLux(uint32_t idx) {
|
|||
return (uint16_t)ldrLux;
|
||||
}
|
||||
|
||||
float AdcGetMq(uint32_t idx) {
|
||||
float avg = 0.0;
|
||||
int retries = 5;
|
||||
int retries_delay = 20;
|
||||
float _RL = 10; //Value in KiloOhms
|
||||
float _R0 = 10;
|
||||
int _adc = AdcRead(Adc[idx].pin, 2);
|
||||
avg += _adc;
|
||||
for (int i = 0; i < retries-1; i ++) {
|
||||
delay(retries_delay);
|
||||
_adc = AdcRead(Adc[idx].pin, 2);
|
||||
avg += _adc;
|
||||
}
|
||||
float voltage = (avg/ retries) * ANALOG_V33 / ((pow(2, ANALOG_RESOLUTION)) - 1);
|
||||
|
||||
float _RS_Calc = ((ANALOG_V33 * _RL) / voltage) -_RL; //Get value of RS in a gas
|
||||
if (_RS_Calc < 0) _RS_Calc = 0; //No negative values accepted.
|
||||
float _ratio = _RS_Calc / _R0; // Get ratio RS_gas/RS_air
|
||||
float ppm= Adc[idx].param2/ANALOG_MQ_DECIMAL_MULTIPLIER*pow(_ratio, Adc[idx].param3/ANALOG_MQ_DECIMAL_MULTIPLIER); // <- Source excel analisis https://github.com/miguel5612/MQSensorsLib_Docs/tree/master/Internal_design_documents
|
||||
if(ppm < 0) ppm = 0; //No negative values accepted or upper datasheet recomendation.
|
||||
char ppm_chr[6];
|
||||
dtostrfd(ppm, 2, ppm_chr);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "ppm read. ADC-RAW: %d, ppm: %d,"), voltage, ppm_chr);
|
||||
return ppm;
|
||||
}
|
||||
|
||||
float AdcGetPh(uint32_t idx) {
|
||||
int adc = AdcRead(Adc[idx].pin, 2);
|
||||
|
||||
|
@ -575,6 +637,25 @@ void AdcShow(bool json) {
|
|||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
WSContentSend_PD(HTTP_SNS_PH, "", ph_chr);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ADC_MQ: {
|
||||
float mq = AdcGetMq(idx);
|
||||
char mq_chr[6];
|
||||
dtostrfd(mq, 2, mq_chr);
|
||||
|
||||
float mqnumber =Adc[idx].param1;
|
||||
char mqnumber_chr[6];
|
||||
dtostrfd(mqnumber, 0, mqnumber_chr);
|
||||
|
||||
if (json) {
|
||||
AdcShowContinuation(&jsonflg);
|
||||
ResponseAppend_P(PSTR("\"MQ%d_%d\":%s"), Adc[idx].param1, idx + offset, mq_chr);
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
WSContentSend_PD(HTTP_SNS_MQ, mqnumber_chr, mq_chr);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
break;
|
||||
|
@ -638,6 +719,43 @@ void CmndAdcParam(void) {
|
|||
Adc[idx].param1 ^= CT_FLAG_ENERGY_RESET; // Cancel energy reset flag
|
||||
}
|
||||
}
|
||||
if (ADC_MQ == XdrvMailbox.payload) {
|
||||
float a = CharToFloat(ArgV(argument, 3));
|
||||
float b = CharToFloat(ArgV(argument, 4));
|
||||
float ratioMQCleanAir = CharToFloat(ArgV(argument, 5));
|
||||
if (a==0 && b==0 && ratioMQCleanAir==0)
|
||||
{
|
||||
if (Adc[idx].param1==2)
|
||||
{
|
||||
a=574.25;
|
||||
b=-2.222
|
||||
ratioMQCleanAir=9.83
|
||||
}
|
||||
if (Adc[idx].param1==4)
|
||||
{
|
||||
a=1012.7
|
||||
b=-2.786
|
||||
ratioMQCleanAir=4.4
|
||||
}
|
||||
if (Adc[idx].param1==7)
|
||||
{
|
||||
a=99.042
|
||||
b=-1.518
|
||||
ratioMQCleanAir=27.5
|
||||
}
|
||||
if (Adc[idx].param1==131)
|
||||
{
|
||||
a=23.943
|
||||
b=-1.11
|
||||
ratioMQCleanAir=15
|
||||
}
|
||||
}
|
||||
Adc[idx].param2 = (int)(a * ANALOG_MQ_DECIMAL_MULTIPLIER); // Exponential regression
|
||||
Adc[idx].param3 = (int)(b * ANALOG_MQ_DECIMAL_MULTIPLIER); // Exponential regression
|
||||
Adc[idx].param4 = (int)(ratioMQCleanAir * ANALOG_MQ_DECIMAL_MULTIPLIER); // Exponential regression
|
||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "Analog MQ reset: mq%d, a=%2_f, b=%2_f, ratioMQCleanAir=%2_f"),
|
||||
Adc[idx].param1, &a, &b, &ratioMQCleanAir);
|
||||
}
|
||||
} else { // Set default values based on current adc type
|
||||
// AdcParam 2
|
||||
// AdcParam 3
|
||||
|
@ -656,7 +774,7 @@ void CmndAdcParam(void) {
|
|||
// AdcParam
|
||||
AdcGetSettings(idx);
|
||||
Response_P(PSTR("{\"" D_CMND_ADCPARAM "%d\":[%d,%d,%d"), idx +1, Adcs.type, Adc[idx].param1, Adc[idx].param2);
|
||||
if (ADC_RANGE == Adc[idx].type) {
|
||||
if ((ADC_RANGE == Adc[idx].type) || (ADC_MQ == Adc[idx].type)){
|
||||
ResponseAppend_P(PSTR(",%d,%d"), Adc[idx].param3, Adc[idx].param4);
|
||||
} else {
|
||||
int value = Adc[idx].param3;
|
||||
|
|
Loading…
Reference in New Issue