Arduino home electricity relays

Electronics

2016-05-09 22:38:33

I wanted to try some simple projects using relays and the Arduino (or possibly Raspberry PI later on) to toggle standard electric devices in my house on and off. Lights, my stereo, things like that.

I looked on Amazon for some relays that can have 250V/1+A as the load, but can still be simply plugged into the Arduino, and I found these: 4 Songle srd-05vdc-sl-c relays on a board They are just 4 relays all wired up including status LEDs on a board a little larger than an Arduino Uno. I bought two of these boards, thinking that one might be broken, as these cheap chinese electronics often are. After 3 weeks, they finaly arrived in an envelope without any explanation, just the two boards. They are super easy to set up, though there are things to watch out for if you don't use them with an Arduino as they expect you to.

Wiring up the Relays

Getting the relays to work was super easy. I plugged VCC and GND into the VCC and GND pins on the Arduino, IN1 into Arduino pin 3 and wrote a quick sketch that toggle pin 3 between HIGH and LOW every 5 seconds to try it out and take some resistance measurements. It seems to be all working fine, though I have not yet tested it with real load. The relays make quite a load click when switching, but switching a light on/off by hand does as well, so that's fine.

Working with the Raspberry PI

The Raspberry PI uses 3.3V instead of 5V which leads to problems. The higher current (lower voltage -> higher current) can potentially destroy the transistors on the board. And 3.3V are not enough to even switch the relay in the first place. It uses an optocoupler, meaning an LED is used to turn the load circuit on or off. Since there also is the status LED and a resistor to get the 5V down to what the LEDs need, 3.3V doesn't give them 1,8V each anymore. So the "simplest" solution is to either remove the status LEDs and replace them with a simple wire, or to short-circuit them. Both gives enough power to the optocoupler and transistor, so that they can work safely. Then you have to pull the VCC<->JD-VCC Jumper and provide a seperate 5V source for the relays which you connect to JD-VCC and GND. The 3.3V of the RasPI are not enough for the relays themselves.

further projects

Now that I have tested these, I'll get into how to isolate them correctly, because there is no built-in protection from touching the 230V load circuit pins on the bottom of the board. So I'll have to get/build a case for that so that it is safe to use with high voltages. Also I'll get some boards with just one relay on them, since they probably are what I'll need most of the time.