Introduction: Adaptive Smart Battery Charger TfCD

This Instructable is created for the course Technology for Concept Design (TfCD).

In this Instructable we create a so called smart battery charger. Theoretically a smart battery can work together with wind, solar or another form of sustainable energy source and store this energy at moments when the usage of power is lower than the collection. For example when the day is sunny and your solar panels are collecting energy, you might not use a lot of energy because you are at work. This stored power can have advantages over directly selling your excess energy to the grid since you will get less money from the energy you sell than it costs to later buy that energy back when your supply is low but your energy needs are higher. For example during the evening/night when there is no sun but you use energy at home.

For this Instructable we wanted to test the electronic circuit as well as the Arduino coding. An Arduino attached to a charging circuit can be used to monitor and control the charging of NiMH rechargeable batteries.

The capacity to store sustainable energy at home during peak times is quite a lot, for this test system we scaled it down to the capacity of 1 AA NiMH battery of 2600mAh.




Leander Hofman 1266276
Yorick Meijdam 133555

Step 1: Gathering Components

In order to build and test this circuit we used the following components:
*note* This will also work with different types of NiMH batteries *note*

1x Adruino board (for this a YUN is used, almost every Arduino is suitable)
1x Breadboard
8x Breadboard Jumper wire in various lengths
1x AA Battery Holder
1x AA NiMH Battery (2600 mAh)
1x 5V DC power source
1x Power MOSFET
1x 1 µF capacitor
1x 10 Ohm power Resistor
1x 1 MOhm power Resistor
1x old phone usb charging cable

The plug of the old phone charger is cut off and the charger has been used to have a 5V power output into the breadboard. Only the plus and minus wires are used of the phone cable.

Step 2: Electronic Circuit

Wire all components according to the schematic.

Step 3: Coding

In order for the smart charge battery to work we used the following code, more details can be found in the ino-file added to this step of the Instructable. The code has been set to safely charge a battery, meaning it will automatically stops the current flow once a certain voltage threshold has been reached. For later purposes, it's possible to add more variables and if-states. For example a time clock, battery health check and multiple battery management could be added to the code.

int batteryCapacity = 2000;
float resistance = 8.80;
int cutoffVoltage = 1600;
long cutoffTime = 288000;

int outputPin = 9;
int outputValue = 127;

int analogPinOne = 0;

float valueProbeOne = 0;
float voltageProbeOne = 0;

int analogPinTwo = 1;

float valueProbeTwo = 0;
float voltageProbeTwo = 0;

float voltageDifference = 0;
float batteryVoltage = 0;
float current = 0;
float targetCurrent = batteryCapacity / 10;
float currentError = 0;

void setup()

{

Serial.begin(9600);
pinMode(outputPin, OUTPUT);
}

void loop()

{

analogWrite(outputPin, outputValue);

Serial.print("Output: ");
Serial.println(outputValue);

valueProbeOne = analogRead(analogPinOne);
voltageProbeOne = (valueProbeOne*4400)/1023;
Serial.print("Voltage Probe One (mV): ");
Serial.println(voltageProbeOne);

valueProbeTwo = analogRead(analogPinTwo);
voltageProbeTwo = (valueProbeTwo*4400)/1023;
Serial.print("Voltage Probe Two (mV): ");
Serial.println(voltageProbeTwo);

batteryVoltage = 4400 - voltageProbeTwo;
Serial.print("Battery Voltage (mV): ");
Serial.println(batteryVoltage);

current = (voltageProbeTwo - voltageProbeOne) / resistance;
Serial.print("Target Current (mA): ");
Serial.println(targetCurrent);
Serial.print("Battery Current (mA): ");
Serial.println(current);

currentError = targetCurrent - current;
Serial.print("Current Error (mA): ");
Serial.println(currentError);

Serial.println();

if(abs(currentError) > 10)

{

outputValue = outputValue + currentError / 10;

if(outputValue < 1)

{
outputValue = 0;
}

if(outputValue > 254)

{
outputValue = 255;
}

analogWrite(outputPin, outputValue);

}

if(batteryVoltage > cutoffVoltage)

{
outputValue = 0;
Serial.println("Max Voltage Exceeded");
}

if(millis() > cutoffTime)

{
outputValue = 0;
Serial.println("Max Charge Time Exceeded");
}
Serial.println();
Serial.println();
delay(5000);

}

The code is added to this instructable.

Step 4: Testing the Prototype

In order to understand the coding and validate if the coding works, the essential data has been sent to the serial monitor.

As can be seen on the serial monitor the battery charges when there is an output, when the battery is almost full the output lowers towards 0 and then the charger will stop charging the battery.

Before and after charging a battery, a multimeter has been used to validate the values.

Step 5: Evaluation of the Prototype

Based on the circuit and the coding we made a smart battery charger that is feasible. The prototype that was build for this Instructable proves that you can control the conditions for charging or discharging a battery. This could be scalable for a whole house just by scaling the battery capacity.

When adding multiple batteries, the system benefits from having a smart controller. It can monitor those and separately control their charging states. While this still needs validation, it's assumed that the smart controller automatically can adapt to different voltages, capacities and battery health.