I'm trying to make a Nixie clock based on an ESP32. I've made a working prototype on a breadboard. Only the 74HC595 part, which is where the problem is at:
I then made a PCB:
After soldering everything to it (I've verified every solder connection, it's all good,) the 74HC595 behaves randomly. Each time I start it, the output values are all random until it settles on a number. I have tried everything I saw on the internet but nothing works. I also tried adding a bunch of capacitors but it doesn't work either.
Here are the results after soldering:
How to troubleshoot this?
Here is the test code U'm using for both the working prototype and the PCB:
//uint8_t latchPin = 19;
//uint8_t clockPin = 21;
//uint8_t dataPin = 18;
uint8_t latchPin = 33;
uint8_t clockPin = 25;
uint8_t dataPin = 32;
const byte segments[10] = { // Lookup table for digit patterns (common cathode)
0b11110000, // 0
0b00001111, // 1
0b11110000, // 2
0b00001111, // 3
0b11110000, // 4
0b00001111, // 5
0b11110000, // 6
0b00001111, // 7
0b11110000, // 8
0b00001111 // 9
};
void setup() {
// Set control pins as outputs
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
Serial.begin(115200); // Start serial communication for debugging
Serial.println("Starting...");
displaySegments(0x00000000); // reset on startup, not needed just makes it look better ig
delay(1000);
}
void loop() {
// Loop through each digit pattern (modify for specific display)
for (int i = 0; i < 10; i++) {
shiftOutt(dataPin, clockPin, MSBFIRST, segments[i]);
digitalWrite(latchPin, LOW); // Latch the data
delay(2000); // Short delay for visibility (adjust as needed)
digitalWrite(latchPin, HIGH); // Unlatch for next data
Serial.print("Displaying: ");
Serial.println(segments[i]);
}
}
void displaySegments(byte pattern) {
shiftOutt(dataPin, clockPin, MSBFIRST, pattern);
digitalWrite(latchPin, LOW);
delayMicroseconds(1000); // no need to edit this
digitalWrite(latchPin, HIGH);
}
void shiftOutt(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) // just in case
{
uint8_t i;
for (i = 0; i < 8; i++) {
if (bitOrder == LSBFIRST)
digitalWrite(dataPin, !!(val & (1 << i)));
else
digitalWrite(dataPin, !!(val & (1 << (7 - i))));
digitalWrite(clockPin, HIGH);
digitalWrite(clockPin, LOW);
}
}
EDIT: Thanks for all your answers ! I read them all and tried all of them, but it still behaves randomly. What i tried:
- Added 104 (0.1 µF) ceramic capacitors between GND and VCC for both the 74HC595 and K155NA1
- Added some delay between each clock pulse: delayMicroseconds(2000); digitalWrite(clockPin, HIGH); delayMicroseconds(2000); digitalWrite(clockPin, LOW);
- Disconnected the power supplies of the K155NA1 and connected them to the 3V3 of the ESP32
Nothing has worked so far