Difference between revisions of "PoE HAT (B)"

From Waveshare Wiki
Jump to: navigation, search
 
(24 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
<div class="wiki-pages jet-green-color">
 
{{infobox item|
 
{{infobox item|
|img=[[File:PoE-HAT-B-5.jpg|400px|link=https://www.waveshare.com/poe-hat-b.htm|PoE HAT (B)]]
+
|img=[[File:PoE-HAT-B-5.jpg|400px|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=https://www.waveshare.com/poe-hat-b.htm}}|PoE HAT (B)]]
 
|caption=Power Over Ethernet HAT (Type B) For Raspberry Pi 3B+/4B, 802.3af Power-Sourcing Equipment Required
 
|caption=Power Over Ethernet HAT (Type B) For Raspberry Pi 3B+/4B, 802.3af Power-Sourcing Equipment Required
 
|brand=Waveshare
 
|brand=Waveshare
|{{#urlget:amazon|default}}=display
+
|{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display
 
|website_cn=[http://www.waveshare.net 中文网站]
 
|website_cn=[http://www.waveshare.net 中文网站]
 
|website_en=[https://www.waveshare.com/poe-hat-b.htm Website]
 
|website_en=[https://www.waveshare.com/poe-hat-b.htm Website]
Line 9: Line 10:
 
|interface2=RPi
 
|interface2=RPi
 
}}
 
}}
==Instroduction==
+
=Instroduction=
 
This Power Over Ethernet HAT (Type B) is designed for Raspberry Pi 3B+/4B, it supports 802.3af Power-Sourcing equipment for PoE function.
 
This Power Over Ethernet HAT (Type B) is designed for Raspberry Pi 3B+/4B, it supports 802.3af Power-Sourcing equipment for PoE function.
===Features===
+
==Features==
*Standard Raspberry Pi 40PIN GPIO header, supports Raspberry Pi 3B+/4B
+
*Standard Raspberry Pi 40PIN GPIO header, supports Raspberry Pi 3B+/4B.
*PoE (Power Over Ethernet) capability,802.3af-compliant
+
*PoE (Power Over Ethernet) capability,802.3af-compliant.
*Fully isolated switched-mode power supply (SMPS)
+
*Fully isolated switched-mode power supply (SMPS).
*0.91" OLED, for monitoring processor temperature, IP address, and fan status in real-time
+
*0.91" OLED, for monitoring processor temperature, IP address, and the real-time fan status.
*Onboard cooling fan, allows auto running on powerup OR programmable control, configured by the switch
+
*Onboard cooling fan, allows auto running on powerup OR programmable control, configured by the switch.
*Integrates PCF8574 IO expander for I2C bus, providing pin P0 for directly fan control, and more spare IO pin
+
*Integrates PCF8574 IO expander for I2C bus, providing pin P0 for direct fan control, and more spare IO pins.
 
===Specifications===
 
===Specifications===
 
*PoE Power input: 37V ~ 57V DC in
 
*PoE Power input: 37V ~ 57V DC in
Line 23: Line 24:
 
*Network standard: 802.3af PoE
 
*Network standard: 802.3af PoE
 
*Dimensions: 56.5mm x 65mm
 
*Dimensions: 56.5mm x 65mm
 +
*OLED control interface: I2C
 
*OLED size: 0.91inch
 
*OLED size: 0.91inch
*OLED pixels: 128x32
+
*OLED pixels: 128 x 32
 
*OLED driver: SSD1306
 
*OLED driver: SSD1306
 
*OLED display color: White
 
*OLED display color: White
 +
*OLED viewing angle: greater than 160°
 +
*GPIO expansion interface: I2C
 +
*GPIO expansion chip: PCF8574
 +
 
==Examples==
 
==Examples==
 
===Hardware connection===
 
===Hardware connection===
You need to connect the PoE HAT to Raspberry Pi as picture<br />
+
You need to connect the PoE HAT to Raspberry Pi as shown in the picture.<br />
 
[[File:PoE-HAT-B-details-5.jpg|600px]]
 
[[File:PoE-HAT-B-details-5.jpg|600px]]
 +
 
===Enable I2C Interface===
 
===Enable I2C Interface===
I2C interface is required for the OLED display, you need to first enable the i2c interface for properly work.<br />
+
The I2C interface is required for the OLED display, you need to first enable the I2C interface to work properly.<br />
 
Open a terminal of Raspberry Pi and configure:<br />
 
Open a terminal of Raspberry Pi and configure:<br />
 
  sudo raspi-config
 
  sudo raspi-config
Line 39: Line 46:
 
[[FILE:TSL25911 Light Sensor-5.png]]
 
[[FILE:TSL25911 Light Sensor-5.png]]
  
===Libraries installation===
+
And then reboot the system.
 +
sudo reboot
 
{{Libraries Installation for RPi}}
 
{{Libraries Installation for RPi}}
 
===Download example===
 
===Download example===
Open a terminal and download with commands below. <br />
+
Open a terminal and download with the commands below. <br />
 
<pre>
 
<pre>
 
cd
 
cd
wget https://www.waveshare.com/w/upload/8/8b/PoE_HAT_B_code.zip
+
wget https://files.waveshare.com/upload/8/8b/PoE_HAT_B_code.zip
 
unzip -o  PoE_HAT_B_code.zip -d ./PoE_HAT_B_code
 
unzip -o  PoE_HAT_B_code.zip -d ./PoE_HAT_B_code
 
sudo chmod 777 -R PoE_HAT_B_code
 
sudo chmod 777 -R PoE_HAT_B_code
Line 51: Line 59:
  
 
===Run the example===
 
===Run the example===
Open a terminal and run the example
 
 
;C
 
;C
 +
 +
Note: C language does not use the library by default, and uses the method of reading and writing the device number. If you need to change it, please modify the Makefile file.
 +
:[[File:POE_Makefile.png]]
 
<pre>
 
<pre>
cd ~/PoE_HAT_B_code/c/
+
cd PoE_HAT_B_code/PoE_HAT_B_code/c/
 
make clean  
 
make clean  
 
make
 
make
 
sudo ./main
 
sudo ./main
 
</pre>
 
</pre>
;python
+
; python
 
<pre>
 
<pre>
cd ~/PoE_HAT_B_code/python/examples
+
cd PoE_HAT_B_code/PoE_HAT_B_code/python/examples/
 
sudo python main.py
 
sudo python main.py
 
</pre>
 
</pre>
===Set the temperature threshold===
+
; Rotation
 +
Modify OLED initialization as shown below:<br/>
 +
[[File:PoE HAT (B) Rotation.png]]<br/>
 +
C language in the picture.
 +
 
 +
===Set the Fan Startup Temperature===
 +
 +
<pre>
 +
#C
 +
sudo nano examples/main.c
 +
# POE_HAT_Display() function last parameter to set the fan on temperature
 +
 
 +
# python
 +
sudo nano examples/main.py
 +
# POE.POE_HAT_Display() function parameter sets the fan-on temperature
 +
</pre>
 +
<!--
 
; C
 
; C
 
<pre>
 
<pre>
sudo nano ~/PoE_HAT_B_code/c/examples/main.c
+
sudo nano examples/main.c
 
</pre>
 
</pre>
Modify the last parameter of POE_HAT_Display() and save
+
Set the last parameter of the POE_HAT_Display() function as the fan's turn-on temperature
 
; python
 
; python
 
<pre>
 
<pre>
 
sudo nano ~/PoE_HAT_B_code/python/examples/main.py
 
sudo nano ~/PoE_HAT_B_code/python/examples/main.py
 
</pre>
 
</pre>
Modify the last parameter of POE.POE_HAT_Display() and save
+
Set the fan on the temperature in the POE.POE_HAT_Display() function parameter.
 +
-->
 +
 
 
===Auto-run===
 
===Auto-run===
Modify rc.local file
+
Modify rc.local file:
 
<pre>
 
<pre>
 
sudo nano /etc/rc.local
 
sudo nano /etc/rc.local
 
</pre>
 
</pre>
* Add the following line in front of the line exit 0
+
* Set the boot to start automatically. Add sudo /home/pi/Fan_HAT/c/main & before exit 0. Note that you must add "&" to run in the background. Otherwise, the system may not be able to start.
 
<pre>
 
<pre>
 
fi
 
fi
sudo /home/pi/PoE_HAT_B_code/c/main &
+
sudo /home/pi/PoE_HAT_B_code/PoE_HAT_B_code/c/main &
#exit 0
+
exit 0
 
</pre>
 
</pre>
  
or
+
=Resources=
 +
==Documents==
 +
*[https://files.waveshare.com/upload/a/af/SSD1306-Revision_1.1.pdf SSD1306 datasheet]
 +
*[https://files.waveshare.com/upload/8/8a/SI3404.pdf SI3404 datasheet]
 +
<!--*[https://files.waveshare.com/upload/4/47/PoE_HAT_%28B%29.pdf Schematic]-->
 +
 
 +
==Example==
 +
*[https://files.waveshare.com/upload/8/8b/PoE_HAT_B_code.zip Codes]
  
<pre>
 
fi
 
sudo python3 /home/pi/PoE_HAT_B_code/python/examples/main.py &
 
#exit 0
 
</pre>
 
  
==Resources==
+
==Third Party Programs==
===Documents===
+
*Use routines before using third-party programs to ensure that there are no problems with the hardware. We do not maintain third-party programs, we only recommend them.
*[https://www.waveshare.com/w/upload/a/af/SSD1306-Revision_1.1.pdf SSD1306 datasheet]
+
*[https://github.com/klamann/raspi-poe-mon Raspi PoE HAT Monitor]
*[https://www.waveshare.com/w/upload/8/8a/SI3404.pdf SI3404 datasheet]
+
*[https://github.com/jackra1n/RustBerry-PoE-Monitor RustBerry-PoE-Monitor]
<!--*[https://www.waveshare.com/w/upload/4/47/PoE_HAT_%28B%29.pdf Schematic]-->
 
  
===Example===
+
*Weixue team thanks all developers for their support
*[https://www.waveshare.com/w/upload/b/b7/PoE_HAT_B_code.7z Codes]
 
  
===Third Party Examples===
+
==Third Party Examples==
 
*[https://github.com/yostinso/waveshare_poe_b_kernel_driver kernel driver which supports Raspberry OS and Ubuntu]
 
*[https://github.com/yostinso/waveshare_poe_b_kernel_driver kernel driver which supports Raspberry OS and Ubuntu]
  
==Support==
+
=FAQ=
{{Service00}}
+
{{FAQ|What is the height of the PoE HAT (B)?
 +
|
 +
27.5mm, as shown below
 +
 
 +
[[File:PoE-HAT-B-height.jpg|600px]]
 +
}}
 +
=Support=
 +
{{Servicebox1}}

Latest revision as of 08:32, 23 March 2024

PoE HAT (B)
PoE HAT (B)

Power Over Ethernet HAT (Type B) For Raspberry Pi 3B+/4B, 802.3af Power-Sourcing Equipment Required
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Instroduction

This Power Over Ethernet HAT (Type B) is designed for Raspberry Pi 3B+/4B, it supports 802.3af Power-Sourcing equipment for PoE function.

Features

  • Standard Raspberry Pi 40PIN GPIO header, supports Raspberry Pi 3B+/4B.
  • PoE (Power Over Ethernet) capability,802.3af-compliant.
  • Fully isolated switched-mode power supply (SMPS).
  • 0.91" OLED, for monitoring processor temperature, IP address, and the real-time fan status.
  • Onboard cooling fan, allows auto running on powerup OR programmable control, configured by the switch.
  • Integrates PCF8574 IO expander for I2C bus, providing pin P0 for direct fan control, and more spare IO pins.

Specifications

  • PoE Power input: 37V ~ 57V DC in
  • PoE Power output: 5V 2.5A DC out
  • Network standard: 802.3af PoE
  • Dimensions: 56.5mm x 65mm
  • OLED control interface: I2C
  • OLED size: 0.91inch
  • OLED pixels: 128 x 32
  • OLED driver: SSD1306
  • OLED display color: White
  • OLED viewing angle: greater than 160°
  • GPIO expansion interface: I2C
  • GPIO expansion chip: PCF8574

Examples

Hardware connection

You need to connect the PoE HAT to Raspberry Pi as shown in the picture.
PoE-HAT-B-details-5.jpg

Enable I2C Interface

The I2C interface is required for the OLED display, you need to first enable the I2C interface to work properly.
Open a terminal of Raspberry Pi and configure:

sudo raspi-config
Interfacing Options -> I2C -> Yes

TSL25911 Light Sensor-5.png

And then reboot the system.

sudo reboot

Libraries Installation for RPi

PS: If you are using the system of the Bullseye branch, you need to change "apt-get" to "apt". The system of the Bullseye branch only supports Python3.

First of all you make sure to use which language C or python Open the terminal of Raspberry Pi and install libraries as guides below

Install Library

If you use the bookworm system, you can only use lgpio library, bcm2835 and wiringPi can't be installed and used.

BCM2835

#Open the Raspberry Pi terminal and run the following command
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
tar zxvf bcm2835-1.71.tar.gz 
cd bcm2835-1.71/
sudo ./configure && sudo make && sudo make check && sudo make install
# For more, you can refer to the official website at: http://www.airspayce.com/mikem/bcm2835/

WiringPi

#Open the Raspberry Pi terminal and run the following command
cd
sudo apt-get install wiringpi
#For Raspberry Pi systems after May 2019 (earlier than that can be executed without), an upgrade may be required:
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
# Run gpio -v and version 2.52 will appear, if it doesn't it means there was an installation error

# Bullseye branch system using the following command:
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
. /build
gpio -v
# Run gpio -v and version 2.70 will appear, if it doesn't it means there was an installation error

lgpio

#Open the Raspberry Pi terminal and run the following command
wget https://github.com/joan2937/lg/archive/master.zip
unzip master.zip
cd lg-master
sudo make install

# You can refer to the official website for more: https://github.com/gpiozero/lg

Install Python Library

#python2
sudo apt-get update
sudo apt-get install python-pip
sudo pip install RPi.GPIO
sudo apt-get install python-smbus
#python3
sudo apt-get update
sudo apt-get install python3-pip
sudo pip install RPi.GPIO
sudo apt-get install python3-smbus

Download example

Open a terminal and download with the commands below.

cd
wget https://files.waveshare.com/upload/8/8b/PoE_HAT_B_code.zip
unzip -o  PoE_HAT_B_code.zip -d ./PoE_HAT_B_code
sudo chmod 777 -R PoE_HAT_B_code

Run the example

C

Note: C language does not use the library by default, and uses the method of reading and writing the device number. If you need to change it, please modify the Makefile file.

POE Makefile.png
cd PoE_HAT_B_code/PoE_HAT_B_code/c/
make clean 
make
sudo ./main
python
cd PoE_HAT_B_code/PoE_HAT_B_code/python/examples/
sudo python main.py
Rotation

Modify OLED initialization as shown below:
PoE HAT (B) Rotation.png
C language in the picture.

Set the Fan Startup Temperature

#C
sudo nano examples/main.c
# POE_HAT_Display() function last parameter to set the fan on temperature

# python 
sudo nano examples/main.py 
# POE.POE_HAT_Display() function parameter sets the fan-on temperature

Auto-run

Modify rc.local file:

sudo nano /etc/rc.local
  • Set the boot to start automatically. Add sudo /home/pi/Fan_HAT/c/main & before exit 0. Note that you must add "&" to run in the background. Otherwise, the system may not be able to start.
fi
sudo /home/pi/PoE_HAT_B_code/PoE_HAT_B_code/c/main &
exit 0

Resources

Documents

Example


Third Party Programs

  • Use routines before using third-party programs to ensure that there are no problems with the hardware. We do not maintain third-party programs, we only recommend them.
  • Raspi PoE HAT Monitor
  • RustBerry-PoE-Monitor
  • Weixue team thanks all developers for their support

Third Party Examples

FAQ

 Answer:

27.5mm, as shown below

PoE-HAT-B-height.jpg

{{{3}}}
{{{4}}}

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 AM GMT+8 (Monday to Friday)