¿Cada uno no tiene previsto ya una vez de modo constatado que sus horas (si usted no es ningunas horas de radio) con el tiempo o postvan? El más tarde con el cambio de tiempo cercano en el verano u otoño todas las horas de nuevo son puestas en un tiempo justo.
El ordenador syncronisiert su hora interna regularmente con un NTP servidor llamado. El NTP servidor es por así decir una hora de radio para el ordenador.
Así podemos hacernos un NTP servidor zunuzte y llamar con un módulo ESP8266-01S por WLAN. Luego este tiempo miramos inmediatamente en un OLED display.
Lo que necesitamos todo:
1 x ESP8266-01S
1 x 0,96" OLED displayes
algunas Jersey direcciones
1 x el Batteriehalterung para 2 pilas
1 x el adaptador programable Adaptador USB o FTDI FT232RL
Cuerpo 3D-impreso de thingiverse
El Verdrahtung del hardware:
Para poder ejercer usar la hora independientemente del ordenador nosotros aquí 2 pilas con para 1,5Voltmeter. Con el 3Voltmeter la tensión total somos en la frontera inferior del hardware.
La masa (polo negativa) de la pila es ligada en los enlaces GND en ESP8266-01S y OLED display. > Dirección negra
Los 3Voltmeter (polo positivos) de la pila es conectado con VCC en ESP8266-01S y display, además tiene que ser puesto todavía de CH_PD (Chip-Enable) en High (3V). > Dirección roja
En último lugar todavía dos i²c direcciones son conectadas por el display en ESP8266-01S, con eso tenemos que usar 2 GPIOs que están a la disposición. Dirección amarilla si SCK corresponde y se aliará con GPIO2. Dirección verde si es SDA y se aliará con GPIO0.
Si todo está intercomunicado, podemos incumplir a la programación. ¡A la programación tiene que ser puesto de GPIO0 durante la salida en masa!
El software:
#include "ESP8266WiFi.h" #include <WiFiUdp.h> #include <Wire.h> #include "font.h" WiFiClient cliente; char* ssid = "WLAN-SSID"; char* Word de puerto = "WLAN-PW"; char tope[20]; #define OLED_address 0x3c unsigned int localPort = 2390; IPAddress timeServerIP; const char* ntpServerName = "pool.ntp.org"; const int NTP_PACKET_SIZE = 48; byte packetBuffer[ NTP_PACKET_SIZE]; WiFiUDP udp; static void reset_display(void) { displayOff(); clear_display(); displayOn(); } void StartUp_OLED() { init_OLED(); reset_display(); displayOff(); setXY(0,0); clear_display(); displayOn(); } void displayOn(void) { sendcommand(0xaf); } void displayOff(void) { sendcommand(0xae); } static void clear_display(void) { unsigned char i,k; for(k=0;k<8;k++) { setXY(k,0); { for(i=0;i<128;i++) { SendChar(0); } } } } static void SendChar(unsigned char data) { Wire.beginTransmission(OLED_address); Wire.write(0x40); Wire.write(data);font.h (Fichero como nuevos Tab)
Wire.transmisión final();
} static void sendCharXY(unsigned char data, int X, int Y) { setXY(X, Y); Wire.beginTransmission(OLED_address); Wire.write(0x40); for(int i=0;i<8;i++) Wire.write(pgm_read_byte(myFont[data-0x20]+i)); Wire.transmisión final(); } static void sendcommand(unsigned char com) { Wire.beginTransmission(OLED_address); Wire.write(0x80); Wire.write(com); Wire.transmisión final();
}
static void setXY(unsigned char row,unsigned char col) { sendcommand(0xb0+row); sendcommand(0x00+(8*col&0x0f)); sendcommand(0x10+((8*col>>4)&0x0f)); } static void sendStr(unsigned char *bramante) { unsigned char i=0; while(*bramante) { for(i=0;i<8;i++) { SendChar(pgm_read_byte(myFont[*bramante-0x20]+i)); } *bramante++; } } static void sendStrXY( char *bramante, int X, int Y) { setXY(X,Y); unsigned char i=0; while(*bramante) { for(i=0;i<8;i++) { SendChar(pgm_read_byte(myFont[*bramante-0x20]+i)); } *bramante++; } } static void init_OLED(void) { sendcommand(0xae); sendcommand(0xa6); sendcommand(0xAE); sendcommand(0xD5); sendcommand(0x80); sendcommand(0xA8); sendcommand(0x3F); sendcommand(0xD3); sendcommand(0x0); sendcommand(0x40 | 0x0); sendcommand(0x8D); sendcommand(0x14); sendcommand(0x20); sendcommand(0x00); //sendcommand (0xA0 | 0x1);//180 grados giran sendcommand(0xA0); //sendcommand (0xC8);//180 grados giran sendcommand(0xC0); sendcommand(0xDA); sendcommand(0x12); sendcommand(0x81); sendcommand(0xCF); sendcommand(0xd9); sendcommand(0xF1); sendcommand(0xDB); sendcommand(0x40); sendcommand(0xA4); sendcommand(0xA6); clear_display(); sendcommand(0x2e); sendcommand(0x20); sendcommand(0x00); } void Draw_WIFI() { clear_display(); setXY(0,0); for(int i=0;i<128*8;i++) { SendChar(pgm_read_byte(WIFI1+i)); } sendcommand(0xaf); } void Draw_WAVES() { clear_display(); setXY(0,0); for(int i=0;i<128*8;i++) { SendChar(pgm_read_byte(rfwaves+i)); } sendcommand(0xaf); }
void Setup() { delay(200); Wire.pins(0, 2); Wire.begin(); StartUp_OLED(); clear_display(); sendStrXY("***************", 0, 1); sendStrXY("SALIDA", 0, 1); WiFi.begin(ssid, Word de puerto); while (WiFi.estatus() != WL_CONNECTED) { sendStrXY("Ligar", 0, 1); delay(250); sendStrXY(" ", 0, 1); } IPAddress ip = WiFi.localIP(); Bramante ipStr = Bramante(ip[0]) + '.' + Bramante(ip[1]) + '.' + Bramante(ip[2]) + '.' + Bramante(ip[3]); ipStr.toCharArray(tope, 20); sendStrXY((tope), 0, 1); udp.begin(localPort); delay(2000); } void loop() { WiFi.hostByName(ntpServerName, timeServerIP); sendNTPpacket(timeServerIP); delay(200); int cb = udp.parsePacket(); if (!cb) { } else { udp.read(packetBuffer, NTP_PACKET_SIZE); unsigned long highWord = Word(packetBuffer[40], packetBuffer[41]); unsigned long lowWord = Word(packetBuffer[42], packetBuffer[43]); unsigned long secsSince1900 = highWord << 16 | lowWord; const unsigned long seventyYears = 2208988800UL; unsigned long epoch = secsSince1900 - seventyYears; int acordar una moratoria = (epoch % 86400L) / 3600; Serial.println(acordar una moratoria); int minutos =(epoch % 3600) / 60; int segundos = epoch % 60; Bramante str; str = Bramante(int(acordar una moratoria/10)); char stund1[2]; str.toCharArray(stund1,2); str = Bramante(int(acordar una moratoria%10)); char stund2[2]; str.toCharArray(stund2,2); str = Bramante(int(minutos/10)); char min1[2]; str.toCharArray(min1,2); str = Bramante(int(minutos%10)); char min2[2]; str.toCharArray(min2,2); str = Bramante(int(segundos/10)); char sek1[2]; str.toCharArray(sek1,2); str = Bramante(int(segundos%10)); char sek2[2]; str.toCharArray(sek2,2); //sendStrXY ("00:00:00", 2, 1); sendStrXY(stund1, 2, 4); sendStrXY(stund2, 2, 5); sendStrXY(":", 2, 6); sendStrXY(min1, 2, 7); sendStrXY(min2, 2, 8); sendStrXY(":", 2, 9); sendStrXY(sek1, 2, 10); sendStrXY(sek2, 2, 11); delay(50); } } unsigned long sendNTPpacket(IPAddress& address) { memset(packetBuffer, 0, NTP_PACKET_SIZE); packetBuffer[0] = 0b11100011; packetBuffer[1] = 0; packetBuffer[2] = 6; packetBuffer[3] = 0xEC; packetBuffer[12] = 49; packetBuffer[13] = 0x4E; packetBuffer[14] = 49; packetBuffer[15] = 52; udp.beginPacket(address, 123); udp.write(packetBuffer, NTP_PACKET_SIZE); udp.endPacket(); }
const char myFont[][8] PROGMEM = { {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00}, {0x00,0x14,0x7F,0x14,0x7F,0x14,0x00,0x00}, {0x00,0x24,0x2A,0x7F,0x2A,0x12,0x00,0x00}, {0x00,0x23,0x13,0x08,0x64,0x62,0x00,0x00}, {0x00,0x36,0x49,0x55,0x22,0x50,0x00,0x00}, {0x00,0x00,0x05,0x03,0x00,0x00,0x00,0x00}, {0x00,0x1C,0x22,0x41,0x00,0x00,0x00,0x00}, {0x00,0x41,0x22,0x1C,0x00,0x00,0x00,0x00}, {0x00,0x08,0x2A,0x1C,0x2A,0x08,0x00,0x00}, {0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00}, {0x00,0xA0,0x60,0x00,0x00,0x00,0x00,0x00}, {0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00}, {0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00}, {0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00}, {0x00,0x3E,0x51,0x49,0x45,0x3E,0x00,0x00}, {0x00,0x00,0x42,0x7F,0x40,0x00,0x00,0x00}, {0x00,0x62,0x51,0x49,0x49,0x46,0x00,0x00}, {0x00,0x22,0x41,0x49,0x49,0x36,0x00,0x00}, {0x00,0x18,0x14,0x12,0x7F,0x10,0x00,0x00}, {0x00,0x27,0x45,0x45,0x45,0x39,0x00,0x00}, {0x00,0x3C,0x4A,0x49,0x49,0x30,0x00,0x00}, {0x00,0x01,0x71,0x09,0x05,0x03,0x00,0x00}, {0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00}, {0x00,0x06,0x49,0x49,0x29,0x1E,0x00,0x00}, {0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00}, {0x00,0x00,0xAC,0x6C,0x00,0x00,0x00,0x00}, {0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00}, {0x00,0x14,0x14,0x14,0x14,0x14,0x00,0x00}, {0x00,0x41,0x22,0x14,0x08,0x00,0x00,0x00}, {0x00,0x02,0x01,0x51,0x09,0x06,0x00,0x00}, {0x00,0x32,0x49,0x79,0x41,0x3E,0x00,0x00}, {0x00,0x7E,0x09,0x09,0x09,0x7E,0x00,0x00}, {0x00,0x7F,0x49,0x49,0x49,0x36,0x00,0x00}, {0x00,0x3E,0x41,0x41,0x41,0x22,0x00,0x00}, {0x00,0x7F,0x41,0x41,0x22,0x1C,0x00,0x00}, {0x00,0x7F,0x49,0x49,0x49,0x41,0x00,0x00}, {0x00,0x7F,0x09,0x09,0x09,0x01,0x00,0x00}, {0x00,0x3E,0x41,0x41,0x51,0x72,0x00,0x00}, {0x00,0x7F,0x08,0x08,0x08,0x7F,0x00,0x00}, {0x00,0x41,0x7F,0x41,0x00,0x00,0x00,0x00}, {0x00,0x20,0x40,0x41,0x3F,0x01,0x00,0x00}, {0x00,0x7F,0x08,0x14,0x22,0x41,0x00,0x00}, {0x00,0x7F,0x40,0x40,0x40,0x40,0x00,0x00}, {0x00,0x7F,0x02,0x0C,0x02,0x7F,0x00,0x00}, {0x00,0x7F,0x04,0x08,0x10,0x7F,0x00,0x00}, {0x00,0x3E,0x41,0x41,0x41,0x3E,0x00,0x00}, {0x00,0x7F,0x09,0x09,0x09,0x06,0x00,0x00}, {0x00,0x3E,0x41,0x51,0x21,0x5E,0x00,0x00}, {0x00,0x7F,0x09,0x19,0x29,0x46,0x00,0x00}, {0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x00}, {0x00,0x01,0x01,0x7F,0x01,0x01,0x00,0x00}, {0x00,0x3F,0x40,0x40,0x40,0x3F,0x00,0x00}, {0x00,0x1F,0x20,0x40,0x20,0x1F,0x00,0x00}, {0x00,0x3F,0x40,0x38,0x40,0x3F,0x00,0x00}, {0x00,0x63,0x14,0x08,0x14,0x63,0x00,0x00}, {0x00,0x03,0x04,0x78,0x04,0x03,0x00,0x00}, {0x00,0x61,0x51,0x49,0x45,0x43,0x00,0x00}, {0x00,0x7F,0x41,0x41,0x00,0x00,0x00,0x00}, {0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00}, {0x00,0x41,0x41,0x7F,0x00,0x00,0x00,0x00}, {0x00,0x04,0x02,0x01,0x02,0x04,0x00,0x00}, {0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00}, {0x00,0x01,0x02,0x04,0x00,0x00,0x00,0x00}, {0x00,0x20,0x54,0x54,0x54,0x78,0x00,0x00}, {0x00,0x7F,0x48,0x44,0x44,0x38,0x00,0x00}, {0x00,0x38,0x44,0x44,0x28,0x00,0x00,0x00}, {0x00,0x38,0x44,0x44,0x48,0x7F,0x00,0x00}, {0x00,0x38,0x54,0x54,0x54,0x18,0x00,0x00}, {0x00,0x08,0x7E,0x09,0x02,0x00,0x00,0x00}, {0x00,0x18,0xA4,0xA4,0xA4,0x7C,0x00,0x00}, {0x00,0x7F,0x08,0x04,0x04,0x78,0x00,0x00}, {0x00,0x00,0x7D,0x00,0x00,0x00,0x00,0x00}, {0x00,0x80,0x84,0x7D,0x00,0x00,0x00,0x00}, {0x00,0x7F,0x10,0x28,0x44,0x00,0x00,0x00}, {0x00,0x41,0x7F,0x40,0x00,0x00,0x00,0x00}, {0x00,0x7C,0x04,0x18,0x04,0x78,0x00,0x00}, {0x00,0x7C,0x08,0x04,0x7C,0x00,0x00,0x00}, {0x00,0x38,0x44,0x44,0x38,0x00,0x00,0x00}, {0x00,0xFC,0x24,0x24,0x18,0x00,0x00,0x00}, {0x00,0x18,0x24,0x24,0xFC,0x00,0x00,0x00}, {0x00,0x00,0x7C,0x08,0x04,0x00,0x00,0x00}, {0x00,0x48,0x54,0x54,0x24,0x00,0x00,0x00}, {0x00,0x04,0x7F,0x44,0x00,0x00,0x00,0x00}, {0x00,0x3C,0x40,0x40,0x7C,0x00,0x00,0x00}, {0x00,0x1C,0x20,0x40,0x20,0x1C,0x00,0x00}, {0x00,0x3C,0x40,0x30,0x40,0x3C,0x00,0x00}, {0x00,0x44,0x28,0x10,0x28,0x44,0x00,0x00}, {0x00,0x1C,0xA0,0xA0,0x7C,0x00,0x00,0x00}, {0x00,0x44,0x64,0x54,0x4C,0x44,0x00,0x00}, {0x00,0x08,0x36,0x41,0x00,0x00,0x00,0x00}, {0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00}, {0x00,0x41,0x36,0x08,0x00,0x00,0x00,0x00}, {0x00,0x02,0x01,0x01,0x02,0x01,0x00,0x00}, {0x00,0x02,0x05,0x05,0x02,0x00,0x00,0x00} }; //bitmap el emblema const char WIFI1[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0xC0, 0xE0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF8, 0xF8, 0xF8, 0xF8, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFE, 0xFE, 0xFE, 0xFE, 0xF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0x1F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; //bitmap const char rfwaves[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,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00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x07, 0x07, 0x0F, 0x0F, 0x1F, 0x1F, 0x1F, 0x1F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x81, 0x81, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x80, 0x81, 0x01, 0x01, 0x01, 0x03, 0x03, 0x03, 0x07, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x1F, 0x1F, 0x3F, 0x1F, 0x1F, 0x0F, 0x0F, 0x07, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x07, 0x0F, 0x0F, 0x1F, 0x1F, 0x3F, 0x3F, 0x1F, 0x1F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x0F, 0x1F, 0x1F, 0x1F, 0x3F, 0x3F, 0x1F, 0x1F, 0x0F, 0x0F, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0x0E, 0x0E, 0x0E, 0x1E, 0x1E, 0x3F, 0x3F, 0x3E, 0x1E, 0x1E, 0x0E, 0x0E, 0x06, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
Después de la programación montamos todo en el cuerpo impreso y tenemos un siempre actual auto-construido simpático, hora.
¡Ahora la hora corre sólo si un NTP servidor consigue nosotros!
Como tarea sabéis con superioridad a vosotros un cambio en el software, con eso la hora sólo hacia el minuto lleno u hora actualiza nosotros y en medio autárquico en ESP8266-01S calcula nosotros.
Igualmente aún otras líneas en el display son libres, éstas podrían también ser completados con una fecha.
¿Arriba en el cuerpo todavía agujeros para el interruptor previsto cómo esto sería con uno / del INTERRUPTOR?
Mucha diversión copiando y dejáis muy atrás vuestras ideas de mejora en los comentarios.
3 comentarios
yetti
Das sollte doch auch einfacher gehen mittels time.h und configtime,
dann kann man noch den localen Router noch als Zeitserver verwenden, denn kann ohne Probleme öfter abfragen. Ist dann zwar nicht PTB aber schon sehr genau für eine normale Uhr und das sollte für die meisten weiteren Projekte reichen.
#include
void setup() {
//Wifi
….
}
void loop () {
….
// alle x Minuten
….
Serial.println(“aktuelle Zeit holen”);
getPTB();
…
// Zeit holen aus dem internen Speicher.
Serial.println(“Readtime()”);
readtime(); // Zeit einlesen
….
}
void getPTB(){
configTime(0, 0, “192.168.1.1”, “ptbtime1.ptb.de”, “ptbtime2.ptb.de”); // locale Fritzbox und ptb.de
setenv(“TZ”, “CET-1CEST,M3.5.0,M10.5.0/3”, 1); // locale Zeit einstellen mit Sommerzeit
Serial.print("Waiting for time “);
while (!time(nullptr)) {
Serial.print(”.");
delay(100);
}
delay(100); // warten auf NTP Zeit
}
void readtime() {
if (year < 2000) { // das war nix Zeit falsch ESP.restart(); }time_t now = time(nullptr);
struct tm*timeinfo;
time(&now);
timeinfo = localtime(&now);
year = 1900 + timeinfo→tm_year;
month = 1 + timeinfo→tm_mon;
day = timeinfo→tm_mday;
hour = timeinfo→tm_hour;
minute = timeinfo→tm_min;
second = timeinfo→tm_sec;
// Serial.printf(“%02u-%02u-%4u\n”, day, month, year);
Serial.printf(“%02u:%02u:%02u \n”, hour, minute, second);
}
Kai
Hallo Markus,
ein ESP arbeitet leider viel zu ungenau bzw. arbeitet er Funktionalitäten wie WLAN vorrangig ab und vernachlässigt dann andere Prozesse. Würde die Zeit nicht stündlich abgefragt käme es mitunter pro Stunde zu einem Fehler von bis zu 3 Minuten. Eine Lösung ist ein RTC-Modul oder das WLAN zu deaktivieren oder mit der Funktion Millis die verstrichene Zeit der Hintergrundprozesse zu ermitteln. Es geht hier ums basteln und nicht um High-End-Geräte…
Markus Gebhard
Nettes Beispiel, aber bitte fair sein und die Regularien und Doku des Zeitservers beachten. Siehe https://www.pool.ntp.org/vendors.html und insbesondere die Richtlinie "Don’t send excessively frequent queries. Reasonable query intervals are typically from once or twice a day to a 4-5 times an hour depending on the application. Really consider how often the device will need “fresh time”. A standard ntpd or openntpd server works, too." – bitte vermeiden, andauernd eine Zeitabfrage zu senden, weil diese eben doch Bandbreite verbraucht und damit andere in Mitleidenschaft zieht.