-->
Page 3 of 6

Re: How to read current time from internet using ESP8266?

PostPosted: Fri Oct 16, 2015 9:04 am
by martinayotte
The ESP8266Wifi.h is part of the libraries coming with ArduinoESP.
You can not simply download and copy individual files, you need to install ArduinoESP properly as described in https://github.com/esp8266/Arduino.

Re: How to read current time from internet using ESP8266?

PostPosted: Fri Oct 16, 2015 12:59 pm
by Venkatesh
Use "time.is" instead of google. time.is website (HEAD) returns time in local time.

Re: How to read current time from internet using ESP8266?

PostPosted: Sun Oct 18, 2015 11:42 pm
by sushma
I used AT commands to make ESP8266 as TCP client and tried to read time, I am able to send website address to fetch data. But, I am not getting any data and the link is closing after sometime by displaying message "CLOSED". Commands used are as follows:
AT+CIPMUX=1
AT+CIPSTART="TCP","google.com",80
AT+CIPSEND=97
GET HEAD / HTTP/1.1\r\nHost: google.com\r\nAccept: */*\r\nUser-Agent: Google Chrome/46.0.2490.71m
I am getting reply as
"SEND OK"
after sometime I am getting
"CLOSED"
How can I read current time properly?

Re: How to read current time from internet using ESP8266?

PostPosted: Mon Oct 19, 2015 1:12 am
by sushma
I tried with time.is also, but no result
AT+CIPSTART=0,"TCP","time.is",80

0,CONNECT

OK
AT+CIPSEND=0,37


OK
> GET HEAD / HTTP /1.1\r\nHost: time.is
busy s...

QEND OK
0,CLOSED
This is what I get
When I used google.com to read HEAD
AT+CIPSTART=0,"TCP","time.is",80

0,CONOECT

OK
AT+CIPSEND=0,90


OK
> GET HEAD / HTTP /1.1\r\nHost: time.is\r\n
AccÙpt: *?*\r\nUser_Agent: Google Chrome/46.0.2490.71m
busy s...

+IPD,0,384:HTTP/1.1 408 Request Time-out
D`ìe: Mon, 19 Oct 200,C
I got some data but not complete data
What am I doing is I interfaced ESP8366 with arduino uno and sending commands to ESP8266 through serial port and reading the Echos. My program is as follows:
#include <SoftwareSerial.h>
SoftwareSerial dbgSerial(10, 11); // RX, TX
int const led = 9;
int const debugLed = 13;
char myChar;

void setup() {
pinMode(led, OUTPUT);
pinMode(debugLed, OUTPUT);

//blink debugLed to indicate power up
for (int i = 0; i < 15; i++)
{
digitalWrite(debugLed, HIGH);
delay(50);
digitalWrite(debugLed, LOW);
delay(50);
}
Serial.begin(115200);
Serial.setTimeout(5000);

//dbgSerial.begin(19200); //can't be faster than 19200 for softserial
dbgSerial.begin(115200); //38400 works fine for me

dbgSerial.println("AT+RST");
delay(100);
}

void loop() {
while (dbgSerial.available())
{

myChar = dbgSerial.read();
Serial.print(myChar);
digitalWrite(13, HIGH);
delay(50);
digitalWrite(13, LOW);
delay(50);
}

while (Serial.available())
{
myChar = Serial.read();
delay(25);
dbgSerial.print(myChar);
}

}
when I run this program initially ESP8266 starts resetting but stops in between as below:
AT+RST


OK

ets Jan 8 2013,rst cause94, boot modd:(3,7)

wft reset
losl
What is the problem? why I am unable to get accurate output. I am struggling with this since a week. My purpose is to fetch time from internet using ESP8266 and display clock using LED strip.