Difference between revisions of "Home-Automation-HAT"

From SB-Components Wiki

(Created page with "<div class="row"> <div class="large-8 column"> == PiRelay 6 == PiRelay 6 channel is a relay shield that can control up to 6 appliances/devices with photo-coupling isolation...")
 
 
(35 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<div class="row">
 
<div class="row">
 
   <div class="large-8 column">
 
   <div class="large-8 column">
== PiRelay 6 ==
+
== Home Automation HAT ==
PiRelay 6 channel is a relay shield that can control up to 6 appliances/devices with photo-coupling isolation on a load of 250V AC/7 A, 30V DC/10 A, and a trigger voltage of 3.3 V. It helps the user to enhance the intelligence of the devices. It comprises an “Optocoupler” that allows the circuit to transmit an electrical signal between two isolated circuits through light energy. Optocoupler helps the user to prevent the high voltages in one part of the circuit from affecting the other part of the circuit which provides safety to the system.
+
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.
 
 
It provides a better connection of Pi Relay 6 with the Raspberry Pi that gets enabled from the standardized shield form factor. One can enable the IoT technology of their home appliances using Pi Relay 6 channel that will make their life efficient.
 
  
 
=== Features ===
 
=== Features ===
* 6 High-quality Relay and loads up to 250VAC/7A, 30VDC/10A.
+
* Compatible with Raspberry Pi 4, 3B+,3,2,Zero
* Optocoupler
+
* Relay Status Indicator
* Standardized shield shape and design.
+
* Comes With Development Resources, including examples in Python
* LED working status indicators for each Relay.
+
* COM, NO(Normally Open) & NC(Normally Closed) are available for each relay
* Pin Stacking Header for accessing GPIO of RPi.
+
* Connectivity of Relay With RPi Without GPIO
* Compatible with Raspberry Pi 4, 3B+, 3,2, Zero
+
* Connectivity Using Stack Method
 +
* Onboard Power LED Indicator
 +
* Make Your Home IoT Enabled
 +
* Relay Control Pins Selection Jumper
  
 
=== Specifications ===
 
=== Specifications ===
* Channel - 6 CH
+
* Operating Voltage - 220V AC (Via Terminal Block)
* Operating Voltage - 5V
+
* External Load - 250 VAC/7A, 30 VDC/10A
* AC Control Voltage - 7A / 250V
+
* Relay Channels - 2
* DC Control Voltage - 10A / 30V
+
* Trigger Signal - 3.3/5V
* Dimensions - 56.01 mm x 85.01 mm
+
* 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)
  
 
</div>
 
</div>
 
   <div class="large-4 column">
 
   <div class="large-4 column">
[[File:Pirelay6.png|thumb|left|alt=Pirelay 6| Buy it From : ''[https://shop.sb-components.co.uk/products/pirelay-relay-board-shield-for-raspberry-pi Click Here]'']]
+
[[File:Home_Automation_HAT.png|thumb|left|alt=Home Automation HAT| Buy it From : ''[https://shop.sb-components.co.uk/products/home-automation-hat Click Here]'']]
 
   </div>
 
   </div>
 
</div>
 
</div>
Line 29: Line 33:
 
== Pinout ==
 
== Pinout ==
 
<table class="wikitable">
 
<table class="wikitable">
<tr> <th> Relays  </th> <th>BOARD </th> <th> BCM</th> </tr>
+
<tr> <th> Relays  </th> <th>BOARD </th> <th> BCM</th> <th> Wiring Pi</th> </tr>
<tr><td> Relay 1  </td> <td> 29  </td> <td> GPIO 5  </td></tr>
+
<tr><td> Relay 1 </td> <td> 35 </td> <td>  GPIO 19 </td> <td> 24 </td></tr>
<tr><td> Relay </td> <td>  31 </td> <td> GPIO 6  </td></tr>
+
<tr><td>  Relay 2 </td> <td> 33 </td> <td>  GPIO 13 </td> <td>  23 </td> </tr>
<tr><td>  Relay 3 </td> <td> 33 </td> <td>  GPIO 13 </td></tr>
 
<tr><td> Relay 4 </td> <td> 35  </td> <td>  GPIO 19 </td></tr>
 
<tr><td>  Relay 5 </td> <td> 37 </td> <td>  GPIO 26 </td></tr>
 
<tr><td>  Relay 6 </td> <td> 40  </td> <td>  GPIO 21 </td></tr>
 
 
</table>
 
</table>
  
 
== Installation ==
 
== Installation ==
==== Python ====
+
<span style="color:#FF0000">'''CAUTION: Be careful when working with the electrical product. Special supervision of parent/adult is required to keep children from hurting themselves.''' </span>
* Stack PiRelay-6 HAT on Raspberry Pi 40 Pin GPIO header.
+
 
* Make sure all six delection jumpers are connected.
+
==== Connection Diagram ====
* Open Terminal and clone/download the repository by typing below command in terminal:
+
[[File:Home_Automation_Conn.png | 800 px]]
 +
 
 +
==== 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'''
 +
 
 +
<source lang="shell"> sudo apt-get update </source>
 +
 
 +
<source lang="shell"> sudo apt-get install wiringpi apache2 libapache2-mod-php -y </source>
 +
 
 +
<source lang="shell"> sudo wget https://pirelay.jasonfindlay.com/downloads/gpio.dl </source>
 +
 
 +
<source lang="shell"> sudo mv gpio.dl /var/www/html/gpio.php </source>
 +
 
 +
 
 +
'''Setting Up Your Android Device'''
 +
* Download Pi Relay app from the Play Store here: [https://play.google.com/store/apps/details?id=com.jasonfindlay.pirelaypro '''PiRelay App Download''']
 +
[[File:PiRelay-APP.PNG | 600px]]
 +
 
 +
* 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.
  
<source lang="shell"> git clone https://github.com/sbcshop/Pirelay-6-Channel.git </source>
+
<source lang="shell"> git clone https://github.com/sbcshop/Home-Automation-HAT.git </source>
  
* Your code will be downloaded to '/home/pi' directory. Use 'ls' command to check the list of directories and 'cd' command to enter directory.
+
* Run the below command to enter the cloned repository. You can also use GUI to open cloned repository folder from the /home/pi location.
<source lang="shell"> cd Pirelay-6-Channel </source>
+
<source lang="shell"> cd Home-Automation-HAT </source>
* 'test.py' is example code for PiRelay-6. Run test file and play with PiRelay-6 by running below python command.
 
<source lang="shell"> python3 test.py </source>
 
  
* You can also use any other GPIO of Raspberry Pi by removing the jumpers and connecting the relay pin directly to the Raspberry Pi GPIO header using jumper cables or wire.
+
* To test code, run the below command. It will turn on and off the relay at an interval of 0.5 seconds.
  
<b> GPIO 4 Relay Not working Fix </b>
+
<source lang="shell"> python3 test.py </source>
  
* Click on <b> Start button >> Preferences >> Raspberry Pi Configuration</b>, Then click on Interfaces Tab and make sure 1-Wire is disabled.
+
* 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.
* Click on the OK button then reboot Raspberry pi.
 
  
https://github.com/sbcshop/PiRelay-V2/raw/main/Images/Relay4Fix.PNG
+
<source lang="shell"> python3 Home_Auto_GUI.py </source>
 +
<br>
 +
[[File:Home_Auto_GUI.gif | 500 px]]
  
 
== Resources ==
 
== Resources ==

Latest revision as of 05:34, 29 October 2021

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