I'm driving 4 coil relays with an MCU through BJTs. As I activate one by one, sometimes the third won't even turn on, and if it does, it nor anyone will turn off, as if the MCU freezed. I'm totally sure this is because of noise since Relays are 5V, the MCU is 5V and of course, the power supply is only one, and to worsen the case, it's an SMPS taken from a cellphone charger. I've improved the board by adding a 470uF decoupling capacitor very close to the MCU (ATMEGA328P), and it did indeed enhance the functionality of the MCU. Without the capacitor, it would barely turn on just one relay. Since the relays are 4, it's undoubtably the coil inductance giving the power rails a LOT of turbulence. As I've read around the Internet, the only way out of this is to use two different power supplies (and optionally an optotransistor for better isolation). One for the MCU and logical parts, and other for the relays. If you could give me a simpler solution, it'd be great, but otherwise I'd like to know if using a 12V transformer and two 7805 for each appliance is enough, or do I have to make two rectification stages or even to use two different transformers.
P.S. I've also googled on the use of Solid State Relays, but they don't seem to be very cost-efficient for this, and I don't even know if I'm going to find them available here in my country.
The schematic is this. The 470uF cap and 10k pullup resistor in RESET pin are not present here, but I added them to the board.