Re: Making a combi project using esp8266 and arduino uno
Posted: Sat Feb 18, 2017 4:51 am
Thanks a lot to you all I'll try all these changes tomorrow so I'll let you know then
-->
Open Community Forum for ESP8266, Come share Arduino and IoT (Internet of Things)
https://www.esp8266.com/
gdsports wrote:There are two sets of ssid/password. ESP-DHT has the DHT sensor and it must connect to ESP-AP. ESP-AP is an AP with its own ssid/password, different from your home wifi router ssid/password. When the ESP-AP sends data to thingspeak on the Internet, it must connect to your home wifi router so it must know that pair as well.1-For the ssid part should I put my own network's ssid?
In the AP mode INO file look for the function setupStMode. Inside this function modify WiFi.begin() so it has the ssid/password of your home wifi router.Code: Select allWiFi.begin("myhomessid", "myhomepassword");
2-And there are sections with stars like(*********) which of them I must edit?
In the AP mode INO file modify the following lines. The ssid must be different from your home router ssid.Code: Select all// Internet router credentials
const char* ssid = "ESPAP";
const char* password = "ESPAPsecret";
The ESP-DHT client must connect to the ESP-AP so the ssid/password in the client program must match the ssid/password in the AP program.Code: Select all// AP Wi-Fi credentials
const char* ssid = "ESPAP";
const char* password = "ESPAPsecret";3-For example wifi.begin() has stars. It ll stay with stars or I must enter my ssid and password there?
Change the stars as described above.
I have never used these programs so this is just a best guess. You will just have to try and see if these changes work or not.
martinayotte wrote:It is not clear what is your question.
Is it only to add gpio code to turn on relay ?
if yes, is it according to the temperature send to handle_feed() callback ?
Maybe something like this from your AP :Code: Select all// Handling the /feed page from my server
void handle_feed() {
String t = server.arg("temp");
String h = server.arg("hum");
server.send(200, "text/plain", "This is response to client");
setupStMode(t, h);
// new code added here for the relay
long temp = t.toFloat();
if (temp < 20.0)
digitalWrite(2, HIGH); // Turn ON Relay on GPIO2
else
digitalWrite(2, LOW); // Turn OFF Relay on GPIO2
}
You also need to add in setup :Code: Select allpinMode(2, OUTPUT); // Make GPIO2 as an OUTPUT to drive Relay MOSFET
– got back to sleep