relay HAT discussion notes

Active today
Viewed 6 times

The goal is to design a 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.

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

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


  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?


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

  • 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 1 hour ago   
  • References: (1) I2C Four Channel Relay (with demo python program) – DockerPi wiki.52pi.com/index.php/… (2) Rpi SPI 3.5″ 480×320 Touch Screen TFT LCD – WaveShare waveshare.com/3.5inch-rpi-lcd-a.htm – tlfong01 1 hour ago   
  • @tlfong01 Thanks for responding. Please consider moving your responses to an answer and sharing any lesson-learned. – gatorback 1 hour ago
  • Thank you for nice words and suggestion. So I will be writing up an answer. Cheers. – tlfong01 53 mins ago   
  • 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 just now   Edit   

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: