PlugPi

WARNING: This project deals with hacking on mains AC power. Please proceed carefully.

I've wanted an inconspicuous wall wart style raspberry pi case / enclosure for the longest time, but there aren't many options out there. I've seen the PiPlug developed by the dude that runs n-o-d-e.net, but it wasn't quite what I was looking for. After some research; though, I think I've hit on the just the right ingredients to easily build out very sleek and inconspicuous cases.

These are links to the components I landed on.

Case:
https://www.polycase.com/pm2314
USB Chargers:
https://www.amazon.com/gp/product/B076C6PW2V
16 AWG Stranded Wire:
https://www.amazon.com/gp/product/B0746HRVZP
Assorted Heat Shrink:
https://www.amazon.com/gp/product/B0771K1Z7Q
30mm Heat Shrink Tubing:
https://www.amazon.com/gp/product/B00MJVQP5C
Reversible Right Angle Micro USB Cables:
https://www.amazon.com/gp/product/B07CBTVR8G

Here is one of the USB power supplies ripped apart next to an intact one. These things seem to be the best way to get cheap clean power in a small form factor. There are some other appealing options like the RAC05-05SK that are a bit cleaner and probably safer than cannibalizing a USB charger, but at 3x the price I decided I'd go this route.

As you can see the Raspberry Pi and this power adapter board sit nicely in this little project enclosure.

Soldering to the power adapter is quite easy. The pads for the mains AC were large, and soldering the cannibalized USB cable to the USB pads was easy enough. I secured all of these wires with hot glue as well.

Soldering to the poles inside the Polycase enclosure was tricky. I ruined the first one because I was hanging the soldering iron on the pole for too long and it melted the case causing it to become very unstable.

I then ripped off the little ground tab and hot glued the power adapter straight into the bottom of the enclosure. I would have used the 30mm heat shrink tubing to entirely wrap the power adapter entirely prior to securing it to the enclosure if I had actually thought about the size it for two second before impulsively hitting buy on Amazon and getting tubing that was 2x too large. I'll have it for the next iterations of this project though.

Here I just used some duct tape to keep the power adapter seperated from the Raspberry Pi. The 30mm heat shrink tubing will replace this mess in the future.

And here you can see that the USB cable can simply plug into the Pi's power port. The Pi has to sit in the enclosure at a slight angle, but it does sit in there will, and even with just a bit of wiggle room.

Finally here it is all buttoned up. Kind of boring, perfect.

Prior to enclosing everything it would probably be wise to configure the Pi for remote access as all the ports are occluded with this enclosure. This is my standard headless config that I use for a base on nearly all my headless Pi based projects.

-1: Flash Raspbian to SD card and sync

sudo dd if=~/Downloads/Raspbian_Image.img of=/dev/sdb bs=1M progress=status && sudo sync && sudo sync

-2: Remove and re-plug SD card if new partitions are not visible.
-3: Mount SD card.

sudo mkdir /mnt/piboot
sudo mkdir /mnt/piroot
sudo mount /dev/sdb1 /mnt/piboot
sudo mount /dev/sdb2 /mnt/piroot

-4: Enable SSH on boot.

sudo touch /mnt/piboot/ssh

-5: Set up interfaces file to enable WiFi roaming.

vim /mnt/piroot/etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

allow-hotplug eth0
auto eth0
iface eth0 inet dhcp

allow hotplug wlan0
iface wlan0 inet manual
	wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp
iface FBISurveilanceVan inet dhcp
iface BackupFBISurveilanceVan inet dhcp
iface CoffeeHouseWiFi inet dhcp

-6: Set up WiFi APs with priorities.

vim /mnt/piroot/etc/wpa_supplicant/wpa_supplicant.conf
update_config=1
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=US
ap_scan=1

network={
	ssid="FBISurveilanceVan"
	psk="SecretPassword01"
	id_str="FBISurveilanceVan"
	scan_ssid=0
	priority=11
}

network={
	ssid="BackupFBISurveilanceVan"
	psk="SecretPassword01"
	id_str="BackupFBISurveilanceVan"
	scan_ssid=0
	priority=10
}

network={
	ssid="CoffeeHouseWiFi"
	psk="NotSoSecretPassword"
	id_str="CoffeeHouseWiFi"
	scan_ssid=0
	priority=9
}

-7: Set crontab to invoke wpa_cli scan every 5 minutes

vim /mnt/piroot/etc/crontab
# m h  dom mon dow   command
*/5 * * * *	/usr/sbin/wpa_cli -i wlan0 scan

-8: Unmount SD card.

sudo umount /mnt/piboot
sudo umount /mnt/piroot

-9: Plug SD card into Pi, power it on, SSH to it, and continue configuration as desired.