ARDUINO UNO AND 5V TWO CHANNEL RELAY BOARD PROBLEM

hello all ,

i am newbie in this forum and this is my first post.

i have some problem when interfacing 5v relay and arduino uno board.

i have connected relay board with arduino as follows.

arduino 5v- relay board 5v (jd-vcc & vcc has jumper ) arduino gnd-relay board gnd arduino 12 pin-relay in1 arduino 9 pin- relay in2

now what happens when i write " pinMode(12,OUTPUT); pinMode(9,OUTPUT); in setup" and

as i upload this code, both of the relays get energised !!!!

i dont understand that without write code "digitalWrite(12,HIGH) " why the relay energised ???

now in second case when declare pinMode(12,LOW); or pinMode(9,LOW); in void loop only then relay is not getting energised. but sometimes randomly gets energised and de-energised !!! its reallly strange operation.

please help me to get rid of this problem.

my application is that i have connected gsm modem to arduino uno pin 2 & 3. and i have wrote code that whenever we calls the gsm modem then arduino energised pin12 connected relay for 3 second. as the relay operation is arbitary on or off is going on. how can i be sure for desired relay operation.

thanks in advance

There's no such commands as pinMode(12,LOW); or pinMode(9,LOW);

You mean this?

digitalWrite(12,LOW);
digitalWrite(9,LOW);

In any case, you should post your whole sketch and a link to the board's datasheet.

Hi, Also I think the relay PCB you have, an output LOW will energize and an output HIGH will de-energize the relay. That is why when you declare them as output, they become output LOW by default.

Tom.... :)

You can set the pins to the correct value (HIGH or LOW) before enabling the output with pinMode(). This way you don't get a glitch of the 'wrong' output when starting up.

hello and thank you all of you for guide me....

now my problem is almost solved as i got some googled and found some nice info athttps://arduino-info.wikispaces.com/ArduinoPower

another thing that i came to know that my relay board is active low type so as i wrote code as follows sequence i got desired result without glitch.

digitalWrite(9,HIGH); pinMode(9,OUTPUT);

tested and working ok. :) :)

as in my query i told about glitch in relay , its may be due to use 12v 1A power adaptor for gsm modem sim900. actually it needs 2A power supply.

http://www.gsm-modem.de/M2M/m2m-faq/power-consumption-gsm-gps-tracker/ so i hope after purchasing 12v 2A power supply i will get the desired operation.