I am doing an internship project for some of the hoophouse vegetable growers in my area. They are interested in have a temperature alarm to let them know when the hoophouse gets too hot or cold, their hoophouses are out of wifi and bluetooth range, and they’d like to see the data online and have a temperature alert sent to their phones as well. My experience is pretty limited but I wanted to try and do it.
I decided to go with a radio transmitter since the hoophouses are not super close to the house. The overall plan has been to have a temperature sensor (AHT20 but may switch to SHT-30) connected to an Arduino Uno and a RFM69HCW radio transmitter to transmit the temperature to another RFM69HCW at the house, also connected to an arduino uno. A Piezo Buzzer and red LED go off when temp is too low or high.
Right now all of the above is working. The temp is transmitted by radio, displayed on an LCD in the house, and an alarm goes off if it’s too hot or cold. (code attached below is tester for wifi issues, current working code is not attached).
I also want to send this information to Thingspeak so that the data can be tracked, and I’m also hoping to send SMS alerts to peoples phones if their hoophouse is overheating or too cold.
I bought an ESP8266 Huzzah board from Adafruit thinking it would be a good for the wifi connection and would connect to the Arduino Uno at the house (I also have the FTDI cable if needed). Adafruit HUZZAH ESP8266 Breakout : ID 2471 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Currently the Huzzah ESP8266 is not connecting to the internet. My code gets stuck on ‘reconnecting’. There are no lights (blue or red) on the ESP8266 while this is happening. The TX and RX lights on the Arduino UNO do go off though.
I tried playing around with the FTDI and another program earlier, when I did that the blue and red lights on the ESP8266 were going off. Also I am right next to the router, and I know the internet is working well, pw and wifi name are correct, the router is 5 GHz which i’ve read is correct for the ESP8266.
I’ve heard that the arduino takes in the command and may not relay it to the ESP8266, and I think this is my problem, but I’m not sure how to fix it. On older forum posts some people have said remove the MCU of the Uno, but that would mess up my other operations I believe.
Is this why I cannot connect to Wifi, and is there a fix for it?
(Having trouble uploading photo, see attachment)
Note: the Huzzah ESP8266 has a voltage regulator so I can connect the V+ to 5V, and the Rx is 5V compatible. Also I have tried TX-RX, RX-TX.
Per a suggestion on another forum, I've also tried connecting Tx and Rx to different digital pins (6 and 7, because 2 and 3 are being used by the RFM68HCW radio transmitter). That resulted in the same 'reconnecting' issue.
Uno: --- ESP8266:
TX --- TX
Rx --- RX
5V --- V+
3.3V --- EN, RST
GND --- GND
Note: This code is just to test the wifi and connect with Thingspeak.
I took the original code from here: ThingSpeak Arduino Weather Station - Arduino Project Hub, I have not switched their DHT sensor code to mine, as well as a few other things, that shouldn’t be too hard though. I just need to get past the wifi stuff first.
Serial.print(" nnn ");
Serial.begin(9600); //Start with baud 9600
startTime = millis();
Serial.println("Connecting to Wifi");
Serial.println("Trying to Reconnect..");
waitTime = millis()-startTime;
if (waitTime > (writingTimer*1000))
startTime = millis();
//temp_f = dht.readTemperature();
//humidity = dht.readHumidity();
// temp_f = temp.temperature();
//humidity = humidity.relative_humidity();
float temp = 5; //faking sensor data to test wifi
float humid = 6; //faking sensor data to test wifi
// preparacao da string GET
String getStr = "GET /update?api_key=";
getStr += myAPIkey;
getStr += String(temp);
getStr += String(humid);
getStr += "\r\n\r\n";
String cmd = "AT+CIPSTART=\"TCP\",\"";
cmd += "18.104.22.168"; // api.thingspeak.com IP address
cmd += "\",80";
Serial.print("Start Commands: ");
String GetThingspeakcmd(String getStr)
String cmd = "AT+CIPSEND=";
cmd += String(getStr.length());
String messageBody = "";
String line = ESP8266.readStringUntil('\n');
if (line.length() == 1)
messageBody = ESP8266.readStringUntil('\n');
Serial.print("MessageBody received: ");
12:55:21.090 -> ⸮ Connecting to Wifi
12:55:24.654 -> ....Trying to Reconnect..
12:55:44.774 -> ....Trying to Reconnect..
12:56:04.923 -> ....Trying to Reconnect..
12:56:25.087 -> ....Trying to Reconnect..
12:56:45.223 -> .
Thank you for any help!