Hello … I’m making a home alarm and one of the components is a relay. In pin 5 is connected the ind2 and GND and voltage are ok. 110V with siren on normally open. Pin 5 is activated with a sensor pir …
In theory everything is OK … But when the pir activates (5v) the pin 5 , the relay does NOT work …
I did 20 thousand tests and manually I manage to run the relay … !! I Change the jumper to jdvcc vcc, put GND and voltage and giving 5v to the ind2 did not work … Then I test giving GND(not 0v) to ind2 and it works !!! …
This means that the relay is NOT WORKING PROPERLY. The only way it works is passing GND (not 0v) to ind2 and changing the jumper …
Now !!! HOW I DO WITH THE ARDUINO to give GND(not 0v) to ind2…by pin 5 or another pin !!!
Your Inputs IN1 & IN2 are going thru a LED, thru the LED of the optocoupler, thru R1/R4 up to VCC.
So it is right that you have to switch it on when you apply LO Level!
The Jumper has to be to VCC - JDVCC!
Try on your Arduino digitalWrite(5, LOW), it should turn on your siren.
Can we have a look to your sketch please?
You have to switch D5 to LOW when your PIR gets high!
I set pin 5 to LOW and nothing happened. As far as I know LOW in arduino is 0v. That is why i was asking for sending GND. I'm thinking in connecting pin 5 to a resistance and the to gnd and then to ind2. Will this damage my arduino ??
attached my sketch an a diagram .. Thanks for responding
int pinrelay = 5 ; // pin for relay
void setup()
{
pinMode(pinrelay, OUTPUT); // Assign PIN is OUTPUT
How much current does your coil relay need? Arduino pins are only good for 20-25mA. 5V relays typically need more than that, so a transistor is needed to act as current buffer. You drive the Arduino output high, the transistor turns on, the relay coil is energized.
A diode is used across the coil to dissipate coil generated current when the transistor turns off.
Here’s an example showing NPN and N-channel MOSFET as current buffers.