My Home Solar System Project

Not a lot of room in my backyard! A couple more coming!

Container houses all electronics and batteries.


This is a solar-powered battery system that charges 2 100 amp/hour AGM batteries and can provide up to about 40 amps of current. It was originally intended to run my Christmas lights and decorations, but is now capable of running more than that.
My goals with the development of this system were as follows:

  • Provide the necessary power for the small tasks I envisioned to run (Christmas decorations and a few lights.)
  • Provide real-time data of power being collected from the sun, stored in the batteries, and used by the various loads connected to them.
  • Control all parts of the system remotely.
  • Occupy the least amount of space and in the least conspicuous manner in my small backyard.

Top view of the devices that receive and handle the power.

Where the Raspberry Pi and other components reside.

Main Components

Photovoltaic panels
The current setup uses 4 100 watt monocrystalline solar panels from Renogy (

Solar Charge Controller
Charge controller is vital to properly charging and maintaining your batteries. I use a 40 amp MPPT (maximum power point tracking) SolarEpic charge controller (

Close up of the batteries, DC to AC inverter, and solid state relay that controls power to the inverter.

I currently have two 100 am/hour deep cycle AGM 12 volt batteries ( Connected in series to provide 200 amp/hours.

The system runs a 800 watt (peak of 1600 watt) pure sine wave 12 volt DC to AC inverter (

System Controller
A Raspberry Pi running Raspbian Jessie Lite ( receives data from the MPPT controller as well as a couple of older Arduino Duemilanove boards. The Arduino boards control a solid state relay that provides power to the inverter and reports back its status to the Raspberry Pi. The other Arduino receives data from a CSLA2CD linear current sensor ( monitoring the positive pole of the battery system.

The Raspberry Pi runs off of a 5 volt UBEC adapter (  that’s typically used to connect LiPO batteries to remote control model cars and airplanes. It provides ample amperage (up to 3 amps) when the Pi needs it at a very consistent voltage hovering at around 5.2 volts.

Safety controls
Fast acting circuit breakers
I have installed 40 amp circuit breakers ( between various sections of the system to minimize damage due to overloads or spikes.

Solid State Relay
Power to the inverter flows through a solid state relay ( This relay is controlled via an Arduino and managed by the Raspberry Pi control system.

Living in Florida I needed to make sure the Raspberry Pi in charge of managing most of the equipment remained cool and relatively free of humidity. Since this system will be in my backyard, I installed a bathroom fan system that runs an AC fan ( to pull air from the outside of the container. The air flows through aluminum pipes and directly into the container that protects the Raspberry Pi and other circuits. I also installed a smaller DC fan to pull the hot air out of this box and into the larger container area. I use a relay shield ( managed from the Raspberry Pi to control when the fans run. They start when the Pi’s CPU temperature reaches a threshold I set. I can also turn off and on the fans via the web interface.

Panel installation

I used mostly 2 x 4s to create a framing structure to support the panels. I also wanted the ability to tilt them from about 20 degrees to 0 degrees (fully horizontal). All of this needed to happen in a very small area away from wondering eyes. 

I used Everbilt slotted angles to attach the panels to the wood. To protect the panel's aluminum framing I used rubber sheets and cut to the size so the aluminum wouldn't touch the slotted angles as I read that the aluminum, if scratched or broken, may rust and fall apart. 

The area assigned for my panels may hold a total of 6. I am thinking that the top of the container may be able to hold a 7th one. For now, though, I am sticking with 4.

system infrastructure

Schematic of the entire system

The schematic diagram gives a pretty clear idea of how everything is connected.

Panels to Charge Controller
The panels are connected in parallel to keep voltage at about 12 volts and increase the amperage. These are connected to a 40 am fast acting circuit breaker on the positive cable and then on to the MPPT controller.

Controller to Batteries
The controller then connects to the batteries via another 40 amp breaker. The breaker then has wires connected to the terminal blocks which then connect to the batteries.

The batteries are connected in series as well thus doubling their amp/hour rating. 

I decided to have all power connections end in terminal blocks rather than on the batteries directly. This helped me organize my connections more neatly and also gave me the added benefit of more easily controlling when power to and from the batteries could occur. I added another breaker between the positive end of the batteries and the positive terminal block to enable this control. I also added the current sensor right at the terminal block area to monitor the current flowing from and to the battery.

Batteries to Inverter
These two are connected directly via their negative terminals. The positive terminal from the battery connects to a 40 amp breaker and then to a 40 am solid state relay. The relay is controlled by an Arduino board which is connected to the Raspberry Pi via USB. The Arduino is programmed to turn on or off power to the relay and thus opening or closing the circuit from the battery to the inverter. On the Raspberry Pi I have a python script running on the background and monitoring commands coming from the web interface to open or close the circuit. It also polls the Arduino board to know what state the relay is on.

Yellow line signifies the USB connection between the Pi and Arduino. Also note the presence of a 47 micro farad capacitor between the Arduino's reset pin and ground. This is to prevent the Arduino from resetting every time a serial connection is established.

2017-05-27 10.40.34 - Copy.jpg

Powering the Arduino to control the relay is done via the 12 volt battery system itself and not through the Pi's USB connection. I noticed that the Pi consumed less power (amperage requirement dropped) when the Arduino had its power supplies from the batteries. This arrangement made the Pi more stable.

Raspberry Pi As The Control Center

The Raspberry Pi plays several important roles in the data acquisition, storage, and management of the whole system:

Reading Data from the Charge Controller
Thanks to the great documentation I found at the Solar Powered Home website, I was able to decipher the data coming from the MPPT controller via its RS485 interface. I won't repeat what the author explained. Make sure tom visit his site; it's worth it! I have taken part of his scripts in Python and adjusted them to fit my needs.

Reading Data from the CSLA2CD current sensor
The sensor is connected to another Arduino and sends data back to the Raspberry Pi via the USB interface. 

Essentially the sensor returns half of the voltage it receives when there is zero current, as the sensor detects changes in the magnetic field near the source of current (the positive wire from the battery to the terminal block) the signal voltage changes. The Arduino receives this voltage in its analog pin and converts it to a value between 0 and 1023. I had to use a voltage divider to bring the voltage down from 6 volts to 3 so it the analog pin could handle it.

This Arduino is also powered directly from the 12 volt batteries. However, because their voltage changes so radically, the data I receive from the sensor is erratic and not very accurate. I will need to add a voltage regulator to stabilize the voltage being fed to the sensor in order to receive usable data.

Storing All Data
I use MySQL as the database to store all data coming from the sensors and the charge controller as well as some settings to handle the whole system. My code will be available on my Github page.

Controlling The Fans and The Solid State Relay
A couple of python scripts are constantly running on  the background monitoring the database for changes to a settings table that stores whether the relay should be open or closed, if the fans should be allowed to run, and if so, at what temperature should they start.

Credits and Thanks

Much of what I was able to accomplish is thanks to the information provided in the following links: