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


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

About This Instructable



More by Yanny Guo:Use pcDuino as Photo Booth Controller Use Si4703 FM Breakout Board on Arduino Uno Use SIM900 GPRS/GSM Shield on pcDuino 
Add instructable to: