Portable Battery and Solar Powered Raspberry Pi Zero web server instructions.
"Can I build a portable web server that runs off battery alone, topped up with a solar panel? There’s only one way to find out. At the time of writing this, the Raspberry Pi Zero is running on a solar power bank and is therefore completely off the grid."
"I bought an Aisla 20,000Mah power bank off Amazon for £16. Nice capacity, complete with a solar panel for a modest price." Pictured is the solar panel with the built in battery, and the white thing is the pi in a case.
Raspberry Pi Zero: £15.60 at
thepihut.com/.../raspberry-pi-zero-w So for about £30 or 38 USD you can have a portable, off grid web server.
"I asked the community on Reddit what tutorials people wanted me to write, and one, in particular, caught my imagination. ‘Thaslegendary’ said:
“A guide on how to power raspberry pi zero with 4 AA battery would help me a lot”
This really got me thinking. Can I build a portable web server that runs off battery alone, topped up with a solar panel? There’s only one way to find out. At the time of writing this, the Raspberry Pi Zero is running on a solar power bank and is therefore completely off the grid."
"Step 1 – Choose your power supply and hardware
The Raspberry Pi choice had to be a Zero W. According to Jeff Greerling the Raspberry Pi Zero W uses around 0.4w, a super low consumption. The power bank choice was essential too, it had to fulfil the following criteria:
Has to have at least 10,000Mah battery
Has to have a solar panel for topping up the charge
Has to have a USB port capped at 1a to promote longer battery life
I bought an Aisla 20,000Mah power bank off Amazon for £16. Nice capacity, complete with a solar panel for a modest price."
Raspberry Pi (pictured)
AISLA ONLUS Solar power battery (pictured) with Pi.
"Step 2 – Install Nginx
I’m going for Nginx as the web server for this project. Nginx is lightweight and uses minimal resources. Let’s first ensure that our installation of Raspbian is up-to-date (I’m assuming that your Raspberry Pi Zero is already working and you’re using Raspbian OS and you’ve connected to your Wifi network):
sudo apt-get update -y && sudo apt-get upgrade -y
Now for Nginx installation:
sudo apt-get install nginx -y
After a short while, Nginx should be installed. Go ahead and visit the IP address of your Raspberry Pi Zero. You should see something a little like this: (see picture)
So that’s pretty much it for Nginx, add whatever site you want to or even install PHP. Next, we’ll take a look at some monitoring. "
"Step 4 – Configure the proxy in Nginx
We’re going to proxy our requests to Rpi-Monitor via nginx. This allows us to have our regular web traffic to Nginx and to Rpi-Monitor without an ugly port number on the URL. It also allows us to later add an SSL certificate to our monitoring page (see Adding SSL for free with Let’s Encrypt).
Edit the default site configuration by typing the following command:
sudo nano /etc/nginx/sites-available/default
In the configuration, we will see an entry for ‘location /’. Underneath that location block (so after the closing curly brace) add this:
location /monitor/ {
proxy_pass http://127.0.0.1:8888/;
proxy_read_timeout 120s;
access_log off;
}
This will allow requests to example.com/monitor/ to show Rpi-Monitor. Your configuration will now look a little like this photo
"Exit and save by hitting CTRL + X. Finally, test that your configuration isn’t broken by typing the following command:
sudo service nginx configtest
You should have an OK message. Go ahead and restart Nginx:
sudo service nginx restart
In your browser, visit your Raspberry Pi Zero’s IP address and append /monitor/ to the URL. You should see something like this:"
"Conclusion
We’ve got our solar-powered, completely off-grid Raspberry Pi Zero, installed Nginx and Rpi-Monitor. It’s a truly portable device that can be used for many many different applications. How long the device can run off battery remains to be established. Below is an iframe of the actual monitoring page on my battery operated Raspberry Pi Zero. As always, any questions or feedback, feel free to add a comment and click a banner if you found this tutorial to be beneficial.
View the Rpi-Monitor on my Solar Powered Raspberry Pi Server."