I have a LDR circuit here:
I'm using it to turn on a relay that is connected to an electromagnet lock. When there is light the lock unlocks and when there isn't the lock goes back to locked.
Everything works perfectly when i'm running the LDR circuit on a 9v battery and the relay and lock on a different 12v power supply running on the same ground as the 9v battery.
However I want to run everything off of the same 12v power supply and ditch the 9v battery. When I try to remove the 9v battery and run the LDR circuit off of the same 12v power supply the lock unlocks when light hits the LDR and then when the light is gone it never locks again. I have to move the pot all the way down in order to get it to lock. Any idea whats going on here?