Home-Automation-HAT

From SB-Components Wiki

Home Automation HAT

Home Automation HAT is a Home monitoring and automation controller HAT for the Raspberry Pi that can control up to 2 appliances/devices on a load of 250 VAC/7A, 30 VDC/10A, photo-coupling isolation Optocoupler EL357NC, allowing users to safely control high voltages or current devices. Home-Automation HAT makes appliances smart, which users can operate via the PiRelay app on their electronic device.

Features

  • Compatible with Raspberry Pi 4, 3B+,3,2,Zero
  • Relay Status Indicator
  • Comes With Development Resources, including examples in Python
  • COM, NO(Normally Open) & NC(Normally Closed) are available for each relay
  • Connectivity of Relay With RPi Without GPIO
  • Connectivity Using Stack Method
  • Onboard Power LED Indicator
  • Make Your Home IoT Enabled
  • Relay Control Pins Selection Jumper

Specifications

  • Operating Voltage - 220V AC (Via Terminal Block)
  • External Load - 250 VAC/7A, 30 VDC/10A
  • Relay Channels - 2
  • Trigger Signal - 3.3/5V
  • Optocoupler - (CTR: 50~600% at IF= 5mA, VCE = 5V)
  • External Power Supply - Via Terminal Block
  • GPIO - 40 Pins Stacking Header
  • Load Connector - Screw Terminal Block for each Relay(Output)
Home Automation HAT
Buy it From : Click Here

Pinout

Relays BOARD BCM Wiring Pi
Relay 1 35 GPIO 19 24
Relay 2 33 GPIO 13 23

Installation

CAUTION: Be careful when working with the electrical product. Special supervision of parent/adult is required to keep children from hurting themselves.

Connection Diagram

Home Automation Conn.png

Raspberry Pi (Using PiRelay App)

PiRelay is an Android app you can use to Switch or Pulse the GPIO Pins of a Raspberry Pi connected to Relays. To use this app you will need to setup your Raspberry Pi and Relays. App Download link: https://play.google.com/store/apps/details?id=com.jasonfindlay.pirelaypro

  • To setup PiRelay on Raspberry Pi, run the below commands one by one. Must complete all commands to make it work with Raspberry Pi.

Commands to Install: WiringPi, Apache, PHP & Download the GPIO PHP File

sudo apt-get update
sudo apt-get install wiringpi apache2 libapache2-mod-php -y
sudo wget https://pirelay.jasonfindlay.com/downloads/gpio.dl
sudo mv gpio.dl /var/www/html/gpio.php


Setting Up Your Android Device

PiRelay-APP.PNG

  • Make sure your Pi and Android Device are on the same network. Then in the app settings, you can define a custom Server URL. This is the network path to your Raspberry Pi. The default path is " http://raspberrypi/ ", however, you can define an IP address or a custom URL. To set up communication with your Raspberry Pi, click on ≡ >> Pi URL Addresses, then set Pi 1 : Your Pi IP Address (for eg: http://192.168.1.14)
  • To turn on/off relays, Use Pins as Wiring Pi pinout shown above in Pinout table.
  • To setup Relays, Click on ≡ >> Number of Relays, and set it to 2.
  • Now again click on ≡ >> Setup Relays, Now click on any relay and set WiringPi Pin for Relay 1 as 24, and Relay 2 as 23. You can also set Relay default status here.
  • Now move back to the home screen and click on On/Off button to turn on/off relays.

Raspberry Pi (Using Python)

  • Connect Home Automation HAT on GPIO header of Raspberry Pi.
  • Clone or download the Home Automation HAT GitHub repository by running the below command. It will clone the repository on /home/pi location.
git clone https://github.com/sbcshop/Home-Automation-HAT.git
  • Run the below command to enter the cloned repository. You can also use GUI to open cloned repository folder from the /home/pi location.
cd Home-Automation-HAT
  • To test code, run the below command. It will turn on and off the relay at an interval of 0.5 seconds.
python3 test.py
  • You can also run the GUI code by running the below command. It will open a window with 2 Buttons, You can use these two buttons to control the relays.
python3 Home_Auto_GUI.py


Home Auto GUI.gif

Resources

Github