The use of the ESP8266 in the world of IoT

User avatar
By QuickFix
#78936
ros wrote:Nice option. Can you share a link to GPS module and code sample you've used for for this trick? ;)

Any GPS module (even an old "GPS mouse" from your car's GPS should work) would do: see my post of a year ago using a $4 GPS module.
The time, date and location is sent over serial in 9600baud in *almost* plain text (NMEA) format by these modules.
User avatar
By PeteKnight
#78970 I have lots of ESP8266 devices that I turn on/off at various times, but none of them have any idea what the current time i is.
I use a Raspberry Pi as the heart of the system, and it does know what the current time is. It can synchronise with an NTP clock if one is available, but runs quite happily, and accurately, for long periods without one. In your situation, you may want to add a small ‘UPS’ type device to the Pi so that it keeps running if the power goes off. A small power bank designed for mobile phones is ideal for this.

The Raspberry Pi runs Node-Red and an MQTT broker called Mosquitto, the timing/scheduling is done with a node called Big Timer by Peter Scargill. As well as turning devices on or off at specific times, Big Timer can operate devices based on dawn or dusk times (with an offset if needed, so you can turn lights on x minutes before dusk, and off again y minutes after dawn). It’s simple to override the schedule too, or suspend it for a given period of days.

The ESP devices run a very simple MQTT client that connects to the Pi and listen for instructions sent as MQTT messages. These can be specific to one device, or apply to a group of devices. The devices can also send messages back as confirmations, or even feed data like temperature and humidity back to the Pi via MQTT messages.

All of this works fine without any internet connectivity, provided your Wi-Fi is still up and running.

It might sound like a bit of an overkill for what you’re trying to do, and a bit of a steep learning curve, but it’s actually quite simple, and relatively cheap, to get up and running.

Pete.
User avatar
By picstart
#79005 It somewhat depends on the accuracy of the time you desire. A sprinkler system only needs to measure approximate intervals in time and time on. The Esp has a cycle count feature that measures time in cycles based on the esp crystal frequency. The cycle count will roll over in days since it is a 32 bit counter but can be extended in software to 64 bit precision ( which means almost unlimited time keeping). The CPU crystal will drift from perfect time keeping but only slightly in a 24 hour period. If synchronization to real time as in clock on the wall time then an external reference ( NTP GPS) is required to adjust for crystal drift. GPS is the most accurate since NTP comes with packet traffic delays. GPS consumes the most power followed by the wifi radio in the esp to get NTP. Just keeping the esp cycles ticking away uses the least power. For many applications the accuracy of the esp crystal is more than enough.