B4R Tutorial Relays, don't get caught out

Peter Simpson

Expert
Licensed User
Not really a tutorial as I'm no good at writing tutorials, but important to know nevertheless.

WARNING: Relays can be used to switch very high voltages. Here in the UK 240VAC can easily kill a person, so be very careful when handling relays.

What is a relay, well I look at it in 2 ways.
  1. A device for switching both Low and High voltage On/Off by means of a similar or smaller voltage.
  2. A device for redirecting both Low and High voltage (from one part of a circuit to another part) from NC (Normally Closed) to NO (Normally Open) and vice versa by means of a similar or smaller voltage.
Digital pins set to OUTPUT.
As the digital out pins on the Arduino/ATmega328p and the WeMos/8266 send out different voltages, it's a good idea to purchase a relay that triggers at both 3.3v and 5v, that's where the SRD-05VDC-SL-C relay comes into its own. I do not recommend that you use a DC to DC BUCK converter Booster on your WeMos/8266, just use a 3.3v to 5v relay or if you are using a D1 Mini you can purchase a 3.3v relay shield or use a 3.3v to 5v relay. The 5v relay triggers when it receives a voltage of around 5v, the 3.3v to 5v relay will trigger in between 3.3v and 5v, it's good for both Arduino and WeMos.

The operating voltage of the Arduino/ATmega328p is 5v and the digital pins when set to OUTPUT sends out 5v. The WeMos/8266 on the other hand has a operating voltage of 3.3v, and yes you guessed it, the digital pins when set to OUTPUT sends out 3.3v, you can measure the voltages with a multimeter and double check it yourself.

If you are using an Arduino Uno or Mega etc and for some strange reason you only have 3.3v relays, you have 3 options.
  1. You can use a voltage divider circuit using 2 resistors to drop the voltage from 5v to 3.3v.
  2. You can use a DC to DC 5v to 3.3v step down module.
  3. You can use IIC I2C DC 5v to 3.3v logic level converter for 2 or more relays, but you might as well just purchase 3.3v relays.
And there you have it, don't get your relays mixed up...

3.3v to 5v triggered relay
3.3v and 5v.png


5v triggered relay
5v.png


3.3v D1 Mini relay shield
D1_Shield.png
 
Last edited:
Top