Giter Site home page Giter Site logo

luigicalligaris / dcfake77 Goto Github PK

View Code? Open in Web Editor NEW
18.0 7.0 5.0 33 KB

DCFake77 is an emulator for the DCF77 LF time synchronization signal.

License: GNU General Public License v3.0

C 82.22% C++ 17.78%
dcf77 low-frequency-radio time-signals watch time-sig

dcfake77's Introduction

DCFake77

DCFake77 is an emulator for the DCF77 time signal, used to synchronize clocks, watches, appliances and industrial equipment. DCFake77 exploits hardware available on common development boards to generate a 77.5 kHz signal, AM-modulated to encode the DCF77 protocol.

Available implementations

So far three implementations are provided:

  • An ESP32 implementation based on the LED control PWM hardware, initially developed by Luigi Calligaris
  • An ESP8266 implementation based on the software PWM code of the SDK, initially developed by Luigi Calligaris
  • A Raspberry implementation based on the General Purpose Clock generator hardware, initially developed by Renzo Davoli

Quick start

You'll need the following hardware:

  • An ESP32 or ESP8266 development board (cheap ones - around 4$ - can be found online or in electronics shops) or a Raspberry Pi.
  • A 330 ohm resistor or more (2 x 220 or 470 work fine), any power rating is fine. The setup is not picky, but don't go below 330, to keep currents acceptable for the GPIO drivers.
  • An electromagnetic coil to couple the signal to the receiving device. I used a coil with around 20 turns made from old twisted pair. I recommend the diameter of the coil to be at least of the order of the distance between it and the receiver.
  • Using a breadboard to assemble the setup is helpful. The ESP32/8266 can fit straight into the breadboard, but take care that most ESP32 boards do not fit very well on single-tile breadboards, leaving access to just one row of pins on one side of the board. Still, this is enough for our application. The Raspberry Pi will require female-to-male 100-mil jumper wires from the 40-pin header to the breadboard.

ESP32 implementation

This implementation drives the PWM at 77.5 kHZ using the led PWM library.

  • Choose the pin you want to use for signal output on the ESP32 (in this example, GPIO16).
  • Wire the resistor to it and then wire the coil in series with the resistor to the GND pin on the ESP32.

(ESP32 GPIO16)----(330 ohm)----(COIL)----(GND ESP32)

  • Power the ESP32 by connecting the USB cable to your computer.
  • Launch Arduino IDE and load dcfake77-esp32.ino .
  • Select the ESP32 board you're using in board settings. If you didn't do so yet, you may have to install the board in the IDE board manager.
  • Set the output pin you chose before (in our case 16) as the led_pwm_pin constant in the top of the source file.
  • Set username and password for your WiFi access point, so the ESP32 can fetch the current GMT time via NTP.ORG .
  • Set the offsets between your time zone and GMT, for daylight saving time and summer time.
  • Verify the code compiles (Ctrl+R).
  • If successful, compile and upload the code (Ctrl+U).
  • If all goes well, the ESP32 should connect to the WiFi, get GMT time and then start transmitting the emulated DCF77 signal via the coil.
  • Some receiving devices need a few minutes (like 2-5) to validate the signal and synchronize to it. Be patient.
  • Some debug information is sent through the UART interface while the code is running, you can monitor it using a program like GtkTerm.

ESP8266 implementation

Due to limitations in the ESP8266 SDK, generating a 77.5 kHz PWM signal is not natively supported and would require re-writing a number of drivers. To make things simpler for this implementation the PWM is run at 25.833 kHz, which results in a third harmonic signal at 77.5 kHz.

Follow the same wiring instructions as the ESP32, choosing a suitable GPIO output pin, such as GPIO5 (also labeled as "D1" on a Lolin D1 Mini), and setting that in the .ino file.

(ESP8266 GPIO5)----(330 ohm)----(COIL)----(GND ESP8266)

Set the WiFi username and password in the .ino file and adjust your local time offset w.r.t. to UTC by monitoring the USB UART interface of the board with a program line GtkTerm, which will print the local time to be transmitted by the emulated DCF77 signal on each second.

Raspberry implementation

Guide to be written

dcfake77's People

Contributors

luigicalligaris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dcfake77's Issues

GPL v2 vs. v3 incompatibility

The GPLv2 license is not compatible with GPLv3 license, as they are both copyleft but they are not allowing license-switching from one to the other [1]. The original dcfake77.c states in its header "GPL v2+", I'm assuming that this permits the switching to "GPLv3 and later versions".

[1] Why Upgrade to GPLv3

1 minute offset ?

Hi any idea how do we correct 1 minute offset ? its 1 minite behind the actual time, thanks

flipper zero

Hi there I have a flipper zero and I'm trying to do this implementation

https://lab.flipper.net/apps/dcf77_clock_sync

in the comments it says:

"When using the GPIO, best results are achieved if you connect a ferrite antenna over 330 ohm resistor and a capactior to ground."

any idea what capacitor we use to achive this ? volts capacity ? how will resistor be connected either way is the same ?

I see that for your raspberry implementation that also uses GPIO you dont mention a capacitor is it needed ?

I bought one of these just to use the antenna https://www.ebay.com/itm/203638784817

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.