Introduction: Car Battery Charger Adapter

This instructable is for a car battery charger adapter designed to be used together with an old laptop battery power brick. It uses a buck converter (XL4015) with adjustable voltage and current to perform the main conversion. An ATTiny (digispark) is used to monitor the operation, drive a small OLED display, and switch between a Hi / Lo charging mode.

Features

  • Constant current (Hi) charging mode switching to Constant voltage as battery charges up.
  • 3A charging (can be adjusted up to 5A)
  • Display shows battery voltage, charging current and accumulated charge (Amp-Hours)
  • In-built fan for assistance with heat dissipation
  • Protection against back polarity if connected to battery in unpowered state

Supplies

  1. Old laptop power brick. I used a Dell 19V 4.5A but any with voltage > 15V will work.
  2. XL4015 5A buck converter with adjustable voltage and current limit circuitry
  3. ATTiny Digispark board
  4. SSD1306 0.96" OLED display I2C interface
  5. 2 Schottky 5a diodes (SS54)
  6. 40mm, 10mm thick fan 12V
  7. Resistors 47R, 470R, 2k2, 3K6,, 10K
  8. Hook up wire
  9. Enclosure - 3D printed model at https://www.thingiverse.com/thing:4869987

Step 1: Design

The schematic shows the design of the adapter.

Most of the work is done by the XL4015 buck converter which is a step down converter capable of down converting up to 36V inputs down to 1.25V upwards with a current capability of 5 amps. The version of the converter I use here has two adjustments.

The first adjustment sets the output voltage with the internal 10K potentiometer / 270R network which gives a feedback into the converter where the junction settles around the reference 1.25V of the converter.

The second adjustment sets the current limit. The voltage drop across the 50milliOhm shunt resistor is compared against an adjustable voltage and used to turn off the buck converter.

The voltage adjustment network can be exploited to switch in an additional resistance in parallel with the 270R which will boost the output voltage. The 3k6 resistor used here will add about 1 volt extra to the output when switched in.

The current shunt resistor also provides a convenient way to monitor the charging current.

I added a pair of schottky diodes in line with the output to provide polarity protection. Each diode is capable of 5A load but I used two in parallel to minimise voltage drop and ensure good heat dissipation.

The rest of the circuit is the ATTiny digispark board used as a monitor / controller. Two GPIO are used to drive the OLED SSD1306 display. Two GPIO are used in ADC mode to monitor the output voltage and the charging current. One GPIO is used to switch the voltage boost control. When it is set to input then the voltage is normal. When it is set to low output then the 3K6 activates to boost the voltage.

The output voltage is used to power a 12V cooling fan and as input to the voltage regulator on the digispark. A small series resistor drops a couple of volts to lower fan speed and reduce dissipation in the voltage regulator.

Step 2: Construction

The adapter was built into a custom 3D printed box.

It is wise first of all to temporarily wire the converter to the laptop power supply and set the voltage adjustment to around 14V output. The current adjustment can also be set low to start with.

The reverse of the buck converter provides three convenient points to pick up the signals required by the monitoring circuit; 0V , boost control, and current measure. Solder 3 wires onto these points.

The 2 power zener diodes were mounted on a small piece of stripboard and wired into the +O/P of the converter.

Solder wires onto the display and glue into box with display lined up with the hole.

Mount the fan with 4 screws and bolts.

Bring laptop lead and output wires into the box with stripped ends suitable for the terminal connectors.

I connected the 10K/470R,2k2, and 3k6 resistors onto the digispark board itself.

Complete the rest of the hook up and use a piece of double side tape to secure the digispark board to the size of the enclosure. Note that you may want to program and calibrate the digispark board before installing although it is possible to update the firmware in place.

Step 3: Firmware and Calibration

The firmware for the ATTiny is available at https://github.com/roberttidey/BatteryChargerAdapter

Two libraries (SSD1306BB and I2CTinyBB) are used to drive the display. These are also available at that github.

This can be compiled and uploaded in the Arduino IDE with digispark support added.

3 #defines are available to fine tune the monitoring of voltage and current. The measurements are against the internal nominal 1.1V reference of the ATTiny but this can vary from device to device.

#define CONV_VOLTS is used to tweak the voltage monitoring
#define CONV_AMPS is used to tweak the current monitoring

#define AMPS_ZERO is used to tweak any zero offset error on the ADC. This is useful as the voltage being measured is quite low.

You can adjust CONV_VOLTS by feeding in 12V to the 10K / 470R divider and then checking the display. If it is not close to 12.00V then adjust the value by the inverse ratio of the displayed voltage to 12.00. Adjust the CONV_AMPS by the same ratio.

You can adjust the AMPS_ZERO by grounding the current monitor pin. If the current display is not zero adjust the value by about 1/50 of the amps shown. E.g. if it shows 150mA then use a value of 3.

Final calibration of the adapter should take place when it is all hooked up. Adjust the buck converter voltage adjust to give 13.6V output (after the schottky diodes with no load. Adjust the buck converter current adjust to give the desired maximum charge current with a low or zero load. I use about 3A. If using a higher current then the converter may get hot but will shutdown and protect itself if this happens.