know connected and disconnected device from/to power 12v with arduino

I have a device connected to 12v I want when I disconnect this device manualy or any probleme my arduino uno know, i can use any pin but not this two pin (3,2)
who can give me a simple circuit