1

The goal is to design thermostat system via stacking Raspberry pi HATs:

  1. Raspberry pi (3B+ or 4)
  2. 4-channel relay
  3. TFT Touch Display

It would be preferable that community experience point out any obstacles before I purchase the relay-HAT and steer away from a poor design decision. Below is a preliminary analysis, however, I would like the community's experience to review and pick it apart for any obstacles.

A touch-display hat was purchased from Amazon.com: based on the pinout data from the waveshare website the display uses:

DISPLAY: 
=======
PIN GPIO 
11  17   TP_IRQ Touch Panel interrupt, low level while the Touch Panel detects touching
18  24   LCD_RS     Instruction/Data Register selection
19  10   LCD_SI / TP_SI     SPI data input of LCD/Touch Panel
21   9   TP_SO  SPI data output of Touch Panel
22  25   RST    Reset
23  11   LCD_SCK / TP_SCK   SPI clock of LCD/Touch Panel
24   8   LCD_CS     LCD chip selection, low active
26   7   TP_CS  Touch Panel chip selection, low active

The DockerPi 4 Channel Relay display indicates I2C relay control. Given that the display uses the GPIO & PINS listed above.

I2C pinout:

  • I2C pins in BCM mode are: 2, 3
  • I2C pins in WiringPi are: 8, 9

QUESTIONS

  1. Can the two hats stack and perform their respective functions?
  2. Or is there a feature that I have not considered that may be an obstacle?

BONUS ROUND

If you have had success stacking multiple HATs, please indicate which HATs and any lessons-learned in your reply.

UPDATE: Fail-safe \ failure-mode

Because the application is HVAC (heating , air-conditioning), it is important to understand failsafe modes and ensure that relays are not engaged in a failure mode

  • Just a quick and dirty reply. Warning: no guarantee no nothing won't meltdown or blow up. I skimmed the datasheets found there is 70% chance OK, for the following reasons: (1) Touch display is SPI, and relay is I2C, (2) I2C relay has well documented instructions to change addresses, and further more, if you use Ri4B, you can choose one of the multiple (max 5, stable 3) I2C channels to avoid any GPIO pin conflicts. – tlfong01 Jan 31 at 3:36
  • References: (1) I2C Four Channel Relay (with demo python program) - DockerPi wiki.52pi.com/index.php/… (2) Rpi SPI 3.5" 480x320 Touch Screen TFT LCD - WaveShare waveshare.com/3.5inch-rpi-lcd-a.htm – tlfong01 Jan 31 at 3:38
  • 1
    @tlfong01 Thanks for responding. Please consider moving your responses to an answer and sharing any lesson-learned. – gatorback Jan 31 at 3:45
  • Thank you for nice words and suggestion. So I will be writing up an answer. Cheers. – tlfong01 Jan 31 at 3:52
  • I know your question is how to stack hats. I can convenience why NOT to use hats, but it depends if your project is Micky Mouse or NASA. Perhaps you can give a rough idea of you long term project spec, say IoT app oriented, using 50+ sensors/actuators motors (DC/BLDC/unipolar/bipolar/microstepping stepping) relay/solenoid 10+ USB/RS485/RS232 standard/TTL adapters, SPI (5+ mux/nonmux channels), I2C (5+ mux/nomux channels), PAN/LAN/WAN BlueTooth/2/5G Wifi/ISM4xx/9yyMHz network, ... I do have loads of painful failing experience of stacking/ HATS (Rpi26/40 pin, PCIe bus, ..) Cheers. – tlfong01 Jan 31 at 4:45
2

Answer

Remark: Just a quick and dirty answer. Perhaps more details later.

Warning: no guarantee no nothing won't meltdown or blow up.


I skimmed the datasheets and quickly concluded that there is 80% chance OK, for the following reasons:

(1) Touch display is SPI, and relay is I2C,

(2) I2C relay has well documented instructions to change addresses, and further more, if you use Ri4B, you can choose one of the multiple (max 5, stable 3) I2C channels to avoid any GPIO pin conflicts.


References:

(1) Rpi I2C Four Channel Relay (with demo python program) - DockerPi

(2) Docker Pi 4 Channel Relay Module - Seeed Studio

(3) Rpi SPI 3.5" 480x320 Touch Screen TFT LCD - WaveShare

(4) DockerPi GitHub

(5) 52Pi Rpi Modules Catalog

(6) How to use a stackable Rpi relay HAT to control 220V AC mains power?

(7) How to tap/tee/fork the Rpi GPIO pins covered/blocked by a HAT/pHAT/bonnet?

(8) Choosing between relays of 3V/5V/12V, High/Low logical level trigger, Rpi compatible/incompatible (and how to modify/get around Rpi incompatible relay to make it compatible), Cheap/Expensive, Risky/Reliable/Newbie proof, Hobbyist/Industrial/professional grade, Direct/Optically isolated, ...

(9) Smart home/building/city learning/research project notes/references 1/2 - tlfong01 2018/2019

(10) Smart home/building/city learning/research project notes/references 2/2 - tlfong01 2018/2019


End of answer

| improve this answer | |
  • 1
    Thank you for adding a list of reference, which documents your insights and experience. The list is an excellent asset for the community to learn from. I am a little envious that it must be very fast to buy electronics from your neighbors to the north. It takes weeks for it to arrive in the USA – gatorback Jan 31 at 5:11
  • Ah, I think you can buy from AdaFruit and SparkFun. Their open hardware boards are are perhaps more expensive, but I think for serious projects it is worth it. For hobbyists it is OK to buy the not so good quality controlled stuff from Amazon, AliExpress and so on. – tlfong01 Jan 31 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.