USB-TTL Works with ESP8266, Can't get Arduino to Send AT
Posted: Fri Dec 11, 2015 11:00 pm
I have been diving into Arduino's recently and have built some stuff. I have now discovered the ESP8266 and it is cool and have lost countless hours of sleep to get it working.
Right now, I can connect a USB-TTL serial converter to the ESP8266 (using a 5V to 3V regulator for power and a logic level shift for the I/O pins). I can use the Serial window on the Arduino GUI set at 115200 baudrate and "Both NL & CR" to successfully send AT commands to the ESP8266. I can send commands that update a Thingspeak graph.
Now I would like to automate that process using an Arduino Uno to send the AT commands. I have used the hardware serial (pins 0 and 1) set at 115200 to send the AT commands, and another test using softwareserial at 115200 baud to send AT commands. I can see the blue light flicker when a command is sent in both tests. However, the Thingspeak graph does not receive any data (refreshing webpage does nothing). I'm thinking it is my carriage returns after the AT commands, but have tried multiple scenarios. No success. The ESP8266 is powered and connected to my network and I can ping it from my computer.
Need help in getting the format right for the ESP to receive the AT commands from Arduino Uno.
Here is my code...
I have the ESP8266 already connected to the network so I eliminated setting up the wifi with AT commands in the setup block. Shown below is "TEST 1"... I had 6 other tests following that one which simply change the \r\n\r\n from nothing to \r\n to \r\n\r\n. Blue LED flickers on each println. Using the USB-TTL with both 184.106.153.149 and api.thingspeak.com work to send data to the thingspeak graph. Test 2 (not shown) uses the IP address instead of the web address text... didn't work either.
Thank you for any help!
Right now, I can connect a USB-TTL serial converter to the ESP8266 (using a 5V to 3V regulator for power and a logic level shift for the I/O pins). I can use the Serial window on the Arduino GUI set at 115200 baudrate and "Both NL & CR" to successfully send AT commands to the ESP8266. I can send commands that update a Thingspeak graph.
Now I would like to automate that process using an Arduino Uno to send the AT commands. I have used the hardware serial (pins 0 and 1) set at 115200 to send the AT commands, and another test using softwareserial at 115200 baud to send AT commands. I can see the blue light flicker when a command is sent in both tests. However, the Thingspeak graph does not receive any data (refreshing webpage does nothing). I'm thinking it is my carriage returns after the AT commands, but have tried multiple scenarios. No success. The ESP8266 is powered and connected to my network and I can ping it from my computer.
Need help in getting the format right for the ESP to receive the AT commands from Arduino Uno.
Here is my code...
I have the ESP8266 already connected to the network so I eliminated setting up the wifi with AT commands in the setup block. Shown below is "TEST 1"... I had 6 other tests following that one which simply change the \r\n\r\n from nothing to \r\n to \r\n\r\n. Blue LED flickers on each println. Using the USB-TTL with both 184.106.153.149 and api.thingspeak.com work to send data to the thingspeak graph. Test 2 (not shown) uses the IP address instead of the web address text... didn't work either.
Thank you for any help!
Code: Select all
void setup() {
//ESP8266 communication serial
Serial.begin(115200);
//wait 3 seconds
delay(3000);
}
void loop(){
///////////// TEST 1 ////////////////
String cmd="AT+CIPSTART=4,\"TCP\",\"api.thingspeak.com\",80\r\n\r\n";
Serial.println(cmd);
delay(3000);
cmd="AT+CIPSEND=4,44\r\n\r\n";
Serial.println(cmd);
delay(3000);
cmd = "GET /update?key=BQ5Q9C81TDDWR8VA&field1=1\r\n\r\n";
Serial.println(cmd);
delay(20000);
}