Voice and Touchscreen GUI Relay Activation - How To Use A PiRelay V2 HAT with Raspberry Pi

Published 2022-09-04
The PiRelay V2 HAT is a solder-less solution to drive 4 Relays (30 Volts DC at 10 Amps) from a Raspberry Pi Single Board Computer. I'll even show you how to control the Relays through Spoken Custom Keywords and Utilise a Touchscreen GUI Control.
Full Article (with Terminal Commands) - core-electronics.com.au/guides/raspberry-pi/pi-4-r…

Related Information
Tiny Screens for Raspberry Pi - Waveshare 3.5 Inch LCD - core-electronics.com.au/guides/small-screens-raspb…
Set Up a Raspberry Pi as a Desktop Computer - core-electronics.com.au/guides/dual-monitors-raspb…
How to use Raspberry Pi Imager - core-electronics.com.au/guides/raspberry-pi/raspbe…
Use Your Phone to Control Your Raspberry Pi - core-electronics.com.au/tutorials/raspcontrol-rasp…
Crontab section in the Raspberry Pi Workshop Chapter 3 - core-electronics.com.au/courses/raspberry-pi-works…

All relays on the PiRelay V2 HAT are electro-mechanical relays and you can quickly identify them as the four large through hole black box components on the top of the PCB board. These are electro-mechanical as inside they have physically moving contacts on the output circuit which are controlled directly by a Raspberry Pi Board through I2C communication. This means you can stack these Hats for even more Relay control! These HATs are designed to keep your Raspberry Pi Safe. Also, keep in mind there is a 2 Relay HAT Version that fits cleanly onto a Raspberry Pi Zero and Raspberry Pi Zero 2.

Now for me, the customisable voice control is really cool. I can now properly recreate the "Open Sesame" moment from the Classic Arabian Nights story of Ali Baba and the Forty Thieves. The one missing puzzle piece I need is simply a mouth of a cave in which forty thieves have hidden their treasures. The magic side of things has been sorted 😊

If you have any questions about this content or want to share a project you're working on head over to our maker forum, we are full time makers and here to help - coreelec.io/forum

Core Electronics is located in the heart of Newcastle, Australia. We're powered by makers, for makers. Drop by if you are looking for:

PiRelay V2 HAT (Solderless Solution) - core-electronics.com.au/catalog/product/view/sku/C…

Zero Relay 2-Channel 5V Relay Board for Pi Zero - core-electronics.com.au/catalog/product/view/sku/C…

Raspberry Pi 4 Model B (4GB) Ultimate Kit Bundle (AVALIABLE!) - core-electronics.com.au/raspberry-pi-4-4gb-ultimat…

USB Microphone - core-electronics.com.au/catalog/product/view/sku/A…

Waveshare 3.5 LCD 480x320 - core-electronics.com.au/catalog/product/view/sku/C…

Raspberry Pi Single Board Computers and Gear: core-electronics.com.au/raspberry-pi/boards.html

0:00 Intro
0:21 HAT Overview
0:45 When You Need Relays
1:20 What You Need
1:54 Optional Extras
2:05 Hardware Assembly
5:00 Software Installation
6:56 Basic Control Script
7:45 Success 1!
8:03 Basic Control Script Explanation
9:06 Voice Control Script
10:49 Success 2!
11:37 Voice Control Script Explanation
12:30 Adding a Custom Keyword
14:00 Touch Screen GUI Script
11:55 Where to Now
12:35 Outr

All Comments (21)
  • @SpikeSwinedell
    I wish I had found this channel a year ago.. Thanx sir..
  • @stevegrimeszz
    The touch screen is freaking nice for truck lighting
  • Thanks for this tutorial! It was exactly what I needed to get started.
  • great stuff.. great video. clearly delivered content and concise. have been ordering from you guys for years but didn't know you had youtube 👍
  • Great video and info. I am a noob and need to control 8 relays with 8 physical push buttons and i want a GUI for it also... I think I have figured out the code for the relays and buttons.... with this GUI script I think I can adapt it to fit my needs... (I am not using raspberry relays since I already have cheap relays...) Edit: I ended up getting advised to use chatgpt. it took me about 40 minutes to have it write the code for me and even adapt the GUI code from core electronics to fit my needs. Litterally as easy as asking someone else to do it for me.... First time I ever used chatgpt for anything! LOLOL p.s. As an electrician the double stack raspberry has one HUGE flaw; When the screen is mounted you cannot acces the screw terminals for the relays... So if you need to swich a wire to another terminal you will have to disassemble the screen first...
  • @user-pj9th1jt7c
    Is it possible to stack a motoron hat on top of the PiRelay hat or will the GPIO usage conflict?
  • @12vshady
    What a good video. I might actually try it
  • I'm new to the pi but I'm building a gaming table and I need the pi to run 2 actuators simultaneously and have 3 different preset heights and manual control and on the same setup run a bunch of leds with a bunch of presets all from that touchscreen panel. Any advice on hardware/software ill need?
  • @jonathanboot
    Hi Tim , is it possible to given a example for POLOLU controller (Pirelay) _GUI for 2 DC motors buttons for on /off en speed control , please thanks luc Belgium
  • I'm subscribed and all notifications are turned ON. Yet I have not got the notification for your last video 3 days ago in my subscription posts. I had noticed the videos when I went to your channel home page. Please check if there is any issue there. May be it is a glitch or may be I'm the only one having the issue. I don't know. Anyways putting it out there so that you may have a look at the issue.
  • Great video! Is it possible to modify your code: button1 pressed and relay 1 retracted? Release button1 and the relay stops working? Where can I find this solution or can you explain us how to create the necessary code? Keep up the good work. Greetings from Belgium
  • Would the relay work with a 220 V 2000 W heater fan running in 15 min intervals checking if the temp ha reached a certain value and then stops and restarts when the temp is dropped a few degrees?
  • @imoldovan
    I can see expanding this to send mqtt messages for home assistant to turn on various devices.
  • This screen seems to consume a lot of gpio pins. It could be a problem for my next project. Is there any recommendations
  • hello, I can't speak English. I'm using google translate. I'd like to ask. I get the message "RPi.GPIO as GPIO no module" what is the solution? I have installed but it didn't work. Please help me 🙏🙏🙏