Skip to content

izivkov/gshock-api-esp32

Repository files navigation

ESP32 G-Shock Time Server

Platform: ESP32 Display: ST7789 Language: MicroPython License: MIT Status: Active

This project provides an ESP32-based time server for Casio G-Shock watches. The ESP32 is a tiny, low-cost microcontroller with built-in WiFi and Bluetooth. This server enables your G-Shock to connect and set its correct time. In addition, it displays some information about your watch.

Just like your G-Shock itself, it’s designed to be set-and-forget. Just start the server once—it will run reliably for months with no user intervention.

Audio Overview


Watch the video


Features

  • BLE Time server for setting your G-Shock's correct time
  • Touch and display support (ST7789 LCD)
  • Battery and temperature display

Supported Watch Models

Works with many G-Shock, Edifice, and Pro Trek variants. Here are the models reported to be compatible with the app and their modules.

Note: By compatible watches we mean that these watches can work with the app, but this does not mean that every function of the watch is supported by the app. For example, fitness functions are not implemented in the app.

Model Module Number(s)
GW-B5600 3461
GM-B5600/GMW-B5600 3459
GMW-B5000 3459, 3461
GW-5000 3159, 3495
GA-B2100 5689
GA-B010 5736
GST-B500 5684
GST-B200 5608
MSG-B100 5659
G-B001 3519
GR-B200 5635
GPR-B1000 3452
GBD-800 3464
GBD-H1000 3475
MRG-B5000 3541
GCW-B5000 3543
GG-B100 5594, 5595
GST-B100 5513
ABL-100WE 3565
Edifice ECB-10 5618, 5604
Edifice ECB-20 5638, 5603
Edifice ECB-30 5686, 5672

Watches that Dont Work

Some advances watches are NOT compatible with the device. They have a different way of connecting to the server. Here are some test results.

Subseries Module Comment
GWF-A1000 5623 Server recognizes watch, but throws error message
GPR-H1000 3554 Server recognizes watch, but throws error message "Failed to connect to Casio device"
GPW-2000 5502 Server does not recognizes connection attempt
MRG-BF1000 5702 Server does not recognizes connection attempt
GB-X6900 3418 Server does not recognizes connection attempt

We are looking for feedback about the accuracy of this table, so please comment in the Issues section with any discrepancies.

Requirements

  • ESP32-C6-Touch-LCD-1.47 micro controller with a touch-enabled display or a Super Mini ESP32-E6 micro controller.
  • MicroPython firmware
  • mpremote for file transfer
  • USB C cable to connect the device to your computer

Hardware

The currently supported hardware is ESP32-C6-Touch-LCD-1.47. Make sure it is exactly this display, because pins differ for similar displays, even from the same manufacturer. Also, the touch function is used to wake up the display, so make usre it is exactly the same model. You can get it at Amazon or AliExpress (sponsored).

Alt Image


Alternatively, you can get an even cheaper Super Mini ESP32-E6. You can get it at Amazon or AliExpress (sponsored).

Alt Image

This device does not have a display but uses an LED to show the current status:

  • Pulsating green every 5 seconds — normal operation, waiting for a connection.

  • Changing colors — the device is connected to a watch, and watch's time is being updated.

  • Blinking blue — the device is in configuration mode and is waiting for the Android app to connect.

  • Blinking red — some error has occurred, such as an invalid configuration file.


Pre-configured devices available. Inquire by email at [email protected]


Getting Started

1. Installing the Software

Download the latest firmware:

  • Follow the instructions here to download and install the latest MicroPython firmare on your device.

Note: On Linux, the port is typically /dev/ttyACM0.

  • install mpremote
pip install mpremote

Deploy the Server Software:

Copy project files to the ESP32:

python sync.py

2. Configure WiFi

The server needs an internet connection to get the correct time. You must therefore provide a way for it to connect to your WiFi network. Here is how to configure it:

Method 1: Manual Installation

A config.json_template file is provided in the repository. Copy it, rename it to config.json, and fill in your values:

{
  "ssid": "YourWiFiSSID",
  "password": "YourWiFiPassword",
  "ssid_alternate": "",
  "password_alternate": "",
  "timezone": "Continent/City",
  "offset": 0
}

Configuration fields:

Key Required Description
ssid Yes Your primary WiFi network name
password Yes Your primary WiFi password
ssid_alternate No Fallback WiFi network name. If NTP sync fails on the primary network, the server will automatically try this one
password_alternate No Password for the fallback WiFi network
timezone Yes Your timezone in Continent/City format. See valid timezones
offset No Fine adjustment in seconds applied when setting the watch time, to compensate for ESP32 processing lag (default: 0)
dateformat No Date display format: MM/DD (default) or DD/MM
timeformat No Time display format: 24H (default) or 12H
temperature_unit No C (default) or F
foreground_color No Display foreground color as a decimal RGB value
background_color No Display background color as a decimal RGB value

Copy the file to the device:

mpremote connect /dev/ttyACM0 fs cp config.json :config.json

Reset or Power OFF/ON the device.

Method 2: Using the Android App (recommended)

  • Alternatively, download and install the Android APK on your phone: ⬇️ Download Latest APK. You can find sources here.
  • If not configured, the ESP32 will boot into configuration mode. Once booted, start the Android app. When the red dot at the bottom-right of the app’s screen turns green, the ESP32 controller is connected. (You can also put the server in configuration mode at any time by pressing the BOOT button on the device).
  • Enter your SSID and WiFi password, then press SUBMIT. This will create the configuration file on the ESP32, and the device will reboot into server mode.

Alt Image

Note: The app also provides locale information such as date and time format, temperature units (C or F), and color scheme for the server. It is recommended to use the app for setup.


3. Run the Server

After setup, the ESP32 will start the main server and display the status.


4. Operation

Three ways to connect the watch to the server:

  1. Automatic connection: If your watch is set to auto-update time, it will try to connect four times per day and update its time.
  2. Manual (time only): For a quick time update, short-press the lower-right button on your watch. The watch will connect, update its time, and the display on the server will show the name of the last connected watch and the time of the last sync.
  3. Manual with watch information: Long-press the lower-left button. The watch will connect and update its time. Additionally, the server will display information such as the next alarm, next reminder, battery level, and temperature of the watch.

The ESP32 display will automatically dim after 5 minutes and turn off completely after 30 minutes. Tap the screen to wake it and show the display again.


Logs

You can examine the activities on your device by using the same Android app you used for configiring the device. Go to the second screen, Logs, and you should see something like this:

Alt Image

Note that only the last 10 entries are kept. Also, the log will reset if the device is reset or umplugged.

Clearing the log manually

To clear the sync log from your PC while the ESP32 is connected via USB:

mpremote connect /dev/ttyACM0 exec "from lib.logs.activity_log import activity_log; activity_log.clear_logs()"

To also reset the list of previously connected watches:

mpremote connect /dev/ttyACM0 exec "from lib.utils.persistent_store import store; store.clear()"

Updating the software

If there is a new version of the software in this repository, you can update it on your device as follows:

git pull
mpremote cp :config.json config.json    # backup your configuration
python sync.py

6. Software Structure

Here is the structure of the server software files:

  • main.py – Main entry point for the ESP32 server
  • config_server.py – Configuration server used to connect to the supporting Android app and receive configuration information
  • gshock_server.py / gshock_server_no_display.py – Main G-Shock server logic (with/without display)
  • lib/ – Core libraries:
    • display/ – Display and LED control (ST7789, fonts, icons)
    • config/ – Configuration management
    • gshock_api/ – Software to connect and communicate with G-Shock watches
    • utils/ – Utility functions and persistent storage

7. Troubleshooting

If you see nothing on the screen, or the device keeps rebooting, run the server manually and look at the output for any problems:

mpremote run gshock_server.py

License

MIT License
Copyright © Ivo Zivkov


Source Files

For more details, see the project modules:

  • gshock_server.py
  • main.py
  • display.py
  • gshock_api.py
  • config_manager.py

References

Additional resources:
(https://visualgdb.com/documentation/espidf/)
(https://randomnerdtutorials.com/esp32-web-server-beginners-guide/)
(https://www.scribd.com/document/830747162/the-complete-esp32-projects-guide-ebook-1)
(https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf)
(https://docs.nordicsemi.com/bundle/ncs-2.0.2/page/zephyr/boards/xtensa/esp32/doc/index.html)
(https://docs.espressif.com/projects/esp-hardware-design-guidelines/en/latest/esp32/esp-hardware-design-guidelines-en-master-esp32.pdf)
(https://github.com/izivkov/CasioGShockSmartSync)
(https://www.waveshare.com/wiki/ESP32-S3-Relay-6CH)
(https://docs.keyestudio.com/projects/KS5020/en/latest/docs/1.%20Arduino_C_Tutorial.html)
(https://randomnerdtutorials.com/getting-started-with-esp32/)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages