I had an Arduino monitoring a capacitive switch, but it got flakey and.. well destroyed. but my lamp had blown its switch years ago so I needed a way to turn it on and off.
Step 1: Stuff
wire, a relay module (way easier than designing your own)a old 5v wall charger, and a knife switch.
Step 2: Low Voltage End
cut and strip the end off, I tin it too.
Step 3: Into the Relay
this is a tad deceiving, the black wire goes to 5v and the green goes to signal. when you short them together, it should activate the relay. mine made an audible click.
Step 4: Add the Knife Switch
5v on one side signal on the other. when you close the switch it should click
Step 5: Add the Lamp
unplug the lamp. double check its unplugged. clip ONE side and strip a bit back (I tinned mine with solder) put it in the high side of the relay. if you have one marked NO (normal open) thats where you want one, the other goes in common.
Step 6: Slow or No Unswitching
no unswitching (but stays off when you short the signal to ground) means the signal pin isn't being pulled low. if that is the case, you want run signal and ground to the switch, and jumper 5v and signal with a big resistor (over 1k)
Step 7: Tuck and Enjoy
tuck away the relay and enjoy your simple knife switch.