Experiment 16: Relay Module on PcDuino




A relay is an electrically operated switch. Many relays use an electromagnet to operate a switching mechanism mechanically, but other operating principles are also used. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal. The first relays were used in long distance telegraph circuits, repeating the signal coming in from one circuit and re-transmitting it to another. Relays were used extensively in telephone exchanges and early computers to perform logical operations.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Part List

  1. 1* pcDuino kits
  2. 1*Relay module
  3. 1*DC Motor
  4. 1* button
  5. Some wires

Step 2: Diagram

Step 3: Code


#define Relay 13 int val = 0;

void setup(){ pinMode(Relay, OUTPUT); pinMode(12, INPUT); }

void loop(){ val = digitalRead(12); if(val==HIGH){ digitalWrite(Relay,HIGH); }else{ digitalWrite(Relay,LOW); }


Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest



    5 years ago on Introduction

    Great but sort of overkill, this task could be acomplished by a 1 transistor circuit instead of one with thousands and thousands of them.