Added STL files for Raspberry Pi 4B. The positions of the power switch, the LED and the push button are switched, so keep that in mind when you want to use them.
Power switch functionality on the 4B has not been tested yet.
The GLOBAL_EN pin on the 4B may have a similar function as the PEN on the 3B+, but I didn't have the time to verify this.
Added the schematics and wiring diagram
Added a lot of pictures from the last made. Hope it's self explaining how it's done. :)
Had some incorrect instructions and an error in the file disp.py, should work now
Added some versions without switch, OLED and/or LED.
So you can can use the version which suits the best for your case, if you don't need all features.
This is an advanced 19" Rack Shield for the Raspberry Pi 2B / 3B / 3B+ / 4B (3B+ needed for power switch feature) with an OLED, power switch and status LED.
It was inspired by the great design from Kapozok (https://www.thingiverse.com/thing:1793758)
- OLED info screen (customizable Python script, i.e. IP adress, CPU & MEM utilization)
- Button for OLED, reboot and shutdown
- LED via GPIO
- Power switch (on 3B+ it turns the Pi completely off! On Pi 4B it has not been tested yet)
It fits the 19" DAP 2U rack frame available here:
The OLED shows information about current utilization, IP adress and hostname when you push the button (customizable Python script).
When you hold the button for longer than ~8 sec. and release it, the Raspberry Pi will perform a reboot.
When you hold the longer than ~12 sec. and release it, the Raspberry Pi will shutdown.
The OLED shows information about the current action (see video).
After the Raspberry Pi is shut down, you can switch it off (only the power indicator LED on the board will remain turned on by hardware design). All other electrical components on the board are turned off (SoC, RAM etc.)
Other Raspberry Pi versions may work too, but without power switch feature (since the PEN Pin is only available on 3B+; the GLOBAL_EN pin on the 4B may have a similar function, but has not been tested yet)
- 2x M2.5 screws (flat head)
- 2x M2 nuts
- 128x32 OLED 0,91" SSD1306 blue or white (link below)
- 1x Push button 6mm x 6mm x 7mm with cap (links below)
- 1x 3 mm LED
- 1x 10K resistor
- 1x 1K resistor
- 1x small piece of PCB 2,54mm hole pitch (link below)
- 11x jumper wires (link below)
- 1x Miniature slide switch (link below)
- 1x Pin header male (2 pins) (link below)
- Some hot glue
Links (these are only examples):
Push button cap:
3 mm low current LED:
Miniature slide switch:
You may use any other 3 mm LED, but maybe you have to use another resistor instead of the 1K resistor.
Schematics and more pictures of the buidling process will come soon...
OLED software part:
For using the OLED you can follow this guide first:
Since the OLED is rotated by 180° in this project, you have to make some changes to the library files.
Edit the following file:
sudo nano /home/pi/Adafruit_Python_SSD1306/Adafruit_SSD1306/SSD1306.py
The following changes are made in the section class SSD1306_128_32(SSD1306Base)
Line 307 change
self.command(SSD1306_SEGREMAP | 0x1)
Line 308 change
After you have changed this you have to run the setup again:
sudo python setup.py install
After that you can copy the attached file disp.py to your Raspberry Pi and make it executable:
chmod 755 disp.py
You can now start the attached disp.py by the following command:
or to run the script in the background:
nohup python disp.py &
Of course you can make your Raspberry Pi to start it automatically at bootup:
sudo nano /etc/rc.local
Add the following line above 'exit 0' (change the path to the correct location):
python /home/pi/disp.py &