improved cheap ntp stratum 1 server

The cheap stratum ntp server based on ESP8266 turned out as unstable. I’m not sure, if it is a hardware or a software problem.  The module suddenly hangs and then sometimes the watchdog is triggering and sometimes only a poweroff and poweronn will get the wifi connection up again. I had similar problems with my secure esp8266 sensor node. It seems, that the problems are more often with many data transmitted via serial interface.

I have adapted my arduino code to be used with an ESP32 and made a prototype with this platform. Time will show, if this solves all the stability problems.

 

 

building a cheap stratum 1 gps ntp timeserver

goal:
have a reliable local ntp timesource

motivation:

  • be independant of a internet connection
  • study the possibilities of cheap GPS devices

deliverables:

  • running ntp timeserver with GPS time
  • source code for ESP8266 for arduino IDE

approach:

  • find a ebook with code samples
  • play with the technology
  • implement
  • test

notes:

Progress

  • GPS sync for local clock implemented, setting local clock fails on some devices
  • ntp server prototype without GPS implemented
  • Do not use the standard softwareserial library with wifi, as it may crash the system. Use espsoftwareserial instead. I had to pay hard to find out…
  • Code is working now:

findings:

  • the esp9266 has a high resolution clock, but I can not set it on all devices
  • a PPS signal on the GPS device is the key to a high precision time source
  • atom with platformio ide is a nice development environment

open items:

  • build a nice 3d printed enclosure

source code:

 

secure esp8266 sensor node

Some of my sensors use mqtt to publish their data to a mosquitto mqtt server. To have a really secure configuration I should:

  • use ssl/tls as transport
  • use authentication with one user / device
  • restrict topics to those users

Thinking about all the work that is involved for doing this, following idea came up:

  • use a REST service with https (with node-red)
  • to prevent replay attacks, add a timestamp to the message
  • sign the messages with an individual AES-Key

Here is a POC arduino sketch: