Make Yourself a Portable Power Station for Outdoor Camping (5Ah)
by Nirubxn in Circuits > Arduino
33512 Views, 173 Favorites, 0 Comments
Make Yourself a Portable Power Station for Outdoor Camping (5Ah)
Hi, I am Niruban Chakaravarthy, a 14 year old, 9th grade student. In this instructable, I'm going to show you my journey of how I have built a portable power station that is very handy when you are in need of an electrical outlet when you are outside, for example camping. To, for example, charge your phone or just simply have some light during the dark.
This build was started on the 1st of August with the idea of building a very portable, light and cheap power station. There were many challenges that I faced but I've eventually addressed most of them.
I have made everything at a very low cost (compared to commercial portable power stations) and very small without any compromise to safety or its longevity.
Supplies
Here are the things I used in making this portable power station.
1) Arduino nano - For the brain/control centre of the system.
2)SSD1306 OLED display - Yes, this power station is going to have a display in order to display various informations.
3)MP1584 buck converter - For stepping down the 11.2v~13.0v to a stable 5v for the arduino and its peripherals.
The reason why I chose this over the LM2596 module is that firstly, its small, and secondly, this draws way less current compared to the LM2596. It is important as we are using a battery pack, so it is necessary to save the energy wherever possible.
4)ACS712-30A - In order to measure the current flowing in and out of the battery pack and protect it whenever necessary.
5)12v 10A relay - In order to turn on/off the system's output.
6)Voltage sensing module - In order to measure the voltage of the battery pack in order to prevent it from over-discharging.
7)12v inverter - In order to save costs, I have used a square wave inverter, though it can't power inductive loads like a fan or a motor, it still can be used to charge our phones, laptops and other gadgets.
8)32700 3.2v LFP cells - These provide power to our entire system. I have used 4 of them to get a voltage of 12.8v.
These have a rated capacity of 7.8aH, but according to my testing, it came up as 5.2ish Ah at 1C. Even though the capacity is low, its still can charge a phone with for reference, a 5000mAH battery three times from 0 to 100% (calculated with efficiency of ~86%), which can be really handy, Or to power a light? No problem. An 8w light can easily last more than 6 hours. We could add more in parallel but I have made sure to make the cost as low as possible and yet to make it functional. And also, we ain't gonna run a house with one of these..
9)A C3866 BJT with 330 ohm resistor - A BJT (Bipolar Junction Transistor) in order to control the relay.
10)12v to USB charger/converter - In order to charge the phones if we don't have the wall adapter.
11)A small heatsink - In order to cool the USB charger/converter.
12)Thermal paste - In order to conduct the heat from the charger module.
13)4S LFP 6A BMS board - In order to ensure that our cells don't get damaged by any means. With this, we can get up to ~75w of power at maximum, which is more than enough.
14)Switches - To, obviously, turn on/off things.
15)Perf Board - In order to make the main board
16)Connectors - In order to use various devices that require 12v and to charge the battery pack, I have used an XT60 connector.
17)Enclosure - I have went with this plastic project enclosure. You can also, custom 3D print yours :).
18)An electronics work bench - A place that has all the tools and equipment required for building this portable power station.
*Some of the above mentioned components were soldered to the perf board, so some images were not possible. So, bear with me..
MainBoard
This mainboard is designed solely by me. The schematic is attached, its not that difficult to make it after you understand the pins and their destinations.
The code is also attached below.
(*If you don't want to download the code, the code is in the text form at the end)
Downloads
Code
*You may skip to the next step.
Let me explain the code.
This code was a weird one. It was all a hit and trial until finally, everything worked.
Firstly, we turn on the switch, which turns on the Arduino nano. Now, the Nano checks if the voltage is correct or if the battery is low. Then, there is a 1.5 second delay, after which, the relay is turned on. This relay is the one responsible on enabling the inverter, USB port and the 12v direct terminal. If the voltage is below 11.0v, the relay will turn off and the system will shut down with a message of "Low battery" on the screen. The system will only turn on if the voltage is above 11.2v. If we try to draw more than 12A (12A because the sensor we are using has errors. So, sometimes, even at 6A load, the sensor reads it as 10A and trips the output) of current, the relay will turn off and our system will shut down.
Even if our system fails to protect the battery, our BMS will, making the system very safe.
At normal operation, the display shows the battery percentage, the voltage and the current.
Also, when the battery is charging, the battery icon shows that its charging.
I have tested the circuit and it works flawlessly. Making sure the battery is not low and making sure there is no overcurrent. One small error I noticed was that the sensor reads some ghost values. But, we cannot do much about it since its a hall effect sensor. Also, on the start-up, the board detects a non existent overcurrent which takes 2.5 seconds delay before start.
Battery Pack
First, I glued the four batteries in an alternative manner at the low temperature of my hot glue gun. Then I roughened the terminals of the batteries with a sand paper and added solder on the terminals.
It was the most difficult part, since the solder wouldn't want to stick to the terminal even with numerous tries and sanding. I also had to make sure I don't overheat the batteries, even with those challenges however, I completed the battery pack
.
When testing, I found that one of the cells were faulty and had a very high internal resistance. So, I had no other option but to buy another one of the same kind. It took more than a week as it was out of stock in the store. But after finally getting my hands on one, I tested and it worked well.
I also quickly tested the cells without the BMS (since, it wasn't arrived yet), and guess what? They were able to provide 8A peak. Making it suitable for my build.
After making sure they were in their best shape once again, I had to wait for the BMS board to arrive...
On 14th August, 2024, the BMS arrived. Though the listing mentioned "32700", 12.8v (3.2v * 4) and 4S, it was an 18650, 3.7v, 4S BMS. So, I was forced to return it and order a new one.
Its very frustrating that this happened. But, I wasn't able to do much about this than to wait..
USB Charger
As you can see, I have added thermal paste and glued/taped the board to the heatsink. I have used tape in order to hold it in position. I tested this with my phone and it draws 700mA from 12v. Which translates to nearly 1.5A at 5V (calculated with 10% loss). Which means, this board is capable of fast charging.
The maximum this board can provide is 3 Amps at 5V. Which is 15W. Even though it doesn't sound like much, its still plenty in an emergency.
Enclosure
In order to house all of this, I have bought this ABS plastic one. I had to make plenty of cut-outs and holes for the connectors, display and switches. But finally, it looked decent. Look, I am not a professional cutter, so, I was only able to make something that looked decent rather than a perfect one.
Parts Arrived!
August 21st, 2024. this is the day I have been waiting for long. Everything arrived, it felt like forever. I got my hands on all the required components. I added the BMS board to the battery. It works really well. The inverter is rated for 200w. Though, I wouldn't be surprised if it blows up at 200w. So, I wouldn't use the inverter at its full power. 40w, just 20% of its rated power, would be the best for the batteries, the inverter, less heat generated. Overall, the performance will be the greatest if everything runs under 40w.
Also, I didn't bother to use the USB ports not because I already added one to the system, but the USB ports do not have QC or any charging protocol. So, the device would be forced to charge at a painfully slow 500mA, which, according to our reference phone, takes 10 full hours to charge it from 0 to 100.
Regarding the BMS, it arrived on the 23rd of August, 2024. This was the only BMS I could find and was rated for 6A. Which is definitely enough for me.
Assembly
First, I added the switch in series to the main board so that, when the switch is turned on, the board can turn on the relay, turning on the system. Nothing special, everything as mentioned, goes into its spot. I had to make sure that neither the batteries nor their bms' terminals were exposed. I also added a 10A switch in series with the inverter and another one for the USB charger in order to save some power if we are not using both at the same time.
After that, I extended the USB ports with wires and secured the USB port, the OLED display, the switches to the front panel of the case.
I have made a 2 holes on the left side of the case for the XT60 connector. I mean, it looks weird, but trust me, some flexibility of the connector is really helpful. Especially, regarding the orientation.
I had to be careful not to connect the inverter in reverse. I then made a 4 pin jumper to connect the display and the main board. I also tried adding a powerful 15w LED light to the system, but unfortunately, the LED just didn't want to work with me, ordering it would take nearly a month (its getting too late). So, was not included in this build.
Charging the batteries was easy too, by setting my lab bench power supply to 14.4v and a constant current of 2A (0.4c in order to maximize the battery pack's life). If needed, I can fast charge it at 1c which is ~5A. And the best thing is that, charging can be done with just the 12v connector (XT60) since, it goes through the same relay, current sensor and then to the BMS. One more feature is that, when charging, the display shows that its charging to avoid confusion. The BMS would take care of balancing and preventing overcharges.
Finishing Touches
I then installed the enclosure's screws, double checked everything, and we are done. The inverter by itself, comes with an overload protection. So, there are now three layers of protection on our build, which is really good for this low budget.
After building, this portable power station, I have tested every feature of this. Including the overcurrent protection, overvoltage protection, its mains output, its USB output, the 12V outputs, charging. The system was cool even without a fan during testing.
Surprisingly, the inverter lasted 7 hours on powering an 8W light that can light up a whole room. So, I would say, this build is a success.
The video attached below, shows the inverter powering a 20w LED lamp without any problem
Wrap Up!
So, I have finally made this portable power station after a lot of challenges. This took like forever for me to make it. Now, you don't have to be worried about your phone dying or being in the dark. This has taken me a lot of efforts and time to make it.
I'm sorry if I bored you with a very long instructable.
Saying that, this is Niruban, signing off, and I will catch you with my next, interesting instructable.
Code_txt
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define VOLTAGE_PIN A0 // Pin for voltage divider
#define ACS712_PIN A1 // Pin for current sensor (ACS712)
#define RELAY_PIN 7 // Pin to control the relay
const float VREF = 5.0; // Reference voltage for ADC
const float R1 = 30000.0; // 30k ohm resistor
const float R2 = 7500.0; // 7.5k ohm resistor
const float MAX_VOLTAGE = 12.8; // Max voltage for 12.8V LiFePO4
const float UPPER_THRESHOLD = 11.2; // Voltage at which the relay turns on
const float LOWER_THRESHOLD = 11.0; // Voltage at which the relay turns off
const float OVERCURRENT = 12.0; // Overcurrent protection threshold in amps
const int BATTERY_EMPTY = 0; // Battery empty percentage
const int BATTERY_FULL = 100; // Battery full percentage
bool relayState = false; // Keep track of relay state
void setup() {
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, LOW); // Initially turn off the relay
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
// If SSD1306 doesn't initialize, stay here
for(;;);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
}
float readVoltage() {
int analogValue = analogRead(VOLTAGE_PIN);
float voltage = (analogValue * VREF / 1023.0) * ((R1 + R2) / R2);
return voltage;
}
float calculateBatteryPercentage(float voltage) {
if(voltage > MAX_VOLTAGE) return BATTERY_FULL;
if(voltage < LOWER_THRESHOLD) return BATTERY_EMPTY;
return (voltage - LOWER_THRESHOLD) / (MAX_VOLTAGE - LOWER_THRESHOLD) * 100.0;
}
float readCurrent() {
int analogValue = analogRead(ACS712_PIN);
float current = (analogValue - 512) * (VREF / 1023.0) / 0.066; // 66mV/A for ACS712-30A
return abs(current); // Always return positive current value
}
void drawBatteryIcon(int x, int y, int percentage, bool isCharging) {
display.drawRect(x, y, 24, 10, SSD1306_WHITE); // Battery outer rectangle
display.fillRect(x + 24, y + 2, 2, 6, SSD1306_WHITE); // Battery positive terminal
int fillWidth = map(percentage, 0, 100, 0, 22); // Map percentage to fill width
display.fillRect(x + 1, y + 1, fillWidth, 8, SSD1306_WHITE); // Fill based on percentage
if (isCharging) {
// Draw charging icon inside the battery
display.drawLine(x + 6, y + 2, x + 11, y + 2, SSD1306_BLACK);
display.drawLine(x + 11, y + 2, x + 8, y + 8, SSD1306_BLACK);
display.drawLine(x + 8, y + 8, x + 13, y + 8, SSD1306_BLACK);
}
}
void updateDisplay(float voltage, float batteryPercentage, float current, bool isOvercurrent, bool isLowBattery) {
display.clearDisplay();
// Display battery icon and percentage at the center
display.setTextSize(2); // Larger text for percentage
int batteryX = (SCREEN_WIDTH - 24) / 2;
display.setCursor((SCREEN_WIDTH - 40) / 2, 0);
display.print((int)batteryPercentage);
display.println("%");
drawBatteryIcon(batteryX, 18, (int)batteryPercentage, current < 0);
// Display voltage and current values with spacing and short labels
display.setTextSize(1);
display.setCursor(0, 38); // Start from a lower position
display.print("V: ");
display.print(voltage);
display.println(" V");
display.setCursor(0, 50); // Next row
display.print("I: ");
display.print(current);
display.println(" A");
// Handle warnings
if(isLowBattery) {
display.clearDisplay();
display.setTextSize(2);
display.setCursor(10, 25);
display.println("LOW BATTERY");
display.display();
delay(1500); // Wait for 1.5 seconds
display.clearDisplay();
} else if(isOvercurrent) {
display.clearDisplay();
display.setTextSize(2);
display.setCursor(10, 25);
display.println("OVERCURRENT");
display.display();
delay(1500); // Wait for 1.5 seconds
display.clearDisplay();
}
display.display();
}
void loop() {
float voltage = readVoltage();
float batteryPercentage = calculateBatteryPercentage(voltage);
float current = readCurrent();
bool isLowBattery = voltage < LOWER_THRESHOLD;
bool isOvercurrent = current > OVERCURRENT;
// Implement hysteresis for relay control with delay for stability
if (!relayState && voltage > UPPER_THRESHOLD) {
delay(1500); // 1.5-second delay to ensure voltage stability
if (voltage > UPPER_THRESHOLD) { // Check again after delay
relayState = true;
digitalWrite(RELAY_PIN, HIGH); // Turn on relay
}
} else if (relayState && voltage < LOWER_THRESHOLD) {
relayState = false;
digitalWrite(RELAY_PIN, LOW); // Turn off relay
}
if(isOvercurrent) {
digitalWrite(RELAY_PIN, LOW); // Turn off relay in case of overcurrent
relayState = false;
}
updateDisplay(voltage, batteryPercentage, current, isOvercurrent, isLowBattery);
delay(1000); // Delay for a second before next measurement
}
Edits:
Edit on 09.09.2024 : I have added the specifications to the title. And, the total cost of this build came to around 40$.