Zur Druckansicht wechseln Visit the English version of this page

www.jb-electronics.de » Elektronik » Nixie-Röhren » Nixie-Event-Countdown

Nixie-Event-Countdown

In manchen Fällen kann es nötig sein, die verbleibende Zeit zu einem speziellen Ereignis herunterzuzählen. Diese Countdowns erstrecken sich dann aber oft nicht nur über Stunden und Minuten sondern über Tage, Wochen und Monate. In diesen Fällen ist eine Benutzung eines normalen Countdowns eher problematisch, da der Countdown - um die Zeit nicht zu verlieren - permanent mit einer Stromquelle verbunden sein muss. Der hier vorgestellte Countdown kann zweistellig Tage herunterzählen, das Konzept kann aber leicht auf andere Zeitspannen erweitert werden.

Nixies

Verwendet wird hier die Nixie IN-8-2, die eng mit der IN-8 verwandt ist. Angesteuert wird das zweistellige Display mit zwei russischen K155ID1-Treiber-ICs, die Anzahl der Tage kann über zwei Taster in- oder dekrementiert werden.

Batteriepufferung

Diese Schaltung benutzt eine Batteriepufferung, die es dem Controller erlaubt, ohne externe Spannungsversorgung über sehr lange Zeiträume (einige Jahre) hinweg die Zeit nicht zu verlieren.

Ohne Schaltlan ist die Funktionsweise eher kompliziert zu erklären, daher ist hier zunächst einmal der Schaltplan zu sehen:

Der Schaltplan des Nixie-Event-Countdowns

Hier ist eine höher auflösende Version des Schaltplans vorhanden.

Die Schaltung kann von einer externen Spannung im Bereich von 7.5...9V versorgt werden. Direkt hinter dem 5V-Festspannungsregler (Low-Drop-Typ) liegen die Spannungsanschlüsse der Treiber. Danach folgt der spannendere Teil: über die Schottky-Diode (niedriger Spannungsabfall) D2 werden die aus der externen Spannung generierten 5V an den Controller herangeführt. Die Betriebsspannung des Controllers liegt damit unter der Betriebsspannung der K155ID1-Treiber-ICs. Das ist aber unproblematisch, da keine Signale von den ICs zum Controller gelangen, die wegen der unterschiedlichen Betriebsspannungen über der des Controllers liegen könnten.

Wenn nun die externe Versorgungsspannung ausfällt, bekommen die Treiber (und auch das Hochspannungs-Schaltnetzteil) keinen Strom mehr. Das ist beabsichtigt, denn sie sollen im Standby ja keinen Strom verbrauchen. Über die Diode D1 meldet sich nun die Batteriespannung zu Wort. Warum erst jetzt, und nicht vorher?

An den drei LR44-Batterien liegt insgesamt eine Klemmspannung von ca. 3 × 1.5V = 4.5V an, nach der Diode D1 sind das etwas weniger, um die 4V. Nun kommen vom Festspannungsregler aber etwas mehr, da seine Klemmspannung ja 5V sind, nach der Diode sind das etwa 4.5V. Die Spannungsdifferenz von Anode zu Kathode ist also negativ, somit sperrt die Diode. Wenn die 5V des Spannungsregler wegfallen, ist die Spannungsdifferenz aber auf einmal positiv, da hinter D1 nur noch 0V anliegen. Die Diode leitet, und Strom fließt aus der Batterie.

Stromausfall-Erkennung

Aber wie merkt der Controller, dass die externe Spannung weggefallen ist? Das ist gar nicht so einfach, denn würde er zum Beispiel die Spannung messen, dann könnte er das ja ohne Weiteres erst einmal nur relativ zu seiner Betriebsspannung, und die skaliert ja mit. Das ist also keine gute Idee.

Einfacher ist es, einen kleinen Pegelwandler einzubauen; in der obigen Schaltung besteht er aus R2, R3, R4 und Q1. R3 fungiert als Basiswiderstand für den NPN-Transistor BC547C, das ist nicht spektakulär. R2 ist da schon spannender: er dient als Pullup-Widerstand gegen die Betriebsspannung des Controllers. Im Normalbetrieb mit externer Spannungsversorgung leitet Q1 und zieht den Pin RB0 auf Masse. Im Standby-Fall sperrt Q1 jedoch, und dann verbindet R2 den Pin RB0 mit der Betriebsspannung. Der Widerstand sollte möglichst hoch gewählt werden, weil er ja im Standby von kostbarem Batteriestrom durchflossen wird.

Was aber macht R4? Dieser Widerstand ist enorm wichtig. Dioden sind keine idealen Bauteile, das heißt, es gibt immer einen kleinen Rückwärtsstrom, der im nA-Bereich liegt. Dieser Rückwärtsstrom über D2 könnte nun (ohne R4) dazu ausreichen, C4 zu laden, und somit irgendwann die Basis des Transistors aufzusteuern - obwohl keine externe Spannungsversorgung zugeschaltet ist. Daher fungiert nun R4 dazu, diesen Rückstrom gemäß des Ohmschen Gesetzes in eine Spannung zu verwandeln. Diese ist dann so klein, dass der Transistor nicht mehr aufsteuert, da auch C4 über R4 entladen wird.

Im Betrieb mit der externen Spannungsversorgung fallen dann jedoch immer 5V über R4 ab; das sind ca. 5mW Verlustleistung, also prinzipiell tolerierbar.

Software

Verwendet wurde der PIC16F627A. Die Software ist auch deutlich an das Sleep-Mode-Konzept angepasst. So läuft der Controller komplett mit internem 4Mhz-Takt, und an RB6:7 ist zudem ein Uhrenquarz angeschlossen, welches den Timer1 laufen lässt. Dessen Prescaler ist so eingestellt, dass er alle 16s überläuft. Da ein Tag 24×60×60s = 86400s lang ist, wird die Überlauf-Routine (heißt auch Interrupt-Service-Routine, oder kurz ISR) pro Tag also 5400× aufgerufen.

Wenn der Controller nun merkt, dass die externe Versorgungsspannung weggefallen ist, wechselt er in den Sleep-Mode, währenddessen er nur noch 1μA Strom benötigt. Dazu wurde der Brown-Out-Detect, der recht stromhungrig ist, über das Configuration-Word abgeschaltet, da er hier überflüssig ist. Wichtig ist nun, dass der Timer1 auch im Sleep-Mode weiterarbeitet. Das macht nicht jeder Timer des Controllers, zum Beispiel pausiert Timer0 während des Sleep-Modes komplett. Daher: Datenblatt lesen.

Wie wacht der Controller eigentlich wieder auf? Er könnte einfach alle 16 Sekunden in der ISR nachgucken, welcher Pegel an RB0 anliegt. Wenn dort eine 1 liegt (also immer noch keine externe Spannungsversorgung da ist), ginge er einfach wieder schlafen. Aber dann wäre die Schaltung sehr träge, und bräuchte im Extremfall genau diese 16s, um zu reagieren. Es geht auch besser: Den externen Interrupt auf RB0 nutzen. So kann der Controller selbst im Sleep-Mode bemerken, dass die externe Spannungsversorgung wieder eingeschaltet worden ist. Dass dieser Interrupt im Sleep-Modus aktiv ist, ist zwar sinnvoll, aber nicht selbstverständlich. Daher gilt auch hier: im Datenblatt nachlesen.

Zudem sind die internen Pullups an PORTB aktiviert, was dazu führt, dass die beiden Taster einfach so vom Mikrocontroller gegen GND geschaltet werden können. Deren Signal ist innerhalb der Software dann allerdings invertiert.

Ansonsten ist der Quellcode sehr ausführlich kommentiert und sollte eigentlich beim Durchlesen kein Unverständnis provozieren. Für alle Interessierten gibt es hier den C-Quellcode und das fertig kompilierte HEX-File: NixieEventCountdown.zip (5 KB)

Sonstiges

Die Nixies würden in diesem Szenario sehr lange die gleichen Ziffern anzeigen, und das ist nicht gut für sie (Cathode Poisoning). Daher wurde ein kleiner Slotmachine-Effekt eingebaut, der immer beim Erreichen eines neuen Tages oder aber auch beim Hinzuschalten der externen Spannung einmal kurz durchlaufen wird, damit auch die weniger genutzten Ziffern einmal leuchten.

Bilder

Nun aber endlich zu den Bildern des Countdowns. Hier ist die Steuerplatine zu sehen:

Der fertige Nixie-Event-Countdown

Ganz links ist der 7805-Regler für das daneben befindliche Hochspannungsmodul zu sehen; in der Mitte ist der Versorgungsteil für den Controller zu sehen, gebildet aus Glättungskondensatoren sowie dem Low-Drop-5V-Spannungsregler im TO-92-Gehäuse. Daneben befindet sich der Batteriehalter für die drei LR44-Zellen. Es ist eigentlich kein richtiger Knopfzellenhalter, sondern ein etwas verkürzter Halter für AAA-Batterien, der sich für diesen Zweck jedoch außergewöhnlich gut eignet.

Der fertige Nixie-Event-Countdown

Auch zu sehen sind zwei vier- und eine dreipolige Buchsenleiste, die die Verbindungen zur Displayplatine herstellen:

Der fertige Nixie-Event-Countdown

Fertig montiert sieht der Event-Countdown so aus:

Der fertige Nixie-Event-Countdown

Der fertige Nixie-Event-Countdown

Der fertige Nixie-Event-Countdown

Nach oben

show print layout Die deutsche Version der Seite besuchen

www.jb-electronics.de » Electronics » Nixie Tubes » Nixie Event Countdown

Nixie Event Countdown

In some cases, it might be required to count down a remaining time for a special event. Those countdowns often stretch out not only over hours and minutes, but over days, weeks, and months. In these cases the use of an ordinary countdown is difficult, because keeping track of time requires the countdown to be continuously connected to a power supply. The circuit described here counts down days in two digits - expanding this concept towards other timespans is quite easy, though.

Nixie Tubes

Used here is the Nixie tube IN-8-2, closely related to the IN-8. The two digit display is driven by two Russian K155ID1 driver ICs, the number of days can be in- or decremented using two pushbuttons.

Battery backup

This circuit uses a battery backup technique that allows the processor to keep track of time for a very long period (several years) with no external power supply.

Describing the idea of this concept is rather difficult without a schematic, so here it is:

Schematic of the Nixie Event Countdown

Here you can find a high resolution version of the schematic.

The circuit can be operated by an external voltage of 7.5...9V. The drivers for the Nixie tubes are connected directly after the 5V fixed voltage regulator (low dropout type). Then follows the more interesting part: the 5V generated from the external voltage are fed to the controller over the Schottky diode D2 (only a small voltage drop). Therefore, the operating voltage of the controller is lower than that of the K155ID1 driver ICs. That is not a problem, though, since they do not transmit any signals to the controller. If they did, their logic 1 would be above the controller's operating voltage.

Now if the external power supply fails, both the drivers and the high voltage module will be cut off from current. This is intentional, since we do not want them to be turned on in standby mode. In standby mode, the battery voltage kicks in through the diode D1. But why now, why not earlier?

The three LR44 cells represent a total clamp voltage of appr. 3 × 1.5V = 4.5V, after the diode those become roughly 4V. Now the fixed voltage regulator supplies just a little bit more voltage, since his clamp voltage is 5V, becoming appr. 4.5V after the diode. The voltage difference between anode and cathode of the diode is negative, resulting in a non-conducting diode. If the 5V of the fixed voltage regulator fail, the voltage difference will be positive (because in that case, there is 0V after the diode). Therefore, the diode will become conducting and will feed the battery's voltage through to the processor.

Detecting a power failure

But how does the controller realize that the external voltage failed? At first, this does not appear so easy because if the controller measured the voltage this would only be possible relative to the currently supplied voltage. So this does not work.

It is much simpler to construct a small level shifter; in the schematic shown above it consists of R2, R3, R4 and Q1. R3 works as a base resistor for the NPN transistor Q1, that is nothing fancy. R2 is more interesting: he works as a pullup resistor with respect to the operating voltage of the the controller. In normal operation with external power supply Q1 is conducting and pulls RB0 to ground. In standby mode, however, Q1 is non-conductive, and in that case R2 hooks up RB0 with the operating voltage. The resistor's value should be selected rather high, because in standby mode valuable battery current runs through him.

What is the job of R4? This resistor is quite important. Diodes are not ideal devices, they have a small reverse current in the range of a few nA. This reverse current over D2 now could eventually charge C4 far enough (without R4) in order to trigger the transistor - although still no external power supply is present. This is why R4 converts this small reverse current into a voltage (in accordance to Ohm's law) which is in turn so small that it can never make Q1 conductive. Also consider that with R4 in place and no external supply present C4 is constantly discharged.

During operation in normal mode, though, there is a constant voltage drop of 5V over R4; this is a dissipation of about 5mW, which is still tolerable.

Software

I have selected the controller PIC16F627A for this job. The software has been completely subjected the sleep mode concept. The controller uses the internal 4MHz oscillator, and a watch crystal is connected to RB6:7 incrementing Timer1. Timer1's prescaler is configured maximal so that an overflow occurs every 16 seconds. Because one day equals 24×60×60s = 86400s, the interrupt service routine (short: isr) is called 5400× per day.

When the controller sees the external voltage fail, he goes into sleep mode, during which he only requires 1μA. To minimize current consumption in sleep mode, the brown out detect feature was disabled using the controller's configuration word. It is important to note that Timer1 continues to work in sleep mode. Not all timers do that, e.g. Timer0 shuts down completely. That is why carefully rading the datasheet is so important.

Anyway, how does the controller wake up? He could just check for the external power supply signal on RB0 every 16 seconds in the isr. If it is high (i.e. if there is still no external power), he would just go back to sleep. But this technique is very slow and would require a reaction time of up to 16 seconds at maximum. But there is a much better way: Using the external interrupt feature on RB0. This way, the controller will realize (even in sleep mode) if the external power supply has been turned back on again. It is quite intuitive that this interrupt works in sleep mode, but it is still important to verify this with the datasheet while designing a circuit.

Additionally, the internal pullups have been activated on PORTB, allowing us to directly connect both pushbuttons from the microcontroller to GND. Their signal within software is inverted, though.

Basically, the source code is commented well enough and should not provoke any serious kind of misunderstanding. If you are interested, you can download the c source code and the compiled hex file here: NixieEventCountdown.zip (5 KB)

Miscellaneous

The Nixie tubes would certainly suffer under these conditions, because they had to display the same numbers for a very long time whilst others do not light up at all (cathode poisoning). That is why I included a small slot machine effect that cycles through all digits. This effect is called either when a new day has arrived or when the external power has been reconnected.

Images

Finally, here are some images of the countdown. This is the controller board:

The finished Nixie Event Countdown

On the very left you can see the 7805 regulator for the adjoining high voltage module; the power supply for the controller is to be seen in the center, consisting of smoothing capacitors as well as the low dropout 5V regulator in TO-92 package. Next to this regulator the battery holder for the LR44 cells is mounted. Strictly speaking, it s not a coincell holder, but designed for AAA batteries. If you cut out a piece, however, you will end up with a very suitable LR44 holder.

The finished Nixie Event Countdown

You can also see two four- and one three-contact adapter connecting the controller board to the display board:

The finished Nixie Event Countdown

The readily mounted event countdown looks like this:

The finished Nixie Event Countdown

The finished Nixie Event Countdown

The finished Nixie Event Countdown

To the top