The first prototype of a solar server with a charge controller. Photo:
In September 2018, an enthusiast from Low-tech Magazine . The goal was to reduce energy consumption enough so that a self-hosted home server could run on a single solar panel. This is not easy, as the site needs to operate 24 hours a day. Let's see what the outcome was.
You can visit the server , check the current energy consumption and battery charge level. The website is optimized for minimal page requests and low traffic, so it should withstand a spike in visits from Habr. According to the developer's calculations, the energy consumption per unique visitor is 0.021 Wh.
Just before dawn on January 31, 2020, it had 42% battery charge remaining. Dawn in Barcelona is at 8:04 AM local time, after which current should start flowing from the solar panel.

Why?
Ten years ago, experts , that the development of the internet would lead to the 'dematerialization' of society, comprehensive digitization — and consequently, a reduction in overall energy consumption. They were wrong. In fact, the internet itself has demanded , and these amounts continue to grow.
IT companies have initiated transitions to alternative power sources, but this is currently impossible. All data centers consume three times more energy than all the solar and wind installations in the world generate. Worse still, the production and regular replacement of solar panels and wind turbines , which makes it impossible to abandon fossil fuels (oil, gas, uranium) today. However, these resources won't last long, so we inevitably have to think about how to live on renewable sources, including powering computer infrastructure, such as web servers.
Low-tech Magazine of excessively bloated web pages. From 2010 to 2018, the average page size increased , and for mobile sites — from 0.15 MB to 1.6 MB, by conservative estimates.
The increase in traffic volumes (energy required to transmit 1 megabyte of information), leading to a constant increase in the energy consumption of the internet. Heavier and more complex websites not only put more strain on the network infrastructure but also reduce the ‘lifespan’ of computers and smartphones, which are more frequently discarded and replaced with new ones, which also .
Of course, increased load is also caused by the lifestyle itself: people spend almost all their time online and rely heavily on various web services. Modern society is hard to imagine without cloud IT infrastructure (social networks, messengers, email, etc.)
Server and website configuration
In details the hardware configuration and software stack of the web server.
Single-board computer chosen for its low energy consumption and useful additional features, such as the inclusion of a power management chip . It allows querying statistics on the current voltage and current from the board and from the battery. The chip automatically switches the power supply between the battery and the DC connector, where current flows from the solar panel. Thus, uninterrupted power supply for the server with battery support is possible.

Olimex Olinuxino A20 Lime 2
Initially, a lithium-polymer battery with a capacity of 6600 mAh (approximately 24 Wh) was chosen as the battery, and later a lead-acid battery with a capacity of 84.4 Wh was installed.
The operating system boots from an SD card. Although the OS takes no more than 1 GB and a static website about 30 MB, it made no economic sense to buy a card smaller than Class 10 16 GB.
The server connects to the network via a 100 Mbps home connection in Barcelona and a standard consumer router. A static IP address is reserved for it. Almost anyone can host such a website in their apartment; you just need to slightly modify the firewall settings for port forwarding to the local IP:
Port 80 to 80 for HTTP Port 443 to 443 for HTTPS Port 22 to 22 for SSH
Operating system based on the Debian distribution and kernel , which is developed for single-board computers with AllWinner chips.

A 50-watt solar panel for the web server and a 10-watt panel for lighting the author's living room
The static website is generated by the system (website generator on Python). Static sites load faster and do not put a load on the CPU, making them much more efficient than dynamically generated pages in terms of energy consumption. The source code of the theme is .
A very important point is image compression, as without this optimization it is nearly impossible to make web pages smaller than 1 megabyte. For optimization, it was decided to convert photos to halftone images. For example, here is a photograph of female telephone operators at a switchboard in the last century, .

And here's the optimized halftone image size of with three colors (black, white, gray). Due to an optical illusion, it seems to the viewer that there are more than three colors.

Halftone photographs were chosen not only for size optimization (a rather questionable solution), but also for aesthetic reasons. This old image processing technique has certain stylistic features, which gives the site a somewhat unique design.
623 illustrations on the Low-tech Magazine website were optimized, reducing their size from 194.2 MB to 21.3 MB, a decrease of 89%.
All old articles were converted to Markdown for ease of writing new articles, as well as for easier backup through . All scripts and trackers were removed from the site, along with logos. The default font in the client's browser is used. As a 'logo' — the name of the magazine written in uppercase letters with a left arrow: LOW←TECH MAGAZINE. A total of 16 bytes instead of an image.
In case of downtime, an 'offline reading' option was organized: texts and images are exported to an RSS feed. 100% content caching is enabled, including HTML.
Another optimization is enabling the HTTP2 setting in nginx, which slightly reduces traffic and shortens page loading time compared to HTTP/1.1. The table compares the results for five different pages.
| | FP | WE | HS | FW | CW | |----------|-------|-------|-------|-------|-------| | HTTP/1.1 | 1.46s | 1.87s | 1.54s | 1.86s | 1.89s | | HTTP2 | 1.30s | 1.49s | 1.54s | 1.79s | 1.55s | | Images | 9 | 21 | 11 | 19 | 23 | | savings | 11% | 21% | 0% | 4% | 18% |
Full nginx configuration:
root@solarserver:/var/log/nginx# cat /etc/nginx/sites-enabled/solar.lowtechmagazine.com
# Expires map
map $sent_http_content_type $expires {
default off;
text/html 7d;
text/css max;
application/javascript max;
~image/ max;
}
server {
listen 80;
server_name solar.lowtechmagazine.com;
location / {
return 301 https://$server_name$request_uri;
}
}
server{
listen 443 ssl http2;
server_name solar.lowtechmagazine.com;
charset UTF-8; #improve page speed by sending the charset with the first response.
location / {
root /var/www/html/;
index index.html;
autoindex off;
}
#Caching (save html pages for 7 days, rest as long as possible, no caching on frontpage)
expires $expires;
location @index {
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-cache, no-store';
etag off;
expires off;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /var/www/;
#}
#Compression
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
#Caching (save html page for 7 days, rest as long as possible)
expires $expires;
# Logs
access_log /var/log/nginx/solar.lowtechmagazine.com_ssl.access.log;
error_log /var/log/nginx/solar.lowtechmagazine.com_ssl.error.log;
# SSL Settings:
ssl_certificate /etc/letsencrypt/live/solar.lowtechmagazine.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/solar.lowtechmagazine.com/privkey.pem;
# Improve HTTPS performance with session resumption
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
# Enable server-side protection against BEAST attacks
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
# Disable SSLv3
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# Lower the buffer size to increase TTFB
ssl_buffer_size 4k;
# Diffie-Hellman parameter for DHE ciphersuites
# $ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
ssl_dhparam /etc/ssl/certs/dhparam.pem;
# Enable HSTS (https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security)
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
# Enable OCSP stapling (http://blog.mozilla.org/security/2013/07/29/ocsp-stapling-in-firefox)
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/solar.lowtechmagazine.com/fullchain.pem;
resolver 87.98.175.85 193.183.98.66 valid=300s;
resolver_timeout 5s;
}Results of 15 months of operation
From December 12, 2018, to November 28, 2019, the server demonstrated . This means that due to bad weather, downtime for the year amounted to 399 hours.
However, if we disregard the last two months, the uptime was 98.2%, with only 152 hours of downtime, according to the developers. Uptime decreased to 80% during the last two months as energy consumption increased due to software updates. Each night, the site was down for several hours.
According to statistics, over the year (from December 3, 2018, to November 24, 2019), the server's electricity consumption was 9.53 kWh. Significant losses were recorded in the photovoltaic system due to voltage conversion and battery discharge. The solar controller showed an annual consumption of 18.10 kWh, indicating an efficiency of around 50%.

Simplified diagram. It does not show the voltage converter from 12 to 5 volts and the battery amp-hour meter.
During the study period, the website had 865,000 unique visitors. Including all energy losses in the solar installation, the energy consumption per unique visitor was 0.021 Wh. Thus, one kilowatt-hour of generated solar energy is sufficient to serve almost 50,000 unique visitors.
During the experiment, solar panels of various sizes were tested. The table provides calculations for how long batteries of different capacities will charge using solar panels of different sizes.

The average power consumption of the web server during the first year, including all energy losses, was 1.97 W. The calculation shows that to maintain the website at night during the shortest night of the year (8 hours and 50 minutes, June 21), 17.40 watt-hours of storage power is needed, while during the longest night (14 hours and 49 minutes, December 21), 29.19 Wh is required.

Since lead-acid batteries should not be discharged below half their capacity, the server requires a 60 Wh battery to survive the longest night with optimal daylight conditions (2×29.19 Wh). For most of the year, the system operated with a 86.4 Wh battery and a 50-watt solar panel, achieving the aforementioned uptime of 95-98%.
100% uptime
To achieve 100% uptime, the battery capacity needs to be increased. To compensate for one day of very poor weather (without significant energy generation), 47.28 watt-hours (24 hours × 1.97 watts) of storage is required.
From December 1, 2019, to January 12, 2020, a 168-watt battery was connected to the system, with a practical storage capacity of 84 watt-hours. This storage is sufficient to keep the website running for two nights and one day. The configuration was tested during the darkest period of the year, but the weather was relatively good — and during the specified period, uptime reached 100%.
However, to ensure 100% uptime over several years, we must prepare for the worst-case scenario when bad weather lasts for several days. Calculations show that in order to keep the site online for four days with low or zero energy generation, a lead-acid battery with a capacity of 440 watt-hours will be needed, which is about the size of a car battery.
Practically, in good weather, a 48 Wh lead-acid battery will keep the server running overnight from March to September. A 24 Wh battery will last the server a maximum of 6 hours, meaning it will shut down every night, although at different times depending on the month.
Overall, some websites do not necessarily need to operate at night when visitor numbers are minimal, according to the folks at Low-tech Magazine. For example, if it’s a regional city publication that does not attract visitors from other time zones, only local residents.
This means that websites with varying traffic and uptime require batteries of different capacities and solar panels of different sizes.


The author provides calculations on how much energy is needed for the production of the solar panels themselves (embodied energy) and how much is obtained when this amount is divided by the expected lifespan of 10 years.

Thus, one can calculate the equivalent of fossil fuels consumed in the production and operation of the panels. Low-tech Magazine found that in the first year of operation, their system (50 W panel, 86.4 Wh battery) "generated" approximately 9 kg of emissions or the equivalent of burning 3 liters of gasoline: about the same as what a passenger car emits over 50 km.

If the server is powered not by solar panels, but from the general power grid, then the equivalent emissions turn out to be about six times lower: 1.54 kg (Spain's energy sector has a high share of alternative energy and nuclear power). However, this is not quite a fair comparison, the author states, because it takes into account the embodied energy of the solar infrastructure but does not consider this indicator for the overall power grid, so the costs of its construction and maintenance are excluded.
Further Improvements
Over time, a number of optimizations have been implemented that reduced the server's energy consumption. For example, at some point, the developer noticed that 6.63 TB of the total 11.15 TB of traffic was generated by a faulty implementation of the RSS feed, which pulled content every few minutes. After fixing this bug, the server's energy consumption (excluding energy losses) dropped from 1.14 W to about 0.95 W. The gain may seem small, but a difference of 0.19 W translates to 4.56 watt-hours per day, which corresponds to over 2.5 hours of autonomous operation of the server.
During the first year, the efficiency was only 50%. Losses were observed during the charging and discharging of the battery (22%), as well as in converting the voltage from 12 V (solar photovoltaic system) to 5 V (USB), where losses can reach up to 28%. The developer admits that the voltage converter (controller without built-in USB) is not optimal, so this aspect can be optimized or a 5V solar installation can be considered.
To enhance energy storage efficiency, lead-acid batteries can be replaced with more expensive lithium-ion batteries, which have lower charge/discharge losses (<10%). The designer is currently considering a compact (CAES), which has a lifespan of decades, meaning a smaller "carbon footprint" for its production.

Compact compressed air energy battery,
Considering the installation of an additional wind turbine (it can be ) and installing a solar tracker to rotate the panels toward the sun. The tracker can increase electricity production by 30%.

Another way to enhance system efficiency is through scaling it. Hosting more websites on the server and running additional servers will reduce energy consumption per website.

Solar hosting company. Illustration: Diego Marmolejo
If you cover the entire balcony of an apartment with solar panels and start a solar web hosting company, the costs per client will be significantly lower than for a single website: savings from scale.
Overall, this experiment demonstrates that, under certain constraints, computer infrastructure can effectively operate on renewable energy sources.
Theoretically, such a server could even operate without a battery if it mirrors its energy in other parts of the world. For example, installing mirrors in New Zealand and Chile. There, the solar panels will work when it is night in Barcelona.
Source: habr.com
