Incompatibility between 5v processor and 12v source
You need to do something like this:







simulate this circuit &ndash; Schematic created using CircuitLab

The digit select line must be High to select the digit - thia may require a software change.  Otherwise, you would need another NPN to invert the signal.