Can NPN replace Relay Module

ramine:
I think I2C Digipot would be great

but i dont know how to code the i2c