Category Archive: IN-12 Nixie Clock

Aug 03

IN-12 Nixie Clock

Some time ago I decided to build a nixie clock. Robert will do the design of the clock. Because he uses AVR microcontrollers I already made an AVR programmer.

For the nixie clock I have made a “high voltage” power supply. This is based on the well known circuit, but I adapted it with an enable input.

Schema

(If the enable pin is high the power supply stops, the pin can be left floating without problems)

Nixie_Sup

Nixie_Sup

The pcb layout: PDF with components; PDF without components

Aug 26

IN-12 Nixie Clock – Update

Yesterday I received my nixies (Thanks Robert and Pascal!), today I started experimenting with them.

Nixie vooraanzicht

Nixie zijaanzicht

Nixie met ledje naast

voorkant

Datasheet:

gegevens

 

The socket:

buisvoet

Sep 02

IN-12 Nixie Clock – Update

Today I have made a drawing of how the clock is going to look like:

Behuizing

Behuizing

Behuizing

Mar 29

IN-12 Nixie Clock – Update

I decided that I’m not going to wait for Robert to have time to make the code and circuit diagram any longer. So I designed something myself. The clock works with a PIC16F628A, the time is kept with a DS1307 and the temperature is measured with a TC74. I have used a couple of 74HC595 ic’s because the 16F628A doesn’t have enough IO pins. This way I create 8 outputs extra per connected 74HC595. I used those outputs to drive the nixie drive ic’s and the transistors that drive the neon’s.

schema

pcb

Picture of the pcb:

print

Video of the clock working:

 

The code:

Device  16F628A
Config  INTRC_OSC_NOCLKOUT, WDT_off, PWRTE_off, LVP_off, MCLRE_on
ALL_DIGITAL     TRUE 
PORTB_PULLUPS   = On

'In en uitgangen
    'Nixies en neons
        Symbol  klok      = PORTA.1
        Symbol  ZetVast   = PORTA.0
        Symbol  Data_Pin  = PORTA.2
    'Temperatuursensor en RTC
        Symbol  SDA       = PORTB.4
        Symbol  SLC       = PORTB.3
    'Knoppen
        Symbol  KnopR     = PORTB.7 : TRISB.7 = 1
        Symbol  KnopM     = PORTB.6 : TRISB.6 = 1
        Symbol  KnopL     = PORTB.5 : TRISB.5 = 1


'Variabelen declareren
    Dim     Teller          As Byte
    Dim     Temp1           As Byte
    Dim     Temp2           As Byte 
    Dim     BCD_Opt         As Byte   
    Dim     index           As Byte
    Dim     Seconden        As Byte
    Dim     Minuten         As Byte
    Dim     Uren            As Byte
    Dim     Datum           As Byte
    Dim     Maand           As Byte
    Dim     Jaar            As Byte
    Dim     Temperatuur     As Byte
    Dim     neon            As Byte
    Symbol  Reg_Seconden    =  $00 
    Symbol  Reg_Minuten     =  $01
    Symbol  Reg_Uren        =  $02
    Symbol  Reg_Dag         =  $03
    Symbol  Reg_Datum       =  $04
    Symbol  Reg_Maand       =  $05
    Symbol  Reg_Jaar        =  $06
    Symbol  Lezen           =  %11010001
    Symbol  Schrijven       =  %11010000

    Clear

    While 1 = 1 
        Tijd:
            For index = 0 To 50
                I2CIN  SDA, SLC, Lezen, Reg_Uren, [Uren]     
                I2CIN  SDA, SLC, Lezen, Reg_Minuten, [Minuten]
                I2CIN  SDA, SLC, Lezen, Reg_Seconden, [Seconden] 
                neon = %01111001
                
                SHOut Data_Pin, klok, msbfirst, [neon \ 8]
                DelayUS 20
                SHOut Data_Pin, klok, msbfirst, [Uren \ 8]
                DelayUS 20
                SHOut Data_Pin, klok, msbfirst, [Minuten \ 8]   
                DelayUS 20
                SHOut Data_Pin, klok, msbfirst, [Seconden \ 8]   
                High ZetVast
                DelayUS 20
                Low ZetVast
                If KnopR = 0 Or KnopM = 0 Or KnopL = 0 Then
                    GoSub TijdInst
                EndIf
                DelayMS 200
            Next
        Date:
            For index = 0 To 10
                I2CIN  SDA, SLC, Lezen, Reg_Jaar, [Jaar]
                I2CIN  SDA, SLC, Lezen, Reg_Maand, [Maand]
                I2CIN  SDA, SLC, Lezen, Reg_Datum, [Datum] 
                neon = %01111010
                    
                SHOut Data_Pin, klok, msbfirst, [neon \ 8]
                DelayUS 20
                SHOut Data_Pin, klok, msbfirst, [Datum \ 8]
                DelayUS 20
                SHOut Data_Pin, klok, msbfirst, [Maand \ 8]   
                DelayUS 20
                SHOut Data_Pin, klok, msbfirst, [Jaar \ 8]   
                High ZetVast
                DelayUS 20
                Low ZetVast
                If KnopR = 0 Or KnopM = 0 Or KnopL = 0 Then
                    GoSub DatumInst
                EndIf 
                DelayMS 200
            Next       
        Temp: 
            For index = 0 To 10
                I2Cin SDA, SLC,$91,[Temperatuur] 
                Temp1 = Temperatuur / 10
                Temp2 = (Temperatuur - (Temp1 * 10))
                Temperatuur = Temp2
                Temperatuur.7 = Temp1.3 
                Temperatuur.6 = Temp1.2
                Temperatuur.5 = Temp1.1
                Temperatuur.4 = Temp1.0
                   
                neon = %00100100
                
                SHOut Data_Pin, klok, msbfirst, [neon \ 8]
                DelayUS 20        
                SHOut Data_Pin, klok, msbfirst, [$FF \ 8]
                DelayUS 20
                SHOut Data_Pin, klok, msbfirst, [Temperatuur \ 8]   
                DelayUS 20
                SHOut Data_Pin, klok, msbfirst, [$FF \ 8]   
                High ZetVast
                DelayUS 20
                Low ZetVast
                DelayMS 200
            Next
    Wend  


TijdInst:
    I2CIN  SDA, SLC, Lezen, Reg_Uren, [Uren]     
    I2CIN  SDA, SLC, Lezen, Reg_Minuten, [Minuten]
    I2CIN  SDA, SLC, Lezen, Reg_Seconden, [Seconden] 
    neon = %01111001
    While 1 = 1 
        SHOut Data_Pin, klok, msbfirst, [neon \ 8]
        DelayUS 20
        SHOut Data_Pin, klok, msbfirst, [Uren \ 8]
        DelayUS 20
        SHOut Data_Pin, klok, msbfirst, [Minuten \ 8]   
        DelayUS 20
        SHOut Data_Pin, klok, msbfirst, [Seconden \ 8]   
        High ZetVast
        DelayUS 20
        Low ZetVast
        DelayMS 200
        Inc Teller
        If KnopR = 0 Then
            BCD_Opt = Seconden
            GoSub bcd_tellen
            Seconden = BCD_Opt
            Teller = 0
        EndIf
        If KnopM = 0 Then
            BCD_Opt = Minuten
            GoSub bcd_tellen
            Minuten = BCD_Opt
            Teller = 0
        EndIf
        If KnopL = 0 Then
            BCD_Opt = Uren
            GoSub bcd_uur
            Uren = BCD_Opt
            Teller = 0
        EndIf
        DelayMS 250
        If Teller = 12 Then Break
    Wend
    'Wegschrijven
    I2COUT SDA, SLC, Schrijven ,Reg_Seconden, [Seconden]
    I2COUT SDA, SLC, Schrijven ,Reg_Minuten, [Minuten]
    I2COUT SDA, SLC, Schrijven ,Reg_Uren, [Uren]


Return
bcd_tellen:
    Temp1 = BCD_Opt & %00001111 'Xor
    Temp2 = BCD_Opt - Temp1
    Temp2 = Temp2 >> 4
    Inc Temp1
    If Temp1 > 9 Then
        Temp1 = 0
        Inc Temp2
        If Temp2 > 5 Then
            Temp2 = 0
        EndIf
    EndIf  
    Temp2   = Temp2 << 4   
    BCD_Opt = Temp2 + Temp1


Return   
bcd_uur:
    Temp1 = BCD_Opt & %00001111 'Laagste bits doorlaten 
    Temp2 = BCD_Opt - Temp1
    Temp2 = Temp2 >> 4
    Inc Temp1
    If Temp1 > 9 Then
        Temp1 = 0
        Inc Temp2
        If Temp2 > 5 Then
            Temp2 = 0
        EndIf
    EndIf  
    Temp2   = Temp2 << 4   
    BCD_Opt = Temp2 + Temp1
    If BCD_Opt > 23 Then
        BCD_Opt = 0
    EndIf
Return    


DatumInst:
    I2CIN  SDA, SLC, Lezen, Reg_Jaar, [Jaar]
    I2CIN  SDA, SLC, Lezen, Reg_Maand, [Maand]
    I2CIN  SDA, SLC, Lezen, Reg_Datum, [Datum]
    neon = %01111010
    While 1 = 1 
        SHOut Data_Pin, klok, msbfirst, [neon \ 8]
        DelayUS 20
        SHOut Data_Pin, klok, msbfirst, [Datum \ 8]
        DelayUS 20
        SHOut Data_Pin, klok, msbfirst, [Maand \ 8]   
        DelayUS 20
        SHOut Data_Pin, klok, msbfirst, [Jaar \ 8]    
        High ZetVast
        DelayUS 20
        Low ZetVast
        DelayMS 200
        Inc Teller
        If KnopR = 0 Then
            BCD_Opt = Jaar
            GoSub bcd_jaar
            Jaar = BCD_Opt
            Teller = 0
        EndIf
        If KnopM = 0 Then
            BCD_Opt = Maand
            GoSub bcd_Maand
            Maand = BCD_Opt
            Teller = 0
        EndIf
        If KnopL = 0 Then
            BCD_Opt = Datum
            GoSub bcd_Datum
            Datum = BCD_Opt
            Teller = 0
        EndIf
        DelayMS 250
        If Teller = 12 Then Break
    Wend
    'Wegschrijven
    I2COUT SDA, SLC, Schrijven ,Reg_Jaar, [Jaar]
    I2COUT SDA, SLC, Schrijven ,Reg_Maand, [Maand]
    I2COUT SDA, SLC, Schrijven ,Reg_Datum, [Datum]


Return
bcd_jaar:
    Temp1 = BCD_Opt & %00001111 'Xor
    Temp2 = BCD_Opt - Temp1
    Temp2 = Temp2 >> 4
    Inc Temp1
    If Temp1 > 9 Then
        Temp1 = 0
        Inc Temp2
        If Temp2 > 9 Then
            Temp2 = 0
        EndIf
    EndIf  
    Temp2   = Temp2 << 4   
    BCD_Opt = Temp2 + Temp1


Return  
bcd_Maand:
   Temp1 = BCD_Opt & %00001111 'Laagste bits doorlaten 
    Temp2 = BCD_Opt - Temp1
    Temp2 = Temp2 >> 4
    Inc Temp1
    If Temp1 > 9 Then
        Temp1 = 0
        Inc Temp2
    EndIf  
    Temp2   = Temp2 << 4   
    BCD_Opt = Temp2 + Temp1
    If BCD_Opt = $13 Then
        BCD_Opt = 1
    EndIf    
    If BCD_Opt = 0 Then
        BCD_Opt = 1
    EndIf
Return


bcd_Datum:
   Temp1 = BCD_Opt & %00001111 'Laagste bits doorlaten 
    Temp2 = BCD_Opt - Temp1
    Temp2 = Temp2 >> 4
    Inc Temp1
    If Temp1 > 9 Then
        Temp1 = 0
        Inc Temp2
    EndIf  
    Temp2   = Temp2 << 4   
    BCD_Opt = Temp2 + Temp1
    If BCD_Opt = $32 Then
        BCD_Opt = 1
    EndIf
    If BCD_Opt = 0 Then
        BCD_Opt = 1
    EndIf
Return
End

The hex file: Link.

The next step is making the case. But this may take a while.