Tested on:Raspberry Pi 2; Raspberry Pi B+; Python 2.7; Raspbian pre Jessie
Prerequisites:Raspberry Pi with Raspbian Jessie(see steps 1-5 in the Introduction)
Hardware:1 Sainsmart 250V Relays Board
1

Trigger 230V devices with the SainSmart Relays Board

The 250V relays from the Sainsmart board are a great possibility for cheap home automation with the Raspberry Pi since they can trigger most common devices like lamps, electrical heating or ventilation and a board with 8 relays costs only around 12$. Use a temperature sensor to trigger ventilation and heating automatically, add a browser-based remote control for your mobile or use Jasper for voice recognition abilities: i, for one, welcome our siliconid overlords.

Disclaimer
There are some differing wiring diagrams for the SainSmart relays boards in the internet with added transistors and resistors. They should prevent mistriggering and protect the Raspberry Pi. The plain connection shown in this tutorial does work for me, but that depends on the relay boards version, since SainSmart released a number of apparently similar, but slightly different relay boards.
Using the relays in a permanent setting requires an trained eletrician to check it since it’s running high voltage. Alternatively, use rc switches.

Setup
There are ten pin connectors on the relays board. The first pin is labeled VCC and should be connected to pin 2(board numbering!) for 5V. The last pin is GND and should be connected to pin 6. The others are numbered from 1 to 8 and should be connected in ascending order to the Raspberry Pi pins 3, 5, 7, 11, 13, 15, 19 and 21.

Raspberry Pi with Sainsmart 8-channel 250V relays board

Raspberry Pi with Sainsmart 8-channel 250V relays board

Script

Demo

Links
Temperature sensor tutorial: http://www.knight-of-pi.org/measure-temperature-and-humidity-with-the-sensor-dht22-am2302/
Webinterface WebIOPi tutorial: http://www.knight-of-pi.org/webiopi-a-simple-but-great-web-api-for-the-raspberry-pi/
Voice recognition with Jasper: http://www.knight-of-pi.org/voice-control-jasper-raspberry-b-plus/
Home automation with rc switches: http://www.knight-of-pi.org/cheap-home-automation-with-a-raspberry-pi-controlling-rc-switches-with-pi-switch/

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.

One Comment

Comment

Time limit is exhausted. Please reload CAPTCHA.