Introduction: Grove Relay Basic Using Intel Edison

Hello everybody.

I am one of the lucky one who got Intel Edison from Instructables. When I got the the grove starter kit with Intel Edison, I understood what each element did except Groove smart Relay. I researched and came up with a small project to make you more familiar with Relay. Relay is kind of digital switch which opens or closes the circuit depending on the code. It could handle high voltages working only on small voltage of 5V. For the project we will first need few things.

Step 1: Parts Needed

  • Intel Edison with extension board
  • Arduino motor shield to protect Intel Edison
  • Micro-USB to USB cable
  • Grove Button
  • Grove smart Relay
  • Grove Cables
  • Male Jumper cables
  • AA Battery
  • A testing element (I used a simple DC motor)

Step 2: Connections

Using Grove cables connect button to D3 and Relay to D6. Also connect positive of the testing element (DC motor) to one of the green holes (doesn`t matter which one) on Relay element. Connect negative of testing element to negative side of battery and using male jumper cable connect positive of battery to other green hole or Relay element. Circuit can be seen in the images. Connect micro USB cable to the port closer to power supply and connect other side to computer. Using Arduino Software, copy paste the following code on one window and upload. Now DC motor runs when button is pressed.

Step 3: Code

// Edison Relay Basic
const int buttonPin = 3; // the button is attached to digital pin 3 const int relayPin = 6; // the relay is attached to digital pin 9
int buttonState = 0;
void setup()
{
    pinMode(relayPin, OUTPUT);
    pinMode(buttonPin, INPUT);
}
boolean released = false;
void loop()
{
    // read the state of the button:
    buttonState = digitalRead(buttonPin);
    
    if (buttonState == 1)   
    {
      if(released == true) {
        digitalWrite(relayPin, HIGH);
        released = false;
      }
    }
    else   
    {
      if(released == false) {
        digitalWrite(relayPin, LOW);
        released = true;
      }
    }
}

Step 4: Future Considerations

You could play with the code and use Relay for different projects. You could use a remote control for room lights and fan. If you have any questions please comment below and i will try to reply as soon as I can.

Caution:- Be very careful while messing with electric connections at home.

Small Spaces Contest

Participated in the
Small Spaces Contest

Explore Science Contest

Participated in the
Explore Science Contest

On a Budget Contest

Participated in the
On a Budget Contest