Power supplies, best practise, and your experience.

I'm going to be making a small project that uses an ATtiny45 to control a Sold State Relay.

The board will be inside an enclosure and I was wondering what the best way to supply it with power would be.

The enclosure will be supplied with 240v. I was thinking the best way to supply it with a steady 5v would be to disassemble a USB wall power supply to get rid of the plastic casing, remove the usb socket and mains socket to save space and wire it directly to my board.

What do you use when you need a small regulated power supply for your projects that you are turning permanent, and if the one I was planning on using is what people normally do, would it be advisable to use something like an LM7805 regulator just to be sure it was getting a regular supply?

Many thanks.

Horses for courses is what I say.

Unless I have a requirement to have the power supply embedded in the box I use an external PSU - usually something that can be picked up for a few quid in Argos.

When I have to embed the power, then it's a different matter.

It all depends really on the power requirements, and the space. Recently I created a controller for my home made reflow oven. That had the mains coming in to the box for the relays to switch, so it made sense to have the power in there too. Not much current was needed - just a PIC18 and a few relays, so I had a small transformer (240v -> 7.5v) and an LM317T configured to 5v.

If I wanted more power then I'd be looking at constructing a switching power supply, or maybe investing in a pre-built small form factor PC power supply. I have a nice tiny one (not much bigger than my mouse) on my desk that I use as a general power supply: