Experiment 16: Relay Module on PcDuino





Introduction: 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.

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




    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Pro Tips Challenge

      Pro Tips Challenge
    • Science of Cooking

      Science of Cooking

    We have a be nice policy.
    Please be positive and constructive.




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