8 channel relay

The "Eleven" is our Uno-equivalent Arduino-compatible board, but with a number of improvements including prototyping area, a mini-USB connector, LEDs mounted near the edge, and the D13 LED isolated using a FET. [Product page]
Post Reply
Chris
Posts: 17
Joined: Sat Aug 30, 2014 5:37 am
Location: Adelaide, South Australia

8 channel relay

Post by Chris » Mon Sep 15, 2014 12:10 pm

Im trying to run an 8 channel relay module, with my Eleven. To start with I connected the +5v and Gnd from the Eleven to the Vcc and Gnd of the Relay board. In1 to In4 to D2,3,4 & 5.
Power it up, add this code

Code: Select all


// Basic 4 Realy board connection

// Each relay is turned on for 2 seconds and then off.

// You can here them click as there state changes from off to on and on to

// off.

// You will also see the corresponding Red LED on the 4 Relay board

// light up when the relay is on.

 

 //  define names for the 4 Digital pins On the Arduino 2/3/4/5

 //  These data pins link to 4 Relay board pins IN1, IN2, IN3, IN4


#define RELAY1  2                       

#define RELAY2  3                        

#define RELAY3  4                        

#define RELAY4  5

 

void setup()

{    

// Initialise the Arduino data pins for OUTPUT

  pinMode(RELAY1, OUTPUT);       

  pinMode(RELAY2, OUTPUT);

  pinMode(RELAY3, OUTPUT);

  pinMode(RELAY4, OUTPUT);

}

 

 void loop()

{

   digitalWrite(RELAY1,LOW);           // Turns ON Relays 1

   delay(2000);                                      // Wait 2 seconds

   digitalWrite(RELAY1,HIGH);          // Turns Relay Off

 

   digitalWrite(RELAY2,LOW);           // Turns ON Relays 2

   delay(2000);                                      // Wait 2 seconds

   digitalWrite(RELAY2,HIGH);          // Turns Relay Off

 

   digitalWrite(RELAY3,LOW);           // Turns ON Relays 3

   delay(2000);                                      // Wait 2 seconds

   digitalWrite(RELAY3,HIGH);          // Turns Relay Off

 

   digitalWrite(RELAY4,LOW);           // Turns ON Relays 4

   delay(2000);                                      // Wait 2 seconds

   digitalWrite(RELAY4,HIGH);          // Turns Relay Off        

 }

It verifys ok but when its uploaded i get an error of - avrdude: stk500_getsync(): not in sync: resp=0x30
but doesnt tell me where the problem is
Any ideas

Chris

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: 8 channel relay

Post by andrew » Mon Sep 15, 2014 8:55 pm

Can you upload a sketch to your Eleven without anything connected to it?
If so, check the connections to your relay board. If it's one of those optoisolated modules check you have the jumpers set correctly - ask the relay board supplier.

If not, check you have the right board type (Arduino Uno) and COM:/serial port set in the IDE.

Chris
Posts: 17
Joined: Sat Aug 30, 2014 5:37 am
Location: Adelaide, South Australia

Re: 8 channel relay

Post by Chris » Tue Sep 16, 2014 11:00 am

johnb wrote:and COM:/serial port set in the IDE.
Yep, that was the problem. Not sure how, but it changed
Thanks John

Chris

Post Reply