The premise of this project is part of a Harry Potter themed party, it is a chess board with reed switches underneath that when the correct pieces are placed on the correct spots creates a closed circuit, and unlocks a lock underneath the board containing a clue.
For the sake of testing I have just plugged pin 8 to GND and this prints "Circuit Closed" in the serial monitor, and when I disconnect it prints "Circuit Broken", which is what I would expect, except nothing happens with the lock.
I am sure I am missing something very simple, and would appreciate some help
Do you know for a fact that the relay is switching? Have you checked for continuity with your ohm meter, across the com and whichever nc/no connection you're using, while it's supposed to be switching?
Ok so I have now used a 5V relay and am having the same problem. It doesn't appear to be switching?
The solenoid changes state if I switch the NC to the NO so it clearly works.
The only way I could get the red LED to come on the relay was to connect the pin labelled S to the 5V pin, the + to the GND pin, and the - to the A5 pin which doesn't sound right to me
I'm really sorry this is my first ever time using a relay!
Your code works for me- I jumpered pin 8 to ground, and relay opens and closes as expectd, with the signal on A5. My meter shows the relay contacts open and close.
Apart from having tested mine with meter, it gives a very clear click, and I can feel it "thunk" in my fingers. And it's literally the identical one to yours.
Perhaps you fried the arduino pin by wiring it wrong. I don’t have that type of relay but I would assume it is + to positive 5v, - to ground, S to signal which is the arduino pin that pulls to ground. I could be wrong and there should be a data sheet for the relay.
Try activating the relay without the arduino. Just wire it correctly and take the signal to ground.