So I am building my first clock with numitron tubes IV-9, arduino micro pro, TPIC6B595 shift registers and clock module. Currently arduino, shift registers and tubes are soldered onto pcb board and now I am working with code to display separate digits on tubes. There is a problem when I shiftOut all 4 bytes one by one. Last tube in the chain always show correct number but first three ones does not with some digits.
Here is my code.
////Pin connect to Latch
const int latchPin = 7;
////Pin connected to Clock
const int clockPin = 6;
////Pin connected to Data
const int dataPin = 5;
//B00000001 //9
//B00000000 //8
//B00011111 //7
//B10000000 //6
//B10000001 //5
//B00110011 //4
//B00001001 //3
//B01001000 //2
//B00111111 //1
//B00000100 //0
//B11111111 //blank
void setup() {
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
void loop() {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, ~B00000001); //minutes first digit
shiftOut(dataPin, clockPin, MSBFIRST, ~B00000001); //minutes second digit
shiftOut(dataPin, clockPin, MSBFIRST, ~B00000001); //hours first digit
shiftOut(dataPin, clockPin, MSBFIRST, ~B00000001); //hours second digit
digitalWrite(latchPin, HIGH);
delay(1000);
}
I made pictures with all digits shifted out as code currently shows. Started with blank byte and ended with number 9. Pictures
First image is layout and last one is overall setup.
As you can see from the pictures that blank works fine. Nothing is light up. Zero works as well. Then comes number one but only the last tube in shift register lineup shows correctly.
Number 2 is messed up. Number 3 is ok. Number 4 is messed up. Number 5 shows 9 on first three ones. Number 6 shows 8 on first three ones. Number 7 shows 1 on first three ones. Number 8 is ok. Number 9 is ok as well.
Note that on pictures where numbers are photographed, first tube from the left is the one that takes serial input. Output moves from left to right so the most right one is the last in chain.
Seems to me that this is code error but I maybe wrong. Please help me out
Hello. The code you posted should show the same pattern on each digit. Anything else would suggest wiring errors or faulty components, not code errors.
0.1uC ceramic caps on each shift register.
Little guys like these http://www.dipmicro.com/store/C5K10-50
You can see them next to the shift registers on this board:
Those would be beneficial to help smooth the current when switching happens. But you still need the bypass caps as well, and they need to be smaller value, around 0.1uF. Digital chips can misbehave strangely without them, and its not worthwhile trying to figure out what's going on until you put the caps in.
Bad news. Bought some 104 capacitors and even separated SRCLR power from VCC and put 10kO resistors like in the datasheet but same results. Here are some updated pictures of final layout. Arduino VCC is going to shift registers VCC only. Numitron and SRCLR power comes from separate power source since numitron take about 140ma (max) each tube thats 560ma (max)
Paul__B:
OK, so going from the start, it was pointed out that code would light one (same) segment only of every digit.
That's what the OP intended, for purposes of testing. But the digits do not appear the same. Sounds like the right-hand one is always correct (yes?). The other 3 always match each other but do not always match the right-hand digit (yes?). Its hard to see on some of those pics because of the reflections on the glass tubes make it hard to see which segments are lit.
I believe these issues are most likely to be incorrect wiring or shorts. I suggest disconnecting the power, removing the tpic chips from their sockets and performing some continuity checks with a multimeter. For each digit leg on the tubes, check continuity with the correct pin in the corresponding tpic's socket, and no continuity on any other socket pins (which would indicate a short).
PaulRB:
That's what the OP intended, for purposes of testing. But the digits do not appear the same. Sounds like the right-hand one is always correct (yes?). The other 3 always match each other but do not always match the right-hand digit (yes?). Its hard to see on some of those pics because of the reflections on the glass tubes make it hard to see which segments are lit.
I believe these issues are most likely to be incorrect wiring or shorts. I suggest disconnecting the power, removing the tpic chips from their sockets and performing some continuity checks with a multimeter. For each digit leg on the tubes, check continuity with the correct pin in the corresponding tpic's socket, and no continuity on any other socket pins (which would indicate a short).
Yes, you are correct on all questions.
I looked for short, but no luck.
I also thought that maybe it was signal travelling from Arduino going too fast maybe so I tried this thread solution but still the same results.
Okay found out that the last tube that I used pin layout reference for other tubes was different that other three tubes that had the same one, so it was wiring problem after all.
Sorry for that and thanks for help. Will post pics once this clock is done