Wireless MQTT GPS time server with ESP8266

TimeServ1If you ever had a project that had a need for a real time clock and had no internet connection you probably made it with a RTC module like this one, and while this can work great; I had a GPS module that I decided to use to make a offline network time server.

The parts needed are:

_20160209_103239

Steps:

    1. Upload code to esp8266, I used the following libraries: tinyGPS for decoding NMEA codes, GPS time from Arduino time library and pubsubclient for MQTT client setup.
    2. Connect your gps module to esp, look in the datasheet for voltage if needed, mine runs on 3.3V, so connect 3.3V, GND and the TX pin from the GPS to the hardware RX pin on the ESP. It is crucial  that the TX pin is not connected during the upload process.
    3. Place the module in a window or somewhere on a open area with no obstructions for the satellite signals.
    4. Subscribe to the broker IP address and “/time” topic on other devices. Pubsubclient works great on Arduino/ESP and Mosquito works for both broker and client applications on GNU/Linux devices. So you’ll need mosquitto for broker and  mosquitto-clients for clients, and than you can subscribe from any device in the network  with:  mosquitto_sub  -t TOPIC -h IP_ADDR -p 1883
    5. Give your GPS module some time to sync with the satelites.
    6. Enjoy.

_20160209_103042

 

Skills

Posted on

09/02/2016

Submit a Comment

Your email address will not be published.

Pin It on Pinterest

Share This