Close

Digit fade-in, fade out

A project log for Just Another Nixie Clock

An arduino based multiplexed, cross-fading IN-14 Nixie tube clock.

kevin-mosseyKevin Mossey 05/26/2021 at 14:190 Comments

In the last log I talked about having gotten the anode switching working, but the Arduino's built in pw modulation doesn't run at a frequency that is fast enough to actually do a proper crossfade.

Nevertheless, when not multiplexing (aka direct drive of each digit) the built in pw modulation is enough to fade digits out, switch to the next one, and fade it in.

The code I used to do this was something like this: (again, recreated from memory after the fact and I haven't debugged it so it might not work).  This would be the replacement of the for loop from the last log.

  for (int x=0; x<9; x++) {
    for (int pw=250; pw>0; pw=pw-25) {
      analogWrite(anode, pw);
      delayMicroseconds(10);
    }
    analogWrite(anode, 0);      // turn off anode before changing digit
    update_tube(x);
    for (int pw=0; pw<250; pw=pw+25) {
      analogWrite(anode, pw);
      delayMicroseconds(10);
    }
    analogWrite(anode, 255);
    while (current_micros - step_start_time < 750)
    {
      current_micros = micros();
    }
  }

Even though I'm not using this effect in my clock, I think it's beautiful.  Maybe in the next one!  Next up: replacing all the delayMicroseconds() and weird while{} loops with timer interrupts.

Discussions