radio, electronics, computing, telecnology.

rss icon
twitter icon


Donations are gratefully accepted and always go towards improving the site.

Raspberry Pi Server Is Solar Powered

By Stephen Stebbing 2014-10-26 01:14:24 0 comments

This project came about as a part of my ongoing efforts to convert the office/radio shack/electronics room to solar power.

Investigation revealed that the old dual-core 2.2GHz laptop that I have running 24 hours per day and providing various file and network services among other things, was using at least 30 watts, even with all the power saving features turned on, and over 45W when it was working hard. Obviously, running this from my battery bank wasn’t really feasible, especially when you consider that it currently comprises of around 40Ah of capacity provided by a couple of old car batteries.

I reasoned that as the laptop wasn’t doing much processing most of the time, and usually ran at it’s lowest clock speed of 800MHz, and didn’t really need 4GB of ram then the Raspberry Pi that had been sitting in the draw looking for something to do might be a reasonable replacement. I had a nice plastic case salvaged from an old radio and a 500GB USB HDD, so I decided to put it together and see how it would go in replacing the laptop.

1. Requirements

Besides running all the services that the old laptop did, I figured it would be nice if it could also have the following features:

  • RS232 port on the front panel with tty running so a console would be possible if ssh was not working due to networking problems. This would also be handy for microcontroller software development work.
  • LCD for displaying statuses and alerts etc.
  • Four software configurable push buttons.
  • Plenty of USB sockets for connecting devices and charging. This was provided by stripping down a cheap powered USB hub.
  • Audio out from the Pi for listening to music or for use as a signal generator etc.
  • Real time clock so the Pi’s time would be correct at startup and when ntp was not running

2. Hardware

A piece of blank printed circuit board was cut to size and screwed to the bottom of the case giving a mounting surface for the various hardware modules. I reasoned that having a good ground plane would be important if I had to shield the rest of the case for RFI reduction purposes, but as it turned out, I can’t detect any sign of interference in my HF receiver and so wont bother with further shielding.

At centre top is the power input which runs via a 1.5A fuse to the 5v 3A switch-mode power supply at top right. The 5v powers the USB hub, which in turn, back feeds power to the Pi, this of course negates the protection provided by the Pi’s onboard fuse, but I figure that it should be okay, if I’m careful when working on things.

The HDD is mounted to the PCB with the Pi mounted above it with a gap of 8mm or so. There is just enough space at the side to allow the SD card to be inserted and removed.

The USB from the Pi goes to the hub located at bottom left. I connected the HDD via the hub rather than directly to the Pi’s second USB socket as the 2.5W that it requires is at the limit of what the Pi can supply. The ethernet cable connects the Pi to the cat5 cable-joiner at top left.

The cables are longer than required but are the shortest that I could find; they coil up reasonably well and seemingly without putting excessive strain on the connectors. I have sinced replaced the ethernet cable with a much shorter 20cm patch lead which helps a lot.

The remaining hardware was mounted to the rear of the front panel with copious amounts of hot-melt glue. At top right, but difficult to see in the photo, is a MAX3232 serial-to-RS232 module connected to the Pi’s serial pins. The little red board next to that is a 5v to 3.3v linear regulator which is mounted on the power distributiion board with the three rows of pin headers.

At left is a perf board which mounts on the back of the LCD module. On its left is the TinyRTC module containing a DS1307 I2C RTC chip – the battery kept on popping out and so is held in with glue. Next to that, at top, is the LCD I2C backpack module. Beneath that are pins for connecting the push buttons and a 3.3v to 5v level converter which allows the 3.3v I2C lines on the Pi to be safely connected to the 5v lines of the I2C devices.

Connections to the Pi were made via two rows of female pin headers fitted to the Pi’s male pins as seen at bottom left in the photo. This allows the Pi to be easily removed if required. All wiring was done with wirewrap connections as this allows easy debugging and for future modifications. Bluetac holds the wiring in place!

The rear panel is the front panel from the old radio that was originally in the box. The existing rectangular hole is conveniently located to allow an HDMI cable to be connected to the Pi should that be required.

A small 12v fan has since been mounted at the left, and blows over the power supply heat sink which was becoming a little too warm to comfortably touch for too long. The air also flows over the Pi and HDD and exits through the top of the case via the loudspeaker grill.

Running the fan from 5v makes it close to silent while still proving adequate air flow, but it does add around 350mW to power requirement. In future I may connect it to a GPIO so it can be controlled by the Pi.

2.1. I2C Pullup Resistors

The RTC and LCD backpack modules both have pullup resistors installed on the board, which would be handy if there was only ever one device on the i2c bus, but with both devices connected the resistors are in parallel, and also in parallel with the resistors on the level converter module, making the overall pullup resistance too low.

I solved the problem by finding the pullups on the RTC module by probing with an Ohmmeter and removing them. The resistance of the pullups on the backback module in parallel with the level convert resistors is around 3.5k Ohm which works fine in this application.

3. Services and Software

The Pi server runs the following services and without any noticable drop in speed when compared to the old laptop server:

  • Backup for itself and other computers via rsync.
  • Network services: DNS, DHCP, IP firewall and routing.
  • Squid HTTP proxy.
  • Email services: SMTP, IMAP, POP, fetchmail.
  • MySQL database server – admittedly very lightly loaded.
  • Several staging, development, backup and local web servers.
  • NFS and SMB file servers – for unknown reasons, NFS sometimes has little ‘pauses’ for a few seconds.
  • Service monitoring.
  • Print server.
  • SVN server.
  • Approx Linux software repository cache.

It also plays music for when I want to listen in the office and provides ample USB ports for connecting devices and charging etc.

Linux provides an inbuilt driver for the DS1307 I2C RTC module, see here for details on setting it up, but I had to write a utility for driving the I2C lcd.

4. Power Usage

The power usage ranges from about 5W in more-or-less idle mode to a maximum seen so far of 7.5W when the Pi and HDD were very busy doing a large rsync backup over ssh. Taking an average of say 6W, gives energy consumption of about 150Wh per day, or 12.5Ah for a 12v battery. So far, it has run for over a month powered from an old car battery that only charges when the sun is shining; there should be enough capacity for more than two days without charge.

5. Conclusion

Needless to say I’m very happy with my Raspberry Pi solar-powered server. It satisfactorily replaces the old laptop server and with an energy saving of some 5kWh per week which would cost around $2 if provided by the electricity company. It’s ability to run for extened periods in the absence of mains power (and sunshine) makes it a solid and reliable base for further home automation and monitoring projects.

Related Articles

Copyright 2012 - 2015 Telecnatron CSS | Login | Privacy | Sitemap Web software by Stebbing Computing.