Things used in this project

Hardware components:
Esp01
Everything ESP ESP8266 ESP-01
×1
GPS receiver (generic)
1 PPS @ 9600 BAUD (if faster than 1 PPS you must reprogram)
×1
OLED 128x32 0.96 inch length
×1
OLED 128x64
×1

Schematics

Generic Hookup
Your exact hookup may vary
Generic esp8266 hookup

Code

Untitled fileC/C++
Sketch for ESP8266 for use with Arduino IDE and ESP8266 plug-in
/*
   GPS Portal, part of Tardis Time Server by: M. Ray Burnette 20150915
   Create a private 10. network and capture all DNS requests to the Time Portal
   Respond to UDP and DHCP and DNS
   Compiled under Arduino 1.6.6 Hourly build 2015/09/04 04:42
    Sketch uses 340,080 bytes (78%) of program storage space. Maximum is 434,160 bytes.
    Global variables use 50,796 bytes (62%) of dynamic memory, leaving 31,124 bytes for local variables. Maximum is 81,920 bytes.
*/

#define LEDpin 2                                                // ESP82660-1 8-pin module LED is on GPIO-02
#include <Streaming.h>                                          // \Documents\Arduino\libraries\Streaming (legacy) user-installed
#include <ESP8266WiFi.h>
#include <WiFiUDP.h>
#include <DNSServer.h>
#include "./Utility.h"                                          // See Notes tab for credits

const byte   DNS_PORT  =   53;                                  // Listen DNS requests on port 53
int          ack_Count =    0;
int          counter;
uint8_t      hour, minute, seconds;                             // hour, minure, seconds,
uint8_t      day, month, year;                                  // year, month, day;
unsigned int localPort = 8888;                                  // any unused port on LAN
IPAddress    apIP(10, 10, 10, 1);                               // Private network address: local & gateway
IPAddress    broadcastIP(255, 255, 255, 255);

char         packetBuffer[UDP_TX_PACKET_MAX_SIZE];              // buffer to hold incoming packet,
char         ReplyBuffer[] = "????????????";                    // a 12 character string to send back

DNSServer         dnsServer;                                    // Create the DNS object
WiFiUDP           UDP;                                          // UDP protocol on STA interface, localPort

extern "C" {
  #include "user_interface.h"                                   // used for diagnostic ESP.getFreeHeap()
}


void setup()
{
  Serial.begin(9600);                                           // Initialise Serial connection
  Serial << (F("2015 Ray Burnette")) << endl;
  Serial << (F("Tardis Time Portal Version 0.20150915")) << endl;
  Serial << (F("Visit my project web page on http://www.hackster.io/rayburne")) << endl << endl;

  WiFi.mode(WIFI_AP_STA);                                       // AP + STA
  WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));   // subnet FF FF FF 00
  WiFi.softAP("TardisTime");

  dnsServer.start(DNS_PORT, "*", apIP);                         // "*" creates a captive portal

  while (! UDP.begin(localPort) ) {                             // UDP protocol connected to localPort which is a variable
    Serial << "+" ;
    yield();                                                    // Play nicely with RTOS (alias = delay(0))
  }                                                             // This will loop forever if UDP fails

  Serial << endl;
  Serial << (F("Setting pin#2 to Output mode")) << endl;
  pinMode(2, OUTPUT);                                           // initialise pin mode
}


void loop()
{
  dnsServer.processNextRequest();                               // TCP Address handler when requested
  yield();                                                      // yield for RTOS
//  Listener();                                                   // UPD (can you hear me now?)
//  yield();

  if (Serial.available() > 0) {                                 // anything in the serial hw buffer?
      char c = Serial.read();                                   // if so, fetch the next character from FIFO
      GPSstuff(c);
  }

  yield();
  ++counter;

  if (counter > 9999) {                                         // for diagnostics, no other purpose
    long int RAM = ESP.getFreeHeap();
    Serial << "Free= " << RAM << endl;
    counter = 0;
    digitalWrite(LEDpin, !(digitalRead(LEDpin)));               // blink LED (Warning: using ESP8266-01 module)
    yield();
  }
}                                                               // loop repeats forever unless stack crashes or uC hangs


void GPSstuff(char c) {                                         // GPSbuffer[] is global
  static int i, j;                                              //   persistent within function scope
  static char q;
  static bool flag = false;
  static char GPSbuffer[120];                                   // GPS serial line input buffer
  q = c;

  if ( q == 0x24 )                                              // '$'
  {
    i = 0;                                                      // brute force sync on '$' to GPSbuffer[0]
    // Serial << "Found $" << endl;
  }

  if ( i < 120) GPSbuffer[i++] = q;
  // Serial << "Index=" << (i -1) << "Input=" << q << endl;
  //if (i = 120) i = 119;                                       // array limit safety

  if (q == 0x0d) {
    flag = true;                                                // is the character a CR for eol
    i = 0;
  }

  if (flag) {                                                   // test for end of line and if the right GPSbuffer
    flag = false;                                               // reset for next time
    UDP.beginPacketMulticast(broadcastIP, localPort, apIP);
    // Serial << "We are in the flag routine..." << GPSbuffer[3] << GPSbuffer[4] << GPSbuffer[5] << endl;
    // Serial << "Analyzing " << GPSbuffer[3] << GPSbuffer[4] << GPSbuffer[5] << endl;
    if ( (GPSbuffer[3] == 0x52) && (GPSbuffer[4] == 0x4d) && (GPSbuffer[5] == 0x43)) // 'R' && 'M' && 'C'
    {
      for (j = 0; j < 120 ; j++) {
        UDP.write(GPSbuffer[j]);
      }
      UDP.write("\r\n");                                        // terminate the line
      UDP.endPacket();                                          // clear UDP buffer
    }
  }
}
Zip of SketchC/C++
Unzip - 4 files
No preview (download only).
TardisTimeReceive.zipC/C++
Alpha quality code - for demonstration only. May be unstable until ESP8266 is reset.
No preview (download only).
OLED Version Tardis Time ClientC/C++
This is for a completely self-contained portable unit w/ I2C OLED display
No preview (download only).
Tardis Time Receiver 20160816 Update for 128x32 OLEDArduino
Arduino Source Code (sketch)
No preview (download only).
Arduino IDE for ESP8266
Please read how to install properly

Credits

Coffeemath
Ray Burnette

IT architect - retired AT&T... USAF-Secure Comm , Burroughs, Clemson U. School of EE Research, Southern Bell, BellSouth, SofKinetics, Inc. (President), AT&T IT

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Alexa Trigger ESP8266
Intermediate
  • 1,525
  • 13

Work in progress

Use Alexa to voice control a relay connected to the Internet via ESP8266-01.

NodeMCU Home Weather Station with Websocket
Intermediate
  • 36
  • 1

Full instructions

NodeMCU and BME280 Home Weather Station that serves a webpage using Websockets

MQTT + ESP8266 + BMP180 + TSL2561 + Cayenne
Intermediate
  • 202
  • 2

Protip

Read data from two of most popular sensors out there. Temperature, pressure, and luminosity.

Solar power meter
Intermediate
  • 471
  • 3

Solar power meter measures the voltage, current and power of my 40W solar panel.

Moisty - Orchid & Plant IoT w/ Blynk
Intermediate
  • 400
  • 4

Full instructions

A simple 4 channel design/program for monitoring orchid & plant media moisture levels.

OmegaJar
Intermediate
  • 625
  • 5

Full instructions

An Internet Connected Smart Jar powered by Amazon DRS!!

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback