I've got a circuit which is powered using a 24VAC transformer fed into a KBU606G full bridge rectifier to generate 24VDC. Originally there was a 470uF smoothing capacitor, however I was unaware that it would make the output rise to 33/34V, and I don't think that having smoothed DC is necessary for the fan and relay so the cap was removed. This 24V is then dropped to 5V using an L7805 regulator and powers a PIC18f4520 and two HE3621 relays.
The PIC then powers two BC337, switching the HE3621 relays which are then used to switch 3 larger 24V relays (HF92F-024D) to ground. There is also a 24V 0.8A DC fan powered from the bridge.
The issue I'm having is that the L7805 dies whenever the three HF92F relays are powered - it's not too consistent, sometimes it dies when two are powered, sometimes it doesn't blow at all for a while. The fan also runs incredibly slowly when the PIC isn't connected, and at full speed when it is plugged in. The regulator and PIC also blow even when the fan isn't plugged in.
I know that the issue is obviously power/current related, but I can't see why the regulator is dying so much, I would've thought that the diodes would prevent any back-emf issues that could be blowing it.
I don't have much experience with relays so it's probably something obvious but any ideas on the best fix for the problem? I've also tried using an A8498 switching regulator with no luck. Should I be using a current limiting resistor on the input to the regulator?
I've attached a schematic of the circuit and the datasheets to the relays/regulator. Hopefully everything makes sense, let me know if anything needs clarifying.