Logic Module

Logic module is component that provides all of the real time clock functions. It is responsible for time measuring, backup timekeeping if required and driving displays. Module is powered with 5V line, so it is responsible for producing other required voltages. Currently there are two Logic Modules for the Open Nixie clock. Those are:

Wemos D1 is module dedicated for IoT. It integrates ESP8266 system. D1 mini provides 11 GPIO pins and WiFi interface. It is a standalone module that drives display and provides time from NTC servers via network.
Code was written in the Arduino environment that supports ESP8266 platform.
WiFi credentials are hardcoded in the code (multiple ssids are supported, module connects to the one that is available). Buttons are used for setting timezone – ± 12 hours from UTC with 1h step. Button up enters timezone setting, button down turns the LEDs on and off. The state of LEDs is preserved during poweroff.
Wemos D1 does not provide any battery backup, so it has to obtain time from the Internet on every time it’s powered on.
The most important advantage of using Wemos is its feasibility. It is cheap, ready made PCB that can be easily programmed via USB interface. No extra gear needed.
There is also a disadvantage. It is said in documentation that ESP8266 executes its own code in the background for WiFi stack and some other features. This creates random lags and delays. Problem becomes symptomatic because ESP8266 drives the display dynamically. Every unexpected delay causes display to flicker. I can say from my observations that the problem is not severe but surely noticeable.
Other disadvantage is that Wemos needs low logic value on GPIO15 pin during power on. This port is connected to one of inputs of 74141. The problem is that TTL inputs has pull up resistance equivalent. For example TI’s SN74141 has this resistance about 2k.

This prevents Wemos D1 to boot correctly. Problem does not exist on some ICs, for expalme Tesla’s 74141s work fine. To fix this, resistor R99 was added on display module in Revision 2. In case of problems footprint should be populated with 1-2k resistor.
Anyway – some disadvanages of using Wemos D1 prompted me to develop an alternative – so Logic Module M328 was born.

Logic Module M328 is based on ATmega 328 microcontroller and DS3231 high precision real time clock circuit. Microcontroller drives the display and supports user interface and all the logic while DS3231 is responsible for timekeeping. The RTC uses CR1220/CR1225 battery for backup to maintain timekeeping when the clock is not powered.
During normal operation time is maintained by microcontroller. Current timestamp is loaded from DS3231 on startup and then it is updated every 30 minutes. This reduces amount of communication between microcontroller and RTC circuit. As some sources claim that too frequent communication can affect accuracy of RTC, reducing frequency of communication seems like good idea. From my observatios I can say that the RTC is vulnerable to powering off during active communication. This results sometimes in time corruption. So again – less reads from RTC may improove system stability.
The microcontroller is clocked from internal RC oscillator. Those are very inaccurate. To prevent significant deviations of timekeeping the microcontroller calibrates itself on every readout of current time from DS3231.
PCB is designed to make perfect fit in place of Wemos D1 mini. It has two footprints for battery holder. The battery can be installed on either or both sides of PCB. While using two batteries both have to be the same type and wear level as they will be parallely connected. Yet there aren’t really goood reasons for that as one battery is perfectly enough.
There are also test points for connecting programmer/debugger to the microcontroller so it can be programmed in circuit.
PCB contains also 3 jumpers. They are designed to enable module to be used as RTC module for Wemos D1 mini. This was never tested. If module is to be used as RTC module – don’t install microcontroller. JP1 positions 2-3 has to be connected to provide 3.3V power to DS 3231. JP2 and JP3 should be also closed to provide lines SDA, SCL to be connected to respective ports. While using module in Open Nixie Clock – JP1 all 3 pads have to be shorted together and JP2, JP3 have to be left open (they are under microcontroller).
There are two versions of software – one for standard version of clock and the other one for clock that uses Z566M tubes and infrared receiver (so it can be controlled by RC6 remote).
Standard version of software uses all 3 buttons, so all have to be installed on base module. This software also provides support for the LEDs so they sould be installed as well. Logic module also features display crossfade.
Function of clock ale quite simple. After power on, first all lamps are tested by displaying all numbers in sequence. Then clock enters timekeeping mode where current time is shown all the time. In this mode pressing UP button shows calibration value that is only usable for some debugging. Holding DOWN button shows minutes and seconds as long as the button is pressed.
Pressing ENTER button makes clock enter time adjust mode. Now buttons UP and DOWN change time by one minute.
Pressing ENTER once again saves time setting and enters dim time setting. In this mode time range when display will be dimmed is adjusted. UP button sets hour when the display dimming is started, DOWN buttons sets hour when dimming ends. Setting for example 23:06 means that display is dimmed between 23:00 and 5:59.
Pressing ENTER once again saves dimming time range and enters LED settings. In this mode time range when LEDs are on is set. Settings goes the same way as in prevoius mode.
Pressing ENTER once again lets you turn on and off crossfade. In this mode there will be displayed counter counting from 00 to 99. Pressing UP or DOWN button turns on and off crossfade. Effect can be observed on the display, as consecutive values are displayed with or without crossfade. Pressing enter saves setting and makes clock return to timekeeping mode.
Version of software with remote control support works in different way. It supports RC6 remote – disregarding device type (TV, HiFi sets etc). Entering timesetting mode is done by typing 999 sequence. Then correct time is entered then with numeric keys. Entering 998 puts clock in dim setting mode and entering 997puts it into crossfade setting mode. There are no LEDs in this version of clock hence there is no LEDs setting in software.


    Dodaj komentarz

    Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *