# Need help coding Nixie Tubes

Hey everyone,
Recently i have been spending ALOT of time and money into building a nixie tube clock.
It has 4 IN-17 tubes each controlled by its own k155id1 controller ic. It uses an arduino nano and RTC sensor.
Everything is wired up and functions as it should but im not that good with coding.
I have tried looking for a demo code i can use but i havend found one, and i have looked into modifying other codes but they are just made way to difficult and i can’t figure it out… I have been trying to make this work for the past 5 hours but no succes :/.
Anyways if anyone of you wants to help me create this code that would be greatly appreciated (info below)
P.S pardon my grammar English is not my native language

Hour pin1 => (A = A4) (B = A3) (C = A1) (D = A3)
Hour pin2 => (A = A0) (B = 3) (C = 2) (D = 4)
Minute pin1 => (A = 5) (B = 7 ) ( C = 8 } (D = 6)
Minute pin2 => (A = 12) (B = 10) (C = 9) (D = 11)

RTC = (SCL = A5) (SDA = A6)

Image of OP:

What exactly is the part you are struggeling with? There are a ton of projects and tutorials for using an rtc, so maybe get started with that first? Instead of the tubes, you can use the serial monitor.

Note: The I2C/Wire interface to the DS3132 is on A4/A5, not A5/A6.

``````const byte HourTensPins[] = {A4, A3, A1, A3};  // A3 used TWICE?!?
const byte HourUnitsPins[] = {A0, 3, 2, 4};
const byte MinuteTensPins[] = {5, 7, 8, 6};
const byte MinuteUnitsPins[] = {12, 10, 9, 11};

void WriteNixie(const byte pins[4], byte digit)
{
digitalWrite(pins[0], digit & 1);
digitalWrite(pins[1], digit & 2);
digitalWrite(pins[2], digit & 4);
digitalWrite(pins[3], digit & 8);
}

void WriteTime(byte hour, byte minute)
{
WriteNixie(HourTensPins, hour / 10);
WriteNixie(HourUnitsPins, hour);
WriteNixie(MinuteTensPins, minute / 10);
WriteNixie(MinuteUnitsPins, minute);
}
``````

If you are struggling with writing code then you need to learn the basics. Work through the examples in the IDE, on this web site and elsewhere.

If you really don't fancy that and want someone else to do it for you then click on 'report to moderator' and ask them to move this to 'gigs and collaborations'; there are people there who will take paid commissions.

johnwasser: Note: The I2C/Wire interface to the DS3132 is on A4/A5, not A5/A6. I'm confused by this could you elaborate?

``````const byte HourTensPins[] = {A4, A3, A1, A3};  // A3 used TWICE?!?
my bad first A3 is supposed to be A2 (sloppy notes)
``````

[/quote]

PerryBebbington: If you are struggling with writing code then you need to learn the basics. Work through the examples in the IDE, on this web site and elsewhere.

If you really don't fancy that and want someone else to do it for you then click on 'report to moderator' and ask them to move this to 'gigs and collaborations'; there are people there who will take paid commissions.

I more hoping for someone to guide my trough the process so i could also learn from it...

I more hoping for someone to guide my trough the process so i could also learn from it...

Fair enough, that's clear.

You need to learn the basics. Work through the examples in the IDE, on this web site and elsewhere.

Anything else is asking us to give you a personalised, individual training course in C/C++. The tutorials will get you started, come back and ask questions when you get stuck with those. At some point you will have learnt enough to understand what you are trying to do with your clock.

You wrote

RubenBuildsStuff: RTC = (SCL = A5) (SDA = A6)

That should be RTC = (SCL = A4) (SDA = A5)

Of course that mean you can't use A4 for a Nixie pin and A6 and A7 can't be used for digital I/O at all. Looks like you are out of I/O pins. If you don't use Serial you could use Pin 0 or Pin 1 in place of A4.

Another option is to use a shift register to add output pins.

johnwasser: You wrote That should be RTC = (SCL = A4) (SDA = A5)

Of course that mean you can't use A4 for a Nixie pin and A6 and A7 can't be used for digital I/O at all. Looks like you are out of I/O pins. If you don't use Serial you could use Pin 0 or Pin 1 in place of A4.

Another option is to use a shift register to add output pins.

Thank you sir im going to look into buying some shift registers

You may just get away with only 2 Arduino pins for the high hours nixie driver chip because this will only ever display a 0, 1 or 2 (assuming a 24 hour clock). Shift registers or a port expander would be a nicer solution though to free up some pins. A 16 bit I2C port expander would mean using only 2 Arduino pins (A4 and A5) for the whole clock. To preserve the Nixie tubes anyway, it is best to periodically run through a cycle of displaying all digits to prevent “cathode poisoning” so really you should be able to use all digits on all tubes. I’d start simply by attempting to display all digits on each Nixie tube, then integrate the clock later. Look up BCD (binary coded decimal) to understand the relationship between the Arduino pin values and the displayed digit. @johnwasser has already supplied such code.