Introduction: DIY HAT for Raspberry Pi 4B

This HAT for Raspberry Pi 4B is made to connect 2 Servos, a 4 wire OLED display, a DHT-11 digital humidity and temperature sensor, a ultrasonic ping sensor HC-SR04. It has onboard three color (RGB) led and a 5V micro USB female port for additional power supply to these devices because the Pi is not capable to deliver power to all of these. An old PATA hard disk 40 pin cable used to connect the HAT and Pi.

Step 1: Pin Numbers to Control

Following pins are used to control each device on HAT

ITEM________________________ PIN
Servo-1 _______________________7

Servo-2 _______________________8

R LED _______________________ 13

G LED ________________________15

B LED ________________________ 11

DHT _________________________22

Ping Tr _______________________16

Ping Ec _______________________18

OLED SCL____________________ 5

OLED SDA____________________ 3

Step 2: Test the HAT

HATDemo.py Python code is used to demo all the connected devices.