Relays are electric switches, what means that one can close the connection between two pins of it when applying a certain amount of voltage to an input

That input is connected to an internal coil that provokes a mechanical movement of a metallic piece that will make the switching

Relays are characterized by two factors: the voltage needed to activate the coil, and the voltage they can handle between the switching terminals

(in the picture, a small circuit including a relay driven by a transistor)

 

 

The cheapest and easiest alternative to drive a motor makes use of an electrically controlled switch. As mentioned earlier, the output of the microprocessor doesn't drive enough current to make the motor spin. The relay allows connecting the motor directly to a battery or a power supply. One advantage of using a relay is the simplicity of use. As interaction designers we just look into ways for prototyping a use or illustrating a functionality. The same circuit we need to drive a motor on-off can be used to turn a lamp on and off, or many other devices working with voltages and levels of current much higher than what our microprocessors can drive

The circuit exemplifying the use of relays includes another component. Again, the current the microprocessor runs on is not enough to even switch the relay. Therefore we interface our switch with a transistor

With wiring we would just need to use the command digitalWrite() to command a pin to change from high to low or vice-versa. That pin would be connected to a transistor that would again drive the relay on or off. When the relay is on, it allows the current to go through a pair of its poles, and when it is off it switches to a different pair. Thanks to this trick we can develop circuits that are on or off by default