I'm new using arduino and i'm trying to control a desk lamp with an arduino and a relay.
I'm using a PN2222 transistor to drive relay and a 1N4001 diode because i read at some tutorials that i have to use one to avoid EMF problems. I'm using a 10k resistor plugged into the base of the transistor.
Even with the diode, when i turn off the relay, my arduino reboots.
Here is the representation of my circuit. Consider the LED like being a desk lamp.