-
Notifications
You must be signed in to change notification settings - Fork 2
Using GPS as Time Source
BresserWeatherSensorLW's README – Real-Time Clock (RTC) lists several options for setting the microcontroller's internal RTC from a time source:
- LoRaWAN Network Time
- LoRaWAN Downlink Command
- Separate RTC with backup battery
Potential reasons for using a GPS as time source:
- Time is set automatically
- Timezone could be set automatically
- High accuracy (no unknown latency as in case of LoRaWAN network time)
Warning
Check the GPS module's datasheet for the correct power supply voltage and I/O voltage levels! Using the wrong voltage can damage the GPS module or the microcontroller.
The following are common GPS module configurations:
- 3.3V power supply and 3.3V I/O levels
- 5V power supply and 3.3V I/O levels (internal voltage regulator)
- 5V power supply and 5V I/O levels (LEVEL SHIFTER REQUIRED!)
A modern GPS module still has a much higher power consumption than an RTC module. For battery/solar powered applications, it makes sense to enable GPS only for synchronizing the MCU's internal RTC.
Depending on the GPS receiver chip/module, the following options exist:
-
Dedicated enable input –
Rarely available with low budget modules. -
(Proprietary) serial interface command for power down/wake up –
Rarely available, often poorly documented, sometimes poorly implemented
(e.g. power down works/wake up requires power cycling). -
Controlling the module's power supply with an external load switch –
Universal solution, but extra hardware required – applied in BresserWeatherSensorLW.
ESP32 Load Switch
┌─────────────────┐ ┌────────┐
│ │ │Vin Vout├────┐
│ │ │ │ │
│ │ │ │ │ GPS Module
│ GPIO ├────────────►│Enable │ │ ┌────────────────┐
│ │ │ │ │ │ │
│ │ ┌─┤GND │ └───►│VCC │
│ │ │ └────────┘ │ │
│ │ │ │ │
│ RX │◄──────────┼────────────────────┤TX │
│ │ │ │ │
│ │ │ │RX │
│ │ │ │ │
│ │ │ │ │
│ │ │ │ │
│ │ │ │ │
│ GND ├───────────┴────────────────────┤GND │
│ │ │ │
└─────────────────┘ └────────────────┘
(drawn with asciiflow)
- TinyGPSPlus – Used by BresserWeatherSensorLW.
- Adafruit_GPS – Targeted to Adafruit's own modules, but probably also useful for other hardware.
- Size
- Mechanical integration – mounting & antenna
- Supply voltage
- Energy consumption – operating current and time-to-fix
- Supported satellite systems – many supported systems increase the chance of a fix/reduce the time-to-fix in averse receiving conditions (e.g. indoors)
- Sensitivity & number of channels
- Power management features (see Power Management)
- Price
My current choice: M5Stack Unit GPS v1.1