Off Grid Van Power Information System
by thediylife in Circuits > Arduino
3542 Views, 33 Favorites, 0 Comments
Off Grid Van Power Information System
This off grid solar power information system is perfect for your Van or RV. It gives you a complete view of your Van’s power consumption and solar panel generation, it also predicts how long your batteries are going to last for and how much power is being generated by your solar panels. That's one less thing to worry about!
A quick look at the indicator lights tells you when your solar panels are charging your batteries, when they are generating more power than you are using as well as when your batteries are almost flat. An alarm sounds if your batteries are then further discharged to the point where they are at risk of being damaged.
The LCD provides you with detailed information on how much power your batteries have stored, how much is being used, how much is being generated by your solar panels and how long your batteries will last for.
The circuit is really simple to assemble and doesn’t require much soldering, it can be assembled on a breadboard if you are not confident soldering. You will need to know the basics of programming an Arduino, if you haven’t done this before – here is a useful guide to getting started with Arduino. You will also need to know roughly how to connect an LCD screen to an Arduino.
If you like this Instructable, please vote for it in the Van Life contest using the Vote button on the top right of the guide.
What You Will Need to Build the System
Here's a list of everything you need to build this power information system along with links to buy the items if you can't find them locally. Unfortunately, the small items like resistors and LEDs are usually not sold individually and you have to buy packs of them but they are relatively cheap anyway so you can use them for other projects.
How to Make the Power Information System
The control system consists of two separate parts, the power sensing circuits and the feedback and display circuits. It may be useful to separate the two within your van if your batteries and solar panel inputs are kept away from where you’d like the information displayed. This is easily done using a length of 6 core intercom or alarm wire between the sensors and your Arduino box.
The power sensing circuits for the battery and solar panel each consist of a voltage sensor and a current sensor, these two measurements combined are required to calculate the power consumption, battery life, time left etc.
The feedback circuits provide you with information on the system and includes the LCD shield which is mounted on top of the Arduino as well as the indication LEDs and alarm.
The complete circuit is shown in the diagram. We will build the complete system up in stages in order for you to understand what each circuit is doing and how it should be connected.
Voltage Measurement Circuits
For The Batteries
The first circuit is the voltage measurement from the battery which is done through a voltage divider circuit. The Arduino’s analogue inputs can only handle up to 5V and our batteries typically have a voltage of between 11.8V when empty and 14.7 volts when charging. We therefore need to scale this voltage down to under 5V so that we don’t damage the Arduino input.
Looking at the maximum voltage of the batteries during charge, 14.7V and the Arduino input voltage of 5V, you can see that the Arduino requires roughly a third of the charging battery voltage. This means that we will need a voltage divider in the ratio 1/3 to 2/3 which in turn means that we need the one resistor to be double the resistance of the second resistor. You also want the resistors to be of a reasonably high resistance to ensure that only a small amount of current flows through them otherwise you’re simply wasting energy in the form of heat. I’ve chosen to use a 20K and a 10K resistor as these provide round values in the exact ratio I need with a high resistance.
Simply connect the resistors as shown in the circuit diagram with the centre point of the voltage divider connected to the Arduino analogue input 1 and the two legs of the bridge connected to the positive and negative terminals of the battery. Make sure you have the positive and negative on the correct side of the bridge otherwise you scale will be 0-10V instead of 0-5V which will damage the Arduino. The lower value resistor must be connected to the negative terminal of the battery and the higher value resistor to the positive terminal on the battery.
For The Solar Panels
The voltage coming from your solar panels is measured in much the same way as the battery voltage expect that the solar panels typically produce a higher voltage than your battery voltage. Most solar panels have an output voltage of 18V, this also needs to be scaled down to 5V for the Arduino’s analogue inputs.
Using the same calculation as above, the scaled voltage is now roughly a quarter of the solar panel voltage so we will need one resistor to be three times the resistance of the other resistor. If we again use a 10K resistor, we will need a 30K resistor as the second resistor to divide the voltage to give us the correct scaling.
Connect the resistors as shown in the diagram, again with lower value resistor connected to the negative lead from the solar panel, the higher value resistor to the positive solar panel lead and the centre point connected to the Arduino analogue input 2.
Current Measurement Circuits
Current Being Drawn From The Batteries
The current sensing is done using the ACS712 sensor which can measure up to 30A. This equates to roughly 350W so if you expect to have a peak power consumption of higher than 350W then you’ll need to choose a sensor which can measure higher current or alternately split up your circuits into lighting, chargers, plugs etc each with their own sensor.
The sensor connection is straightforward, it is powered directly from the Arduino using the GND and VCC/5V pins and the OUT pin is connected to the Arduino analogue input 3. The sensor terminals are then connected in series with your load onto the supply lead from your battery.
As mentioned above, you could also get more functionality out of the power meter by installing a current sensor onto each of your power circuits. For example you could have one sensor on your lighting circuit, one on your 12V charger circuit and one on your AC inverter circuit. Each of the sensors would then be connected to their own Arduino analogue input.
Current Being Supplied By The Solar Panel
As we’ve done above for the batteries, we can connect a current sensor in series with the supply from the solar panel before it goes into the solar charge controller. The output from the sensor is then connected to one of the Arduino analogue input 4.
Feedback Circuits
The feedback from the Arduino is done through an LCD which is mounted onto an Arduino shield as well as two LEDs and an alarm.
The LCD shield can simply be plugged on top of the Arduino and provides all of the functionality required to drive the LCD. The contrast may require some adjustment in order to see the text clearly on the screen.
The LCD shield uses the following pins, the rest are available for your sensors and feedback circuits:
- Analogue 0
- Digital 4
- Digital 5
- Digital 6
- Digital 7
- Digital 8
- Digital 9
- Digital 10
The LEDs are connected in series with a 220Ω resistor and are each connected to a free digital output pin. The green LED is used to indicate when the solar panels are providing more power than you are using in your van, the batteries are therefore being charged. The red LED is used as an indication that the battery is running low and you should limit your power usage or charge the battery.
The buzzer is connected to the Arduino in a similar way to the current sensors. You will need to connect the GND and VCC pins to the Arduino GND and 5V pins and the input pin to one of the unused Arduino outputs.
Your circuits are now all complete and you can move on to programming the Arduino.
Programming the Arduino
Now you can upload your sketch onto your Arduino, if you haven’t uploaded a sketch before then follow this guide on getting started programming and Arduino.
The code is shown in the attached images and there is a link to download the code below. it is probably easier to follow by downloading and opening the code in the Arduino IDE.
Here’s a link to download the VanPowerInformation code.
The code is fairly simple and follows the standard Arduino sketch format. I will run through the simple things briefly and go into a bit more detail on the lines which do calculations to be displayed on the screen.
The first portion, lines 7 to 21 simply create the variables used in the code, assigns values (mostly pin numbers) and sets up the LCD pin arrangement. The battCapacity variable will need to be adjusted to suite your setup as this is the usable capacity of your battery. For example, if you have a 130 amp hour battery and you want to be able to discharge it to 20% then you have 104 amp hours of usable capacity.
The setup loop is run once when the Arduino is powered up and defines the pin modes as well as starts up the LCD communication time keeping millis function.
The loop function is then run continuously and does the calculations and updates the LCD each cycle.
The code first takes voltage and current measurements from the battery circuit and then from the solar circuit. In both cases the code is similar. The battery voltage measurement (line 41) takes a reading from the analogue pin and then scales the 0-1023 input to a 0-15V reading as this is the output our voltage divider provides.
The battery current measurement (line 42) takes a reading from the analogue pin, removes half of the scale because the current sensor reads 2.5V for zero current. and then scales the 0-511 input to a 0-30A reading as measured by the sensor.
The same two lines are repeated for the solar circuit with a scaling of 0-20V for the solar voltage measurement.
Power is then calculated for each circuit as the product of voltage and current.
The code then checks to see if the battery is charging, if the battery voltage is running low and if the battery voltage is critically low and switches the LEDs and alarm on or off accordingly.
The battery life remaining as a percentage is then calculated. Again, these values can be adjusted depending on the type of battery you are using. You may not want to discharge it below a certain voltage.
Energy used by the battery and supplied by the solar panels are then calculated as a product of the power being drawn and supplied and the time elapsed since the last measurement.
The Display Screens
Once the calculations are done, the LCD is updated by cycling through three different displays. The first displays the battery status and shows the battery voltage, current being drawn, power being used and finally the kilowatt hours consumed since start up.
The second screen displays the battery life remaining as a percentage and then in terms of time in hours remaining at the current power consumption. This information is only displayed if the battery is not being charged. If the battery is being charged then obviously the time remaining won’t be realistic and the capacity calculation will be incorrect due to the inflated voltage measurement. In this case, battery charging is displayed instead.
The last screen to be shown is the solar information. This screen displays the solar panel output voltage, the current being supplied and the resulting power output from the panel as well as the total energy which has been produced by the panel since startup.
Additions to the Circuit & Display
There are a couple of free inputs and outputs on the Arduino Uno which can be used to monitor a few other parameters. For example, as mentioned in the opening steps, you could separate your current measurement to your lighting, 12V DC and 100V/220V AC circuits and then create three separate displays on the LCD screen to give you information on your usage from all three.
You could also add some relay functionality to the outputs of the Arduino to cut off loads if the battery voltage becomes too low or turn off the solar panel when the batteries are fully charged etc.
If you’d like to take this Instructable one step further, you could also try building your own solar panels for your Van or RV. they are really easy to build and cost much less than the commercially available ones.
Let me know if you have any comments or suggestions below and enjoy building your own power information system.
If you like this Instructable, please vote for it in the Van Life contest by clicking on the Vote button on the top right of this guide.