Products/PiSerialPower: Difference between revisions
(→FAN) |
|||
(16 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
== Description == | == Description == | ||
The "PiSerialPower" Hat | The "PiSerialPower" Hat is a power-supply Hat for RaspberryPi (and pin-compatible competitors) which also provides a rich set of features : | ||
* 5 to 28VDC barrel jack power input | * 5 to 28VDC barrel jack power input | ||
* 5V - 3A voltage regulator to power the Raspberry Pi | * 5V - 3A voltage regulator to power the Raspberry Pi | ||
Line 27: | Line 27: | ||
== License == | == License == | ||
By purchasing one of our products, you become the owner .Therefore, you have some rights and obligations according to the following licences : | |||
* Documentation : [https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode Creative Commons CC BY-SA-NC 4.0] | * Documentation : [https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode Creative Commons CC BY-SA-NC 4.0] | ||
* Hardware : The PiSerialPower RPi Hat hardware and schematics are under [https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode 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. | * Hardware : The PiSerialPower RPi Hat hardware and schematics are under [https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode 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. | * 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. | : 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. | ||
== Waranties == | |||
Because it is impossible for Techno-Innov to know the purposes for which you acquired this product or the uses to which you will put this product, you assume full responibility for the selection of the product and for its installation and use.<br /> | |||
While every reasonnable effort has been made to insure that you will receive a product that you can use and enjoy, Techno-Innov does not warrant that the functions of the product will meet your requirements or that the operation of the product will be uninterruped or error-free. Techno-Innov is not responsible for problems caused by the interaction of the product with any other software or hardware. | |||
== Hardware (Mechanical) == | == Hardware (Mechanical) == | ||
Line 52: | Line 57: | ||
=== P1 : USB debug connector === | === P1 : USB debug connector === | ||
P1 is a female USB microB port.<br /> | P1 is a female USB microB port.<br /> | ||
Refer to the [http:// | Refer to the [http://en.wikipedia.org/wiki/Universal_Serial_Bus Universal Serial Bus (USB)] page on Wikipedia for pinout and more information on the USB bus and connectors. | ||
=== P3 : 2.1mm barrel jack === | === P3 : 2.1mm barrel jack === | ||
[[Image:P3.png| | [[Image:P3.png|200px|right]] | ||
P3 connector is a standard 2.1mm barrel jack.<br /> | P3 connector is a standard 2.1mm barrel jack.<br /> | ||
+Vin is on the central tip, and GND on the outer sleeve.<br /> | +Vin is on the central tip, and GND on the outer sleeve.<br /> | ||
Line 84: | Line 89: | ||
=== P4 Connector === | === P4 Connector === | ||
[[Image:P4.png| | [[Image:P4.png|200px|right]] | ||
P4 connector is a standard 2.54mm (0.1 inch) pitch header, with 1 row of 4 pins. | P4 connector is a standard 2.54mm (0.1 inch) pitch header, with 1 row of 4 pins.<br /> | ||
P4 connector provides access to Debug UART and Reset. | P4 connector provides access to Debug UART and Reset. | ||
Line 124: | Line 129: | ||
=== P5 Connector === | === P5 Connector === | ||
[[Image:P5.png|300px|right]] | [[Image:P5.png|300px|right]] | ||
P5 connector is a standard 2.54mm (0.1 inch) pitch header, with 2 row of 20 pins. | P5 connector is a standard 2.54mm (0.1 inch) pitch header, with 2 row of 20 pins.<br /> | ||
P5 connector provides access to the Raspberry PI expansion header. | P5 connector provides access to the Raspberry PI expansion header. | ||
Line 296: | Line 301: | ||
== Electronic components == | == Electronic components == | ||
[[Image:Composants.png| | [[Image:Composants.png|500px|right]] | ||
The PiSerialPower RPi Hat has been created using [http://www.kicad-pcb.org/display/KICAD/ KiCad EDA software] suite for the creation of the schematics and printed circuit boards. | The PiSerialPower RPi Hat has been created using [http://www.kicad-pcb.org/display/KICAD/ KiCad EDA software] suite for the creation of the schematics and printed circuit boards. | ||
Line 319: | Line 324: | ||
=== USB to UART bridge === | === USB to UART bridge === | ||
[[Image:Prog.png| | [[Image:Prog.png|450px|right]] | ||
In order to ease the development process on Raspberry Pi the HAT provides an USB to UART bridge.<br /> | In order to ease the development process on Raspberry Pi the HAT provides an USB to UART bridge.<br /> | ||
This bridge is made by a FTDI FT230XS chip, which is well supported on most operating systems so there is usually no configuration required to use it as a serial line on the host development system. | This bridge is made by a FTDI FT230XS chip, which is well supported on most operating systems so there is usually no configuration required to use it as a serial line on the host development system. | ||
Line 326: | Line 331: | ||
The FTDI chip controls two "activity" leds for Rx (D2, the green one) and Tx (D3, orange one) data over the serial link. | The FTDI chip controls two "activity" leds for Rx (D2, the green one) and Tx (D3, orange one) data over the serial link. | ||
The USB to UART bridge is connected to UART0 (pins 8 and 10) on the RPi connector. On most variants of the RPi boards this interface must be activated manually in the device tree or in the bootloader configuration on the first partition of the SD card. Refer to the Raspberry Pi User Manual and online documentation and other ressources for more information on how to activate this interface. | The USB to UART bridge is connected to UART0 (pins 8 and 10) on the RPi connector. On most variants of the RPi boards this interface must be activated manually in the device tree or in the bootloader configuration on the first partition of the SD card. Refer to the Raspberry Pi User Manual and online documentation and other ressources for more information on how to activate this interface.<br /> | ||
Some hints and links are provided in the software section below, but activating the primary UART is highly dependent on your RPi version and the GNU/Linux distribution you will be using (some may even ship with this UART activated !) | |||
=== I²C === | === I²C === | ||
Line 356: | Line 362: | ||
==== RTC Clock ==== | ==== RTC Clock ==== | ||
[[Image:RTC.png| | [[Image:RTC.png|300px|right]] | ||
The HAT includes a PCF85363 RTC with super-capacitor power backup.<br /> | The HAT includes a PCF85363 RTC with super-capacitor power backup.<br /> | ||
The use of a Super-capacitor for power backup lowers the environmental footprint and remove the need to replace (and dispose of) the battery at the expense of a shorter time retention, which is between one and two months, but should be enough for most applications. | The use of a Super-capacitor for power backup lowers the environmental footprint and remove the need to replace (and dispose of) the battery at the expense of a shorter time retention, which is between one and two months, but should be enough for most applications. | ||
The Linux kernel has support for the PCF85363 RTC in the rtc-pcf85363 module.<br /> | The Linux kernel has support for the PCF85363 RTC in the rtc-pcf85363 module.<br /> | ||
CONFIG_RTC_DRV_PCF85363=m | |||
After loading the rtc-pcf85363 module in the kernel, you must add the RTC to the list of devices on the I²C bus 1 : | After loading the rtc-pcf85363 module in the kernel, you must add the RTC to the list of devices on the I²C bus 1 : | ||
echo pcf85363 0x51 > /sys/bus/i2c/devices/i2c-1/new_device | echo pcf85363 0x51 > /sys/bus/i2c/devices/i2c-1/new_device | ||
Line 366: | Line 373: | ||
You can the access the RTC from <code>/dev/rtc0</code> or with the <code>hwclock</code> command (from the <code>util-linux</code> package on Debian based GNU/Linux distributions. | You can the access the RTC from <code>/dev/rtc0</code> or with the <code>hwclock</code> command (from the <code>util-linux</code> package on Debian based GNU/Linux distributions. | ||
The RTC clock selected also holds 64 bytes of RAM available to the user to store data as long as the RTC chip is powered (which includes the supercapacitor backup power).<br /> | |||
To get access to this memory you will need to activate the following conigurations in your kernel : | |||
CONFIG_RTC_NVMEM=y | |||
CONFIG_NVMEM=y | |||
CONFIG_NVMEM_SYSFS=y | |||
When booted with a kernel with NVMEM support activated (with the PCF85363 RTC support, either built-in or as module with module loaded) you will get access to the RAM bytes under <code>/sys</code> in the following file : | |||
/sys/bus/nvmem/devices/pcf85363-0/nvmem | |||
You can then use it as a regular file with a limited size of 64 bytes. | |||
echo "NVMEM Test" > /sys/bus/nvmem/devices/pcf85363-0/nvmem | |||
cat /sys/bus/nvmem/devices/pcf85363-0/nvmem | |||
==== Temperature sensor ==== | ==== Temperature sensor ==== | ||
[[Image:TMP101.png| | [[Image:TMP101.png|250px|right]] | ||
The HAT has a TMP101 temperature sensor (from Texas Instrument) on the I²C bus 1 (address 0x94 / 0x95). | The HAT has a TMP101 temperature sensor (from Texas Instrument) on the I²C bus 1 (address 0x94 / 0x95). | ||
Line 382: | Line 399: | ||
==== EEPROM ==== | ==== EEPROM ==== | ||
[[Image:EEPROM.png| | [[Image:EEPROM.png|250px|right]] | ||
In order to respect the Pi HAT design requirements the HAT has a 24C64 (8Kbyte) EEPROM on I²C bus 0 at I²C address 0x50 (7bits).<br /> | In order to respect the Pi HAT design requirements the HAT has a 24C64 (8Kbyte) EEPROM on I²C bus 0 at I²C address 0x50 (7bits).<br /> | ||
This EEPROM holds identification data and the HAT device tree blob which is loaded by the Linux kernel to enable the components (RTC and temperature sensor) found on the HAT.<br /> | This EEPROM holds identification data and the HAT device tree blob which is loaded by the Linux kernel to enable the components (RTC and temperature sensor) found on the HAT.<br /> | ||
Line 390: | Line 407: | ||
=== Reset Button === | === Reset Button === | ||
[[Image:Reset.png| | [[Image:Reset.png|200px|right]] | ||
The module has a reset button, connected directly to the enable pin of the step down regulator.<br /> | The module has a reset button, connected directly to the enable pin of the step down regulator.<br /> | ||
Pressing the button removes power from this power source, which will immediately shut down the Raspberry Pi if it has no other power source, or do nothing if the RPi is also powered from its type C USB connector or any other way. | Pressing the button removes power from this power source, which will immediately shut down the Raspberry Pi if it has no other power source, or do nothing if the RPi is also powered from its type C USB connector or any other way. | ||
=== FAN === | === FAN === | ||
[[Image:Fan.png| | [[Image:Fan.png|180px|right]] | ||
The module has a 25mm cooling FAN controlled by pin 33 of the RPI connector (GPIO_13 - PWM1).<br /> | The module has a 25mm cooling FAN controlled by pin 33 of the RPI connector (GPIO_13 - PWM1).<br /> | ||
This pin is PWM capable, which allows you to control the FAN speed, though the fan used has an internal controller which prevents direct control using PWM, so we added a simple charge pump to modulate the fan voltage, which has the effect of modifying the FAN speed. | This pin is PWM capable, which allows you to control the FAN speed, though the fan used has an internal controller which prevents direct control using PWM, so we added a simple charge pump to modulate the fan voltage, which has the effect of modifying the FAN speed. | ||
Line 401: | Line 418: | ||
Refer to the Raspberry Pi User Manual and online documentation and other resources for more information on how to control the PWM output. | Refer to the Raspberry Pi User Manual and online documentation and other resources for more information on how to control the PWM output. | ||
<div style="clear:both"> </div> | |||
=== User RGB Led === | === User RGB Led === | ||
[[Image:RGBLed.png|360px|right]] | [[Image:RGBLed.png|360px|right]] | ||
The module has one WS2812B RGB Led connected to pin 12 of the RPI connector (GPIO_18 - PWM0). This Led is available for the user.<br /> | The module has one WS2812B RGB Led connected to pin 12 of the RPI connector (GPIO_18 - PWM0). This Led is available for the user.<br /> | ||
Refer to the Raspberry Pi User Manual and online documentation and other resources for more information on how to control this WS2812B RGB Led. | Refer to the Raspberry Pi User Manual and online documentation and other resources for more information on how to control this WS2812B RGB Led. | ||
<div style="clear:both"> </div> | |||
== Software == | == Software == | ||
Line 411: | Line 431: | ||
* [https://wiki.debian.org/RaspberryPi Raspberry Pi information on Debian wiki] | * [https://wiki.debian.org/RaspberryPi Raspberry Pi information on Debian wiki] | ||
* [https://www.raspberrypi.org/downloads/ Raspberry Pi official images download] and [https://www.raspberrypi.org/documentation/installation/installing-images/README.md installation instructions] | * [https://www.raspberrypi.org/downloads/ Raspberry Pi official images download] and [https://www.raspberrypi.org/documentation/installation/installing-images/README.md installation instructions] | ||
=== Activate main (debug) UART === | |||
The main UART (Serial / tty) used by the Linux kernel and base system to output messages (primary UART, where a login console will also be present at the end of the boot process) is not active by default on most distributions.<br /> | |||
On the Raspberry Pi, if this UART is activated it will be present on GPIO 14 (transmit) and 15 (receive). Note that GPIO 14 is pin 8 on the GPIO header, while GPIO 15 is pin 10 (P5 Connector in Connectors section above). | |||
Follow these steps to configure (Note that this may vary, depending on your distribution, Linux kernel, and RaspberryPi version. | |||
* Edit config.txt on your SD card first partition (<code>/boot/config.txt</code>), and add | |||
** <code>enable_uart=1</code> | |||
** <code>dtoverlay=uart0</code> (for RPi 4) | |||
** <code>dtoverlay=pi3-miniuart-bt</code> (for RPi 3) | |||
* Make sure you have the overly files in <code>/boot/overlays/</code> on your SD card first partition | |||
** <code>uart0.dtbo</code> (for RPi 4) | |||
** <code>pi3-miniuart-bt.dtbo</code> (for RPi 3) | |||
You will find more informations [https://www.raspberrypi.org/documentation/configuration/uart.md here] and [https://www.raspberrypi.org/documentation/configuration/device-tree.md#part4.6 here] or even [https://raspberrypi.stackexchange.com/questions/104464/where-are-the-uarts-on-the-raspberry-pi-4 here] (more accurate and up to date). Also refer to your distribution documentation. | |||
=== I2C : RTC, EEPROM and temperature sensor support === | === I2C : RTC, EEPROM and temperature sensor support === | ||
Line 495: | Line 530: | ||
== Schematics, sources and PDF of documentation == | == Schematics, sources and PDF of documentation == | ||
* Current documentation (PDF subpart of what's on this page) [ | * Current documentation (PDF subpart of what's on this page) [https://techdata.techno-innov.fr/Adapters/PiSerialPower/PiSerialPower.pdf here] | ||
* Sources for the schematics [ | * Schematics : [https://techdata.techno-innov.fr/Adapters/PiSerialPower/PiSerialPower_Schematics.pdf here] | ||
* Board layout : [https://techdata.techno-innov.fr/Adapters/PiSerialPower/PiSerialPower_Board.pdf here] | |||
* Sources for the schematics [https://techdata.techno-innov.fr/Adapters/PiSerialPower/PiSerialPower_Schematics.tar.bz2 here] | |||
== History == | == History == |
Latest revision as of 10:10, 19 April 2024
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 is a 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.
Where to buy
- Contact us by email before (sales *at* techno-innov.fr) to get a quotation which will include shipping costs and reduction for direct order.
License
By purchasing one of our products, you become the owner .Therefore, you have some rights and obligations according to the following licences :
- 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.
Waranties
Because it is impossible for Techno-Innov to know the purposes for which you acquired this product or the uses to which you will put this product, you assume full responibility for the selection of the product and for its installation and use.
While every reasonnable effort has been made to insure that you will receive a product that you can use and enjoy, Techno-Innov does not warrant that the functions of the product will meet your requirements or that the operation of the product will be uninterruped or error-free. Techno-Innov is not responsible for problems caused by the interaction of the product with any other software or hardware.
Hardware (Mechanical)
Dimensions
-
Fig 1 - Mechanical
-
Fig 2 - Connectors
-
Fig 3 - Fan
Figures 1, 2 and 3 give the different dimensions and the position 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.
- P1 : USB microB female connector.
- P3 : DC barrel jack. +Vin and ground input.
- P4 : 4 pins, 2.54mm pitch header. Provides Debug UART and Reset.
- P5 : 40 pins, 2.54mm pitch header. Provides access to RPI expansion header.
P1 : USB debug connector
P1 is a female USB microB port.
Refer to the Universal Serial Bus (USB) page on Wikipedia for pinout and more information on the USB bus and connectors.
P3 : 2.1mm barrel jack
P3 connector is a standard 2.1mm barrel jack.
+Vin is on the central tip, and GND on the outer sleeve.
Insersion detection is not used.
P3 connector provides access to +Vin and Ground for the onboard step-down regulator. Despite the comment on the schematics, the input ranges from 5V to 24V (28V is the max allowed, and 30V the absolute max the step-down converter can handle) . This lets you power the board using a large variety of power sources.
Note : be very carefull when powering the board with a 24V power-supply, as the voltage can go well above 30V upon power-supply startup and destroy the step-down converter.
Future versions will include a 28V zener diode between Vin and GND to further protect the Hat.
P3 connector | |||
---|---|---|---|
Pin # | Description | RPi signal | RPi Pin |
1 | +Vin : External unregulated input, +5V to +28V | -- | -- |
2 | GND : Ground | GND | GND pins 6, 9, 14, 20, 25, 30, 34 and 39 |
P4 Connector
P4 connector is a standard 2.54mm (0.1 inch) pitch header, with 1 row of 4 pins.
P4 connector provides access to Debug UART and Reset.
P4 connector | |||
---|---|---|---|
Pin # | Description | RPi signal | RPi Pin |
1 | GND : Ground | GND | GND pins 6, 9, 14, 20, 25, 30, 34 and 39 |
2 | RPi TxD | UART0 Tx | pin 8 |
3 | RPi RxD | UART0 Rx | pin 10 |
4 | 5V enable (Reset) | -- | -- |
Note : P4 connector allows direct access to the debug UART and to the power enable pin without powering the USB-to-UART bridge. This option has been added to allow external access and control of clusters of Raspberry Pi boards through a single UART concentrator with aditionnal GPIO to control the DC/DC enable pin.
P5 Connector
P5 connector is a standard 2.54mm (0.1 inch) pitch header, with 2 row of 20 pins.
P5 connector provides access to the Raspberry PI expansion header.
P5 connector | ||
---|---|---|
Pin # | Description | RPi signal |
1 | +3.3V from RPi | +3.3V |
2 | +5V to RPi | +5V |
3 | SDA : Bidirectional Serial Data for I²C bus 1 | I2C1 SDA |
4 | +5V to RPi | +5V |
5 | SCL : Clock for I²C bus 1 | I2C1 SCL |
6 | GND : Ground | GND |
7 | RTC GPIO | GPIO 4 |
8 | RPi TxD | UART0 Tx |
9 | GND : Ground | GND |
10 | RPi RxD | UART0 Rx |
11 | Temp sensor GPIO | GPIO 17 |
12 | RGB Led | GPIO 18 - PWM0 |
13 | -- | -- |
14 | GND : Ground | GND |
15 | -- | -- |
16 | -- | -- |
17 | +3.3V from RPi | +3.3V |
18 | -- | -- |
19 | -- | -- |
20 | GND : Ground | GND |
21 | -- | -- |
22 | -- | -- |
23 | -- | -- |
24 | -- | -- |
25 | GND : Ground | GND |
26 | -- | -- |
27 | SDA : Bidirectional Serial Data for I²C bus 0 (EEPROM) | I2C0 SDA |
28 | SCL : Clock for I²C bus 0 (EEPROM) | I2C0 SCL |
29 | -- | -- |
30 | GND : Ground | GND |
31 | -- | -- |
32 | -- | -- |
33 | Fan PWM | GPIO 13 - PWM1 |
34 | GND : Ground | GND |
35 | -- | -- |
36 | -- | -- |
37 | -- | -- |
38 | -- | -- |
39 | GND : Ground | GND |
40 | -- | -- |
Electronic components
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.
HAT Main Components Description
- U1 : TI TPS54302 DC-DC step-down converter.
- U2 : FTDI FT230XS USB to UART bridge.
- U5 : NXP PCF85363 RTC Clock.
- U6 : TI TMP101 I²C temperature sensor.
- U7 : ST M24C64 8KB EEPROM
- U8 : WS2812B user RGB led.
- D1 : Input power Presence.
- D2 : Green led : FTDI Rx activity.
- D3 : Orange led : FTDI Tx activity.
- D4 : USB FTDI Power OK.
- D5 : +3.3V Power from RPi.
- D6 : +5V to RPi.
- D7 : +5V from RPi.
- SW1 : Reset button.
- J1 : EEPROM write protection jumper (remove for write protection)
USB to UART bridge
In order to ease the development process on Raspberry Pi the HAT provides an USB to UART bridge.
This bridge is made by a FTDI FT230XS chip, which is well supported on most operating systems so there is usually no configuration required to use it as a serial line on the host development system.
It provides a 3.3V regulated voltage for the UART interface but does not power the HAT or the Raspberry Pi.
The FTDI chip controls two "activity" leds for Rx (D2, the green one) and Tx (D3, orange one) data over the serial link.
The USB to UART bridge is connected to UART0 (pins 8 and 10) on the RPi connector. On most variants of the RPi boards this interface must be activated manually in the device tree or in the bootloader configuration on the first partition of the SD card. Refer to the Raspberry Pi User Manual and online documentation and other ressources for more information on how to activate this interface.
Some hints and links are provided in the software section below, but activating the primary UART is highly dependent on your RPi version and the GNU/Linux distribution you will be using (some may even ship with this UART activated !)
I²C
The PiSerialPower RPi Hat uses both I²C busses from the RPi connector.
Bus 0 holds the required EEPROM for HAT identification and configuration, at address 0x50.
Bus 1 holds the TMP101 temperature sensor at address 0x4A and the PCF85363 RTC clock at address 0x51.
The following table shows all the possible I²C Addresses for the I²C components used on the HAT.
I²C Addresses | ||
---|---|---|
I²C Component | 7 bits I²C address | I²C Address + R / W bit |
TMP101 Temperature sensor | 0x4A | 0x94 / 0x95 |
PCF85363 RTC Clock | 0x51 | 0xA2 / 0xA3 |
24C64 EEPROM | 0x50 | 0xA0 / 0xA1 |
RTC Clock
The HAT includes a PCF85363 RTC with super-capacitor power backup.
The use of a Super-capacitor for power backup lowers the environmental footprint and remove the need to replace (and dispose of) the battery at the expense of a shorter time retention, which is between one and two months, but should be enough for most applications.
The Linux kernel has support for the PCF85363 RTC in the rtc-pcf85363 module.
CONFIG_RTC_DRV_PCF85363=m
After loading the rtc-pcf85363 module in the kernel, you must add the RTC to the list of devices on the I²C bus 1 :
echo pcf85363 0x51 > /sys/bus/i2c/devices/i2c-1/new_device
This is not necessary if the device tree is loaded from the EEPROM.
You can the access the RTC from /dev/rtc0
or with the hwclock
command (from the util-linux
package on Debian based GNU/Linux distributions.
The RTC clock selected also holds 64 bytes of RAM available to the user to store data as long as the RTC chip is powered (which includes the supercapacitor backup power).
To get access to this memory you will need to activate the following conigurations in your kernel :
CONFIG_RTC_NVMEM=y CONFIG_NVMEM=y CONFIG_NVMEM_SYSFS=y
When booted with a kernel with NVMEM support activated (with the PCF85363 RTC support, either built-in or as module with module loaded) you will get access to the RAM bytes under /sys
in the following file :
/sys/bus/nvmem/devices/pcf85363-0/nvmem
You can then use it as a regular file with a limited size of 64 bytes.
echo "NVMEM Test" > /sys/bus/nvmem/devices/pcf85363-0/nvmem cat /sys/bus/nvmem/devices/pcf85363-0/nvmem
Temperature sensor
The HAT has a TMP101 temperature sensor (from Texas Instrument) on the I²C bus 1 (address 0x94 / 0x95).
This temperature sensor has an "alert" function available through a dedicated pin. This pin is routed to pin 11 of the RPI connector (GPIO0_17) which allows the temperature sensor to send an event to the Raspberry Pi.
Refer to the Raspberry Pi User Manual for more information on how to use this signal, and to the TMP101 documentation for more information on the temperature alert signal.
The Linux kernel has support for the TMP101 temperature sensor in the lm75 module.
Once the lm75 module is loaded in the kernel, you must add the TMP101 sensor to the list of devices on the I²C bus 1 :
echo tmp101 0x4a > /sys/bus/i2c/devices/i2c-1/new_device
This is not necessary if the device tree is loaded from the EEPROM.
You can then read the temperature using the sensors
command, which is provided by the lm-sensors
package on Debian based GNU/Linux distributions.
EEPROM
In order to respect the Pi HAT design requirements the HAT has a 24C64 (8Kbyte) EEPROM on I²C bus 0 at I²C address 0x50 (7bits).
This EEPROM holds identification data and the HAT device tree blob which is loaded by the Linux kernel to enable the components (RTC and temperature sensor) found on the HAT.
The EEPROM has a write protection pin which must be left floating or driven low to allow write operation. The control of the state of this write protection pin is made by the J1 jumper. When the jumper is present, the pin is driven low and the user can write to the EEPROM.
Removing the jumper disables write operations.
Reset Button
The module has a reset button, connected directly to the enable pin of the step down regulator.
Pressing the button removes power from this power source, which will immediately shut down the Raspberry Pi if it has no other power source, or do nothing if the RPi is also powered from its type C USB connector or any other way.
FAN
The module has a 25mm cooling FAN controlled by pin 33 of the RPI connector (GPIO_13 - PWM1).
This pin is PWM capable, which allows you to control the FAN speed, though the fan used has an internal controller which prevents direct control using PWM, so we added a simple charge pump to modulate the fan voltage, which has the effect of modifying the FAN speed.
Refer to the Raspberry Pi User Manual and online documentation and other resources for more information on how to control the PWM output.
User RGB Led
The module has one WS2812B RGB Led connected to pin 12 of the RPI connector (GPIO_18 - PWM0). This Led is available for the user.
Refer to the Raspberry Pi User Manual and online documentation and other resources for more information on how to control this WS2812B RGB Led.
Software
Official and custom images
- Build a 64bit bootable image for a Raspberry Pi 4 (CloudKernels)
- Raspberry Pi information on Debian wiki
- Raspberry Pi official images download and installation instructions
Activate main (debug) UART
The main UART (Serial / tty) used by the Linux kernel and base system to output messages (primary UART, where a login console will also be present at the end of the boot process) is not active by default on most distributions.
On the Raspberry Pi, if this UART is activated it will be present on GPIO 14 (transmit) and 15 (receive). Note that GPIO 14 is pin 8 on the GPIO header, while GPIO 15 is pin 10 (P5 Connector in Connectors section above).
Follow these steps to configure (Note that this may vary, depending on your distribution, Linux kernel, and RaspberryPi version.
- Edit config.txt on your SD card first partition (
/boot/config.txt
), and addenable_uart=1
dtoverlay=uart0
(for RPi 4)dtoverlay=pi3-miniuart-bt
(for RPi 3)
- Make sure you have the overly files in
/boot/overlays/
on your SD card first partitionuart0.dtbo
(for RPi 4)pi3-miniuart-bt.dtbo
(for RPi 3)
You will find more informations here and here or even here (more accurate and up to date). Also refer to your distribution documentation.
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 :
- https://pinout.xyz/pinout/pin12_gpio18#
- https://github.com/pimoroni/unicorn-hat
- https://github.com/richardghirst/rpi_ws281x et https://github.com/jgarff/rpi_ws281x
dtb generation and eeprom flash
DTB sources :
- List of overlays on Raspberry Pi's official git repository
- Our overlay.dts
You will also need eepromutils to flash the EEPROM :
Generate the dtbo and flash the EEPROM (Note : the write protection jumper must be "on" in order to 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
Links to various Raspberry Pi information
Raspberry Pi 4 specs
Hats mechanical data
- https://github.com/raspberrypi/hats/blob/master/designguide.md
- hat-board-mechanical.pdf
- https://www.raspberrypi.org/blog/introducing-raspberry-pi-hats/
EEPROM ID
Raspberry Pi Pinouts
TODO List
- Test over-voltage protection with 28V zener diode and/or add resetable fuse on power input
- Manage to sell a few (or many) boards ! Orders welcome !
Schematics, sources and PDF of documentation
- Current documentation (PDF subpart of what's on this page) here
- Schematics : here
- Board layout : here
- 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.