How to Connect Device to Relay?

In short, how would one go about taking any normal, say, 2-prong desk lamp and connecting it to a relay? Do I have to cut its wire and wire it that way, or what is the best thing to do?

Don't "distroy" the lamp.

For temporary-experimental purposes, you can splice the relay into an extension cord. But, you gotta' be careful, and you might want to put the relay board in a plastic box, or wrap it in electrical tape while you're playing around.

Sometimes a regular electrical box (like the kind inside your walls) works really well, and is very economical. You put your relay in the electrical box, and simply plug-in the lamp. But, you'll have to make sure the relay board and the outlet both fit into the box.

You just go the hardware store and get an [u]outlet box[/u], an [u]outlet[/u] or two, and a [u]cover plate[/u]. Outlet boxes come in various sizes and in plastic or metal. Make sure you get one that fits the outlet. In the U.S., an outlet-plug and light switch have the same mounting holes and fit into the same-size rectangular box.

You'll also need a power cord so that you can plug-in your relay box. The easiest way is to pick-up an extension cord while you're at the hardware store, and whack-off the female end. Or you can get some lamp cord and a plug, and make the power cord yourself.

As an alternative, you can get an [u]AC outlet socket[/u] that you can install in your "project box". But whenever it's practical, I like to use a separate high-voltage "relay box" and a separate low-voltage box for my regular low-voltage electronics (the Arduino, etc.). (There has to be some low-voltage going into the relay box to turn the relay(s) on & off.)