"PiSerialPower" Hat

From Techno-Innov's Wiki
Jump to navigation Jump to search

Raspberry Pi 4 Hat with 5-28VDC - 3A power with barrel jack input, Fan, RTC with Supercap backup, Debug UART, temp sensor and WS2812 RGB led

Description

The "PiSerialPower" Hat Power-supply Hat for RaspberryPi (and pin-compatible competitors) which also provides a rich set of features :

  • 5 to 28VDC barrel jack power input
  • 5V - 3A voltage regulator to power the Raspberry Pi
  • a Fan (PWM controlled)
  • an RTC (PCF85363) with Super capacitor backup (about one month date/time retention, and will not need to be changed in a few years !)
  • a USB to UART FTDI chip (FT230XS) to give you access to the debug console using a simple, common micro-USB cable
  • a reset button
  • a TMP101 temperature sensor
  • and a WS2812 RGB led ... well, there was some place left on the PCB ...

The serial and reset signals are also available on a 2.54mm header.

Of course, the board uses the format specified by Raspberry Pi and allows access to both FPC connectors, and is provided with mounting screws.

The board comes fully assembled and tested.

License

  • Documentation : Creative Commons CC BY-SA-NC 4.0
  • Hardware : The PiSerialPower RPi Hat hardware and schematics are under Creative Commons CC BY-SA-NC 4.0 License. You can produce your own original or modified version of the PiSerialPower RPi Hat, and use it however you like, but not sell them, even without profit.
  • Software : All the software examples created by Techno-Innov for the PiSerialPower RPi Hat are under GPLv3 License.
Note that most of the software you will use with this Hat has not been written by us and is covered by other licenses. Refer to each software for more information.

Hardware

Dimensions

Figures 1, 2 and 3 give the different dimensions and the positions of the main elements (FAN, connectors, reset button and user led) of the PiSerialPower RPi Hat.

Connectors

The HAT has one USB connector numbered P1, a DC barel Jack connector numbered P3, and two 2.54mm pitch headers numbered P4 (Debug) and P5 (Raspberry Pi connector). Refer to figure 4 for connectors position.
Detailed description of the signals found on each connector pin follow.

Fig 4 - Connectors
Fig 4 - Connectors

Electronics

The PiSerialPower RPi Hat has been created using KiCad EDA software suite for the creation of the schematics and printed circuit boards.

See below for the full schematics. The sources for the schematics are available for download here.

Links to various Raspberry Pi information

Raspberry Pi 4 specs

Hats mechanical data

EEPROM ID

Raspberry Pi Pinouts


Software

Official and custom images

I2C : RTC, EEPROM and temperature sensor support

Kernel Modules (use modprobe to load them if they are not already loaded or included in the main kernel image) :

  • RTC : rtc-pcf85363.ko
  • TMP101 : lm75.ko
  • EEPROM : at24.ko

Check that the components are detected :

  • root@raspberrypi:~# i2cdetect 1
[...]
40: -- -- -- -- -- -- -- -- -- -- 4a -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
[...]
  • root@raspberrypi:~# i2cdetect 0
[...]
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
[...]
  • echo tmp101 0x4a > /sys/bus/i2c/devices/i2c-1/new_device
  • echo 24c64 0x50 > /sys/bus/i2c/devices/i2c-0/new_device
  • echo pcf85363 0x51 > /sys/bus/i2c/devices/i2c-1/new_device

GPIO

GPIO support with Raspberry-Pi is a real pain.
Obviously, people do not understand what "stable" means, and try to create new interfaces for GPIO both from the kernel and from the userspace, each supposed to be the very best one, but none usable, making about every piece of information obsolete.

PWM Support for FAN control

  • Device tree information :
https://github.com/raspberrypi/linux/blob/rpi-4.19.y/arch/arm/boot/dts/overlays/pwm-overlay.dts
https://www.raspberrypi.org/forums/viewtopic.php?t=222428
  • Solution using pigpio (pigpiod daemon) and pigs for hardware PWM
pigpiod
pigs hp 13 100000 0
pigs hp 13 100000 30000
pigs hp 13 100000 1000000
killall pigpiod

Remember to kill pigpiod or it will burn your processor to death. PWM keeps running after pigpiod is killed.

WS2812B Support

The WS2812B is connected to pin 12 of the Raspberry Pi connector, which is gpio 18 - PWM0
I gathered various information, I hope it will be usefull :

dtb generation and eeprom flash

DTB sources :

You will also need eepromutils to flash the EEPROM :

Generate the dtbo and flash the EEPROM :

dtc -@ -I dts -O dtb -o overlay.dtbo overlay.dts
dtoverlay overlay.dtbo
./eepmake eeprom_settings.txt myhat.eep overlay.dtbo
./eepflash.sh -w -f=myhat.eep -t=24c64 -a=50 -d=0

You can erase the EEPROM with the following command (blank.eep is an 8Kb file filled with zeroes) :

./eepflash.sh -w -f=blank.eep -t=24c64 -a=50 -d=0

TODO List

Technical documentation and Schematics

Sources for the schematics here

History

v0.1

This board revision has not been sold to public. First prototype version, produced on customer request.

v0.2

Actual version sold as of writting of this documentation. Fixes v01 mistakes and adds PWM for the FAN and a RGB led.