Привіт, маю проблему з підключенням свого терморегулятора на ардуіні до ESP8266-01, сам новачок в цьому ділі, тому на профільних темах якось соромно питати, але щоб не блукати, прошу допомогти. Я вже як тільки не підключав, максимально чого добився, що з’являється новий вай-фай клієнт, але з ним нічого не конектиться, блимає синенький LED і помилка. На сом-порті або нічого, або тільки пише раз 7 АТ, на введення команд не реагує. Така от ситуація, навіть не знаю що запитувати, мабуть: як підключитись, щоб керувати термостатом через remoteXY?
1. буду пробувати зовнішнє джерело живлення (на данний час 3,3 йде від ардуіни), якщо не допоможе 2. буду пробувати перепрошити...
У меня тоже были проблемы с ЕСПехой, как раз на профильном форуме и помогли https://esp8266.ru/ . Проблема у меня оказалась с переходником, которых я перебрал 3 штуки. Естественно начитавшись про глючные платы грешил и на свою, но всё обошлось.
@Энки, все Китай, плати пробував і мегу, і уно, мега просто навантажена 2.4тфт дисплеем, тому я вирішив, що мабуть не вистачало живлення, живити я пробував від RCWL (доплеровського) датчика, результат однаковий. Бібліотеки FLProgівські. Програмер я ніякий, тому програмую візуально через флпрог, https://gist.github.com/Carambich/2e7668594852fc2f57484d7a09458abf @einshteynn, переходник я не использовал, форум читал и читаю напостой, пишут что должен мигать красный светодиод, у меня мигает только синий, у Вас как? esp01
бібліотека #include <WiFi.h> --- добавлено: Dec 2, 2017 2:49 PM --- піни: VCC - 3.3V RST - в повітрі EN - 3.3V TXD - TXD RXD - через ділитель на RXD IO0 - GND IO2 - в повітрі GRN - GRN на ардуіно RES - GND прошив з прикладів WiFiWebClient, прописав перед завантаженням в скетчі свої мережу і пароль, в роутері нового клієнта немає, чи я щось не правильно розумію?
Апну тему, проробив мій термостат без вай фая 3 зими без нарікань, та ось прийшла черга модернізувати. esp8266-01 не стабільна штукенція, тому спроби зв"язати мегу з вай фаєм покинув, та придбав esp32 (просто бомба), буде без екрану, зате регулювання відбувається з браузера. Та маю проблему, не можу вивести на сторінку показник другого датчика. Спойлер: веб якщо на форумі ще залишились кодери, підправте. будь ласка Спойлер: скетч #ifdef ESP32 #include <WiFi.h> #include <AsyncTCP.h> #else #include <ESP8266WiFi.h> #include <ESPAsyncTCP.h> #endif #include <ESPAsyncWebServer.h> #include <Wire.h> #include <OneWire.h> #include <DallasTemperature.h> // REPLACE WITH YOUR NETWORK CREDENTIALS const char* ssid = "XXXXXXXX"; const char* password = "XXXXXXXX"; // Default Threshold Temperature Value String inputMessage = "22.0"; String lastTemperature; String enableArmChecked = "checked"; String inputMessage2 = "true"; // HTML web page to handle 2 input fields (threshold_input, enable_arm_input) const char index_html[] PROGMEM = R"rawliteral( <!DOCTYPE HTML><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Термостат "Вайланта"</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head><body> <h2>Температура в будинку</h2> <h3>%TEMPERATURE1% °C</h3> <h2>Температура зовні</h2> <h3>%TEMPERATURE2% °C</h3> <h2>Регулювання ESP</h2> <form action="/get"> Температура вмикання <input type="number" step="0.1" name="threshold_input" value="%THRESHOLD%" required><br> Ввімкнення регулювання <input type="checkbox" name="enable_arm_input" value="true" %ENABLE_ARM_INPUT%><br><br> <input type="submit" value="Зберегти"> </form> </body></html>)rawliteral"; void notFound(AsyncWebServerRequest *request) { request->send(404, "text/plain", "Not found"); } AsyncWebServer server(80); // Replaces placeholder with DS18B20 values String processor(const String& var){ //Serial.println(var); if(var == "TEMPERATURE1"){ return lastTemperature; } else if(var == "THRESHOLD"){ return inputMessage; } else if(var == "ENABLE_ARM_INPUT"){ return enableArmChecked; } return String(); } // Flag variable to keep track if triggers was activated or not bool triggerActive = false; const char* PARAM_INPUT_1 = "threshold_input"; const char* PARAM_INPUT_2 = "enable_arm_input"; unsigned long previousMillis = 0; const long interval = 5000; // GPIO where the output is connected to const int output = 17; // GPIO where the DS18B20 is connected to const int oneWireBus = 16; // Setup a oneWire instance to communicate with any OneWire devices OneWire oneWire(oneWireBus); // Pass our oneWire reference to Dallas Temperature sensor DallasTemperature sensors(&oneWire); DeviceAddress sensor1 = {0x28, 0xFF, 0xCE, 0x3A, 0x81, 0x17, 0x5, 0xEF}; DeviceAddress sensor2 = {0x28, 0xFF, 0xA9, 0x3C, 0x81, 0x17, 0x5, 0xA6}; void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); if (WiFi.waitForConnectResult() != WL_CONNECTED) { Serial.println("WiFi Failed!"); return; } Serial.println(); Serial.print("ESP IP Address: http://"); Serial.println(WiFi.localIP()); pinMode(output, OUTPUT); digitalWrite(output, LOW); // Start the DS18B20 sensor sensors.begin(); // Send web page to client server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send_P(200, "text/html", index_html, processor); }); // Receive an HTTP GET request at <ESP_IP>/get?threshold_input=<inputMessage>&enable_arm_input=<inputMessage2> server.on("/get", HTTP_GET, [] (AsyncWebServerRequest *request) { // GET threshold_input value on <ESP_IP>/get?threshold_input=<inputMessage> if (request->hasParam(PARAM_INPUT_1)) { inputMessage = request->getParam(PARAM_INPUT_1)->value(); // GET enable_arm_input value on <ESP_IP>/get?enable_arm_input=<inputMessage2> if (request->hasParam(PARAM_INPUT_2)) { inputMessage2 = request->getParam(PARAM_INPUT_2)->value(); enableArmChecked = "checked"; } else { inputMessage2 = "false"; enableArmChecked = ""; } } Serial.println(inputMessage); Serial.println(inputMessage2); request->send(200, "text/html; charset=utf-8", "HTTP запит надіслано на ESP.<br><a href=\"/\">Повернутися на домашню сторінку</a>"); }); server.onNotFound(notFound); server.begin(); } void loop() { unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) { previousMillis = currentMillis; sensors.requestTemperatures(); // Temperature in Celsius degrees float temperature1 = sensors.getTempC(sensor1); float temperature2 = sensors.getTempC(sensor2); Serial.print(temperature1); Serial.println(" *C"); Serial.print(temperature2); Serial.println(" *C"); // Temperature in Fahrenheit degrees /*float temperature = sensors.getTempFByIndex(0); Serial.print(temperature); Serial.println(" *F");*/ lastTemperature = String(temperature1); // Check if temperature is above threshold and if it needs to trigger output if(temperature1 > inputMessage.toFloat() && inputMessage2 == "true" && !triggerActive){ String message = String("Temperature above threshold. Current temperature: ") + String(temperature1) + String("C"); Serial.println(message); triggerActive = true; digitalWrite(output, HIGH); } // Check if temperature is below threshold and if it needs to trigger output else if((temperature1 < inputMessage.toFloat()) && inputMessage2 == "true" && triggerActive) { String message = String("Temperature below threshold. Current temperature: ") + String(temperature1) + String(" C"); Serial.println(message); triggerActive = false; digitalWrite(output, LOW); } } } код Rui Santosа (українізований мною), за що йому щиро дякую.
Спойлер: Попробуй так #ifdef ESP32 #include <WiFi.h> #include <AsyncTCP.h> #else #include <ESP8266WiFi.h> #include <ESPAsyncTCP.h> #endif #include <ESPAsyncWebServer.h> #include <Wire.h> #include <OneWire.h> #include <DallasTemperature.h> // REPLACE WITH YOUR NETWORK CREDENTIALS const char* ssid = "XXXXXXXX"; const char* password = "XXXXXXXX"; // Default Threshold Temperature Value String inputMessage = "22.0"; String lastTemperature; String lastTemperature_outdoor; //**********// String enableArmChecked = "checked"; String inputMessage2 = "true"; // HTML web page to handle 2 input fields (threshold_input, enable_arm_input) const char index_html[] PROGMEM = R"rawliteral( <!DOCTYPE HTML><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Термостат "Вайланта"</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head><body> <h2>Температура в будинку</h2> <h3>%TEMPERATURE1% °C</h3> <h2>Температура зовні</h2> <h3>%TEMPERATURE2% °C</h3> <h2>Регулювання ESP</h2> <form action="/get"> Температура вмикання <input type="number" step="0.1" name="threshold_input" value="%THRESHOLD%" required><br> Ввімкнення регулювання <input type="checkbox" name="enable_arm_input" value="true" %ENABLE_ARM_INPUT%><br><br> <input type="submit" value="Зберегти"> </form> </body></html>)rawliteral"; void notFound(AsyncWebServerRequest *request) { request->send(404, "text/plain", "Not found"); } AsyncWebServer server(80); // Replaces placeholder with DS18B20 values String processor(const String& var){ //Serial.println(var); if(var == "TEMPERATURE1"){ return lastTemperature; } if(var == "TEMPERATURE2"){ //**********// return lastTemperature_outdoor; //**********// } //**********// else if(var == "THRESHOLD"){ return inputMessage; } else if(var == "ENABLE_ARM_INPUT"){ return enableArmChecked; } return String(); } // Flag variable to keep track if triggers was activated or not bool triggerActive = false; const char* PARAM_INPUT_1 = "threshold_input"; const char* PARAM_INPUT_2 = "enable_arm_input"; unsigned long previousMillis = 0; const long interval = 5000; // GPIO where the output is connected to const int output = 17; // GPIO where the DS18B20 is connected to const int oneWireBus = 16; // Setup a oneWire instance to communicate with any OneWire devices OneWire oneWire(oneWireBus); // Pass our oneWire reference to Dallas Temperature sensor DallasTemperature sensors(&oneWire); DeviceAddress sensor1 = {0x28, 0xFF, 0xCE, 0x3A, 0x81, 0x17, 0x5, 0xEF}; DeviceAddress sensor2 = {0x28, 0xFF, 0xA9, 0x3C, 0x81, 0x17, 0x5, 0xA6}; void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); if (WiFi.waitForConnectResult() != WL_CONNECTED) { Serial.println("WiFi Failed!"); return; } Serial.println(); Serial.print("ESP IP Address: http://"); Serial.println(WiFi.localIP()); pinMode(output, OUTPUT); digitalWrite(output, LOW); // Start the DS18B20 sensor sensors.begin(); // Send web page to client server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send_P(200, "text/html", index_html, processor); }); // Receive an HTTP GET request at <ESP_IP>/get?threshold_input=<inputMessage>&enable_arm_input=<inputMessage2> server.on("/get", HTTP_GET, [] (AsyncWebServerRequest *request) { // GET threshold_input value on <ESP_IP>/get?threshold_input=<inputMessage> if (request->hasParam(PARAM_INPUT_1)) { inputMessage = request->getParam(PARAM_INPUT_1)->value(); // GET enable_arm_input value on <ESP_IP>/get?enable_arm_input=<inputMessage2> if (request->hasParam(PARAM_INPUT_2)) { inputMessage2 = request->getParam(PARAM_INPUT_2)->value(); enableArmChecked = "checked"; } else { inputMessage2 = "false"; enableArmChecked = ""; } } Serial.println(inputMessage); Serial.println(inputMessage2); request->send(200, "text/html; charset=utf-8", "HTTP запит надіслано на ESP.<br><a href=\"/\">Повернутися на домашню сторінку</a>"); }); server.onNotFound(notFound); server.begin(); } void loop() { unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) { previousMillis = currentMillis; sensors.requestTemperatures(); // Temperature in Celsius degrees float temperature1 = sensors.getTempC(sensor1); float temperature2 = sensors.getTempC(sensor2); Serial.print(temperature1); Serial.println(" *C"); Serial.print(temperature2); Serial.println(" *C"); // Temperature in Fahrenheit degrees /*float temperature = sensors.getTempFByIndex(0); Serial.print(temperature); Serial.println(" *F");*/ lastTemperature = String(temperature1); lastTemperature_outdoor = String(temperature2); //**********// // Check if temperature is above threshold and if it needs to trigger output if(temperature1 > inputMessage.toFloat() && inputMessage2 == "true" && !triggerActive){ String message = String("Temperature above threshold. Current temperature: ") + String(temperature1) + String("C"); Serial.println(message); triggerActive = true; digitalWrite(output, HIGH); } // Check if temperature is below threshold and if it needs to trigger output else if((temperature1 < inputMessage.toFloat()) && inputMessage2 == "true" && triggerActive) { String message = String("Temperature below threshold. Current temperature: ") + String(temperature1) + String(" C"); Serial.println(message); triggerActive = false; digitalWrite(output, LOW); } } } отсебятина обозначена //**********//
Дякую, з віком наука дається все тяжче, от би з'явилися ці контролери на років 25-30 раніше, коли було більше часу на хобі