Experiment 16: Relay Module on PcDuino

Intro: 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

#include

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

}

Share

    Recommendations

    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge
    • Plastics Contest

      Plastics Contest
    • Optics Contest

      Optics Contest

    Discussions

    0
    None
    russ_hensel

    4 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.