RPi PowerBar
We calculate the final price from your selected file. You review and accept it before payment.
Saved on this device.
Minimalist power bar for the Raspberry Pi
- Rating
- 0 / 5
- Likes
- 1
- Downloads
- 13
- Makes
- 0
- Views
- 255
- Reviews
- 0
Updated at source:
Model information
- Source
- Printables
- Category
- Electronics
- License
- Creative Commons — Attribution — Noncommercial — Share Alike
Raspberry Pi Power Bar
I've now encountered several situations, where having better control over the Raspberry Pi power would have been really useful.
One scenario is the "headless" use, where there is no keyboard and no monitor connected to the Rpi, another is the use in a desktop scenario.
I currently have two Raspberry Pi 4 - one running Octoprint so I can remote control my Prusa Printer (headless use), the other running Ubuntu 20.10 on the desktop.
Both of them require rather massive cooling and it is annoying to not be able to start them up / shut them down right where they are without having to resort to (remote) logins.
When you research on the Internet, you will find that there are quite simple solutions to the three issues "Power Switch", "Power Indicator" and "Temperature controlled active cooling" - but alas, it does not look like they have ever been combined and there also is no simple solution to attach the required electronic parts to the Pi.
This project proposes a straight forward and rather simple solution to the problem: A 3d printed "Power Bar" to take the on/off switch, the power indicator led and some circuitry to PWM control a fan attached to the GPIO pins of the Pi.
Printing instructions
Printing this project is not quite as easy as it seems to be: The walls of the 40 pin Dupont connector are quite thin, and I had to experiment with the settings in the Slic3r PE program (recognize thin walls, add additional contours if needed) to get this to print properly.
You will definitely want to preview the slicer output (check for missing walls, especially in the connector area) before you print it!
Electronics
Essentially there are three separate circuits that need to be built inside the power bar and because each of them only consists of a maximum of three parts I did not use a PCB, but connected (soldered) them "on the fly" as needed, wrapped in shrink tubing for protection and insulation.
I also bought a crimp tool and some connectors for this project that had been on my wish list for some time so I could properly connect the electronics to the pins on the Raspi.
The circuitry shown in the photos does not quite match the circuit diagram in that I only used one connection to ground.
You can just implement part of the functionality by omitting the circuits you do not want or need - they really are three completely independent functions.
Software
The following settings must be configured in the config.txt file of the Raspi:
- For the on/off switch:
dtooverlay=gpio_shutdown,gpio_pin=4,active_low=1,gpio_pull=up
- For the power control led:
enable_uart=1
If you want the temperature controlled fan to operate, you will need to copy the attached python program fan_ctrl.py to /root, the fanctrl.service file goes in /etc/systemd/system. The RPi.GPIO python library is installed by default in the Rasbian image, but needs to be installed manually on ubuntu 20.10 (apt install python3-rpi.gpio).
Don't forget to reload systemd (systemctl daemon-reload) and to enable the service (systemctl enable fanctrl), otherwise it will not be started on boot.
Note: These .service files were uploaded as .txt files. Do strip the .txt extension before use and make sure the line endings are LF only for Linux/Unix (and neither CR+LF as Windows likes to make, nor CR only like macOS wants)!
References
- My 3d design: https://www.tinkercad.com/things/b9n5rtG8rFP
- RPi GPIO pinout: https://pinout.xyz/#
- Power Button: https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi
- Power LED: https://howchoo.com/g/ytzjyzy4m2e/build-a-simple-raspberry-pi-led-power-status-indicator
- PWM controlled fan: https://www.instructables.com/PWM-Regulated-Fan-Based-on-CPU-Temperature-for-Ras/
- Circuit Diagram Editor: https://www.circuit-diagram.org/editor/
- Crimp Tool: https://www.amazon.de/dp/B078K9DT69
- Diodes: 1N4148
- Transistor: BC377
My model was also published by me as https://www.thingiverse.com/thing:4653267 under the same license.