Shield to control 6 relay, 6 digital input and 6 analog input with Arduino Duemilanove, Arduino UNO or Seeeduino. The digital inputs and relay outputs are equipped with an LED that indicates the status. The lines of I/O are connected to the Arduino through corresponding pin-strip pitch 2.54 mm. It gets its power directly from the Arduino module, which provides the 5 volt regulator derived from their contacts between the 5V and GND. The mini-relay Shield of work at 12 volts, so that the relays are working properly will have to connect the Arduino module with an external power supply can provide this voltage. The card can be used in many applications and in many ways. Find in this page a little sketch as to manage I/O via serial commands.

[slideshow id=8]
//Relay Shield
//by Boris Landoni
//www.open-electronics.org
//www.futurashop.it

// Variables will change:
int in=0;             
int out=0;
int an=0;
int inByte=0;

// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 1000;           // interval at which to blink (milliseconds)

void setup() {

    // start serial port at 9600 bps:
  Serial.begin(9600);

  // set the digital pin as output:
  for (int out=8; out<=13; out++){
    pinMode(out, OUTPUT);      
  }
}

void loop()
{
  // here is where you'd put code that needs to be running all the time.

  // check to see if it's time to blink the LED; that is, if the 
  // difference between the current time and last time you blinked 
  // the LED is bigger than the interval at which you want to 
  // blink the LED.

  if (Serial.available() > 0) {
    protocollo();
  }

}

void protocollo()
{
  inByte = Serial.read();
    switch (inByte) 
    {
        case 79: //O  out

          Serial.println("Out number? (1 to 6)");   // send an initial string
            while (Serial.available() <= 0) 
            {
              delay(300);
            }

            out = Serial.read()-48;
            Serial.println("ricevuto ");
            Serial.print(out);
            if (out>=1&&out<=6)
            {
              out=out+7;
              if (!digitalRead(out))
                digitalWrite(out, HIGH);
              else
                digitalWrite(out, LOW);

              Serial.print("Out ");
              Serial.print(out-7);
              Serial.print(" = ");
              Serial.println(digitalRead(out));
            }

          break;

        case 73: //I
          //input

          Serial.println("In number? (1 to 6)");   // send an initial string

            while (Serial.available() <= 0) 
            {
              delay(300);
            }

            in = Serial.read()-48;
            if (in>=1&&in<=6){
            in=in+1;

            Serial.print("In ");
            Serial.print(in-1);
            Serial.print(" = ");
            Serial.println(digitalRead(in));
            }
          break;

          case 65: //A
          //analog

          Serial.println("Analog number? (1 to 6)");   // send an initial string

            while (Serial.available() <= 0) 
            {
              delay(300);
            }

            an = Serial.read()-48;
            if (an>=1&&an<=6){
            an=an-1;

            Serial.print("Analog ");
            Serial.print(an+1);
            Serial.print(" = ");
            Serial.println(analogRead(an));
            }
          break;

        //default: 
          // if nothing else matches, do the default
          // default is optional

    } 

}

Next Page >


11 thoughts on “Relay Shield for Arduino”
  1. Very good job, just what i need, y will buy, it is posible you make one for Arduino Mega 1280 with 16 relay, if you send my proto details, y will pay you, how can i contact you?

  2. Two questions:

    First:
    What type of relays do you have on the board?
    Normally Open?, Normally Closed?, Bistable?

    Second:
    Where can I buy it?
    I don’t see the option to add it to the cart

    Thanks!!!

  3. Is there a way of adapting this circuit to an arduino board?

    The relays I found are bigger than the space on the board.. do you have the EAGLE or PCB Wizard file, in order for me to go ahead and adapt it?

    Thanks,

    Kevin

  4. it’d be really useful as I found the relays but are milimeter or two bigger and won’t fit on the pcb.

    By the way, I’m reading 4,75v on the diode in parallel with the relay and the led + resistor.

    Where am I failing to get the 12v? correct me if wrong, but is it the NPN transistor’s fault, not to amplify up to 12v?

    also, on the schematic.. I see J1, J2 and J3.. how are they connected between? I’m pretty new on electronics and it’s getting complicated..

    Greetings from Argentina ^^

Leave a Reply

Your email address will not be published. Required fields are marked *