Grove Relay Basic Using Intel Edison

by sagar.rupapara.14 in Circuits > Arduino

5117 Views, 24 Favorites, 0 Comments

Grove Relay Basic Using Intel Edison

400px-Twig-Relay.jpg

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.

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)

Connections

10965713_875022052562207_1040671633_n.jpg
10952779_875022015895544_323808520_n.jpg
10966560_875022062562206_642139750_n.jpg
10922102_875022092562203_351649729_n.jpg

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.

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;
      }
    }
}

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.