You can do this with direct conversion. Simply use a rectifier, followed by a mains-rated capacitor, then connect this to your LED in series with a very large resistor. You don't need to generate 5 or 12 volts - the series resistor will limit current through the LED. Something like this:
![schematic](https://i.stack.imgur.com/JZmxW.png)
simulate this circuit – Schematic created using CircuitLab
You could go even lighter weight and use a single resistor and capacitor but for two issues: it would flicker at 60Hz, and most LEDs aren't rated to withstand mains voltage in reverse bias.
Things to look out for:
- Remember that rectified mains is 1.41 times the RMS voltage, so spec the DC part of your circuit for 338 (169) volts, not 240 (120).
- Size R1 appropriately to the amount of current you want through the diode. In the schematic above, I've sized it to allow 2mA through for 240V mains.
- Make sure R1 can handle the power dissipation; in this case it'd be 0.67 watts, so make sure you use a power resistor.
- Mains voltages everywhere! Take care, and make sure it's well insulated.
To say that the motor fits the relay specifications would need more than just the label. If it is fully compensated for its stalled start behaviour with the right start capacitor (that's still in good condition) it might be.
If it isn't compensated or not enough, or even over by a good margin, the relay may not last as long as you like.
Before you use this relay to switch any kind of mains voltage, please make sure it's new and has a clear stamp from a recognised testing institution (such as UL). I think with Radioshack chances should be good enough, but I have no personal experience.
The problem is that the middle pin, between the two pins that go to your Raspberry, is the centre contact of the switch. If the relay is badly made or you are not very careful you are effectively laying a mains wire extremely close to your logic 5V system. If they couple (physically or just through leakage) your entire Raspberry and everything it connects to may become "hot". So be weary and careful when hooking it up and make sure the relay looks good, new and reliable with some form of (international) approval.
That said, as I said the middle pin in the row of three is the middle contact. You can measure which one it makes contact with when the relay is off with a multimeter. Then use a 12V supply to turn on the coil (the outer 2 pins in the row of 3) and verify that the contact now connects with the other pin and no longer with the original one. That gives you your switch pin-out.
Then if you make this (while, again, taking care to insulate, insulate, insulate!):
![schematic](https://i.stack.imgur.com/1ZeHh.png)
simulate this circuit – Schematic created using CircuitLab
As you can see I made the mains phase the one on the switch over contact side, when the relay is off, that adds a teensy bit of extra safety, because the middle contact is not connected to phase any more. Of course only works as a trick if you are always 100% sure which the phase is.
The diode is to protect the transistor from switch-off transients.
The transistor can be any modern NPN type, or even an older BC550. Or you can replace it by a MOSFET like 2N7000 or 2N7002, but the 2N3904 is very well suited for the purpuse of relay switching up to 24V or even 48V (from memory it has 60VDC breakdown)/
Best Answer
i don't know which pin of the switch is common pin, i think it might be pin no.1 or no.2
if pin no.2 was common, do this wiring :
if pin no.1 was common, do this one :
the diode is preventing Write HIGH on your ATtiny's digital input when you just want to turn it ON and not to do that in same time (Position 2) if you tell me which pin is common pin, i'll give you the exact answer