This project is for those that want to turn an old laptop into a portable Raspberry Pi. My previous Hackster.io projects showed how to connect the keyboard and touchpad. The LCD is easy to convert to HDMI with a video card from eBay as documented here. The missing piece has been a way to charge the original lithium battery pack made with 3 or 4 series wired cells. These batteries are not compatible with the chargers offered by Adafruit and Sparkfun. To solve this problem, I designed a circuit board in Eagle that uses a Max1873 charge controller with an ATtiny85 as a supervisor. The board shown below was fabricated by OSH Park. The Eagle board and schematic files plus the ATtiny code can be downloaded below.
The Max1873 has been around a long time and needs a microcontroller to handle the tasks that a newer charger IC would have, built in. I have prior experience with this chip and found it fairly easy to get working. Besides charging lithium batteries, the Max1873 can also charge NiCd or NiMH batteries. The schematic below shows how the ATtiny85 is powered from the 5.4 volt regulator in the Max1873. This means the ATtiny is only operating if the wall supply is plugged in. The ATtiny outputs a logic signal that turns on an NFET which in turn disables the Max1873. This 5.4 volt logic signal is attenuated to a 3.3 volt level so it can be monitored by the Pi. If the ATtiny is not installed in it's socket, the Max1873 will be enabled. The Pi could drive the "Charger_TP" signal to disable the charger if the battery values read over the SMBus show it's necessary.
The R, S, or T version of the Max1873 is used based on the number of series cells in the battery pack, referred to as 2S, 3S, or 4S. There may also be 2 or 3 cells in parallel, referred to as 2P or 3P but that doesn't effect the voltage. My Dell D630 battery pack is a 3S2P configuration, marked as 11.1 volts and 58 watt hours.
The voltage printed on the battery pack is usually the nominal value but sometimes it is the maximum so be careful. For a pack with 3 series cells, the nominal voltage will be 11.1 volts or 10.8 volts depending on their definition of "nominal". 4 series cells will have a nominal voltage of 14.4 volts or 14.8 volts.
Adafruit and Battery University have voltage information for several types of lithium batteries. Adafruit says that older lithium batteries are rated at 4.1 volts maximum and 3.6 volts nominal but the more common lithium battery is rated at 4.2 volts maximum and 3.7 volts nominal. Battery University says that common lithium batteries are rated at 4.2 volts maximum and 3.6 volts nominal but many manufacturers claim 3.7 volts nominal in order to get a higher watt-hour rating. There are newer lithium batteries with a maximum rating of 4.35 volts. The Max1873 can work with all of these batteries by setting the maximum cell voltage using resistors R5 and R6 (see schematic below). Resistor values for the most common cell voltages are:
4.1 volt maximum cell voltage: R5 = 54.9KΩ and R6 = 147KΩ.
4.2 volt maximum cell voltage: R5 = 100KΩ and R6 = 100KΩ.
4.35 volt maximum cell voltage: R5 = 169KΩ and R6 = 32.4KΩ.
If you are not sure what your maximum cell voltage is, use the 4.1 volt resistor values just to be safe.
The 19 VDC input is passed thru a 5 amp slow blow fuse and Schottky blocking diode. R9 sets the input current limit at 3 amps. The Max1873 will reduce the battery charge current to keep the input current under 3 amps. R1 sets the battery charge current limit at 1 amp. The plot below shows charging the battery from empty to full. The constant current phase keeps the charge current at 1 amp followed by the constant voltage phase when the current drops. The current will continue to drop until it reaches "trickle charge" levels.
Battery University says "A continuous trickle charge would cause plating of metallic lithium and compromise safety." To solve this, the ATtiny monitors the charge current and disables the charger at a specific value. The Max1873 outputs a voltage on pin 7 that is proportional to the charge current. At 1 amp charge current, pin 7 outputs 4 volts which is attenuated to 1 volt and fed into the ATtiny's ADC as shown in the schematic below. The 1.1 volt internal ADC reference is selected in the ATtiny code. When the charge current drops below 350ma, the ATtiny code disables the Max1873 to avoid trickle charging. The Dell D630 battery reports 100% state of charge (SOC) over the SMBus when the charge current falls below 350ma. I have tested other battery packs that required the charge current to go under 100ma before claiming 100% SOC. Experimentation may be required for your specific battery. Reaching 100% SOC is not necessary, plus if you terminate charging early, It will prolong your battery life. The value that will terminate charging is easily adjustable in the ATtiny code.
Many laptop batteries have an internal 10KΩ NTC thermistor so the motherboard can measure the temperature. The Dell D630 battery did not have a thermistor pin so I added a thermistor in the battery compartment and wired it as shown below.
The temperature vs resistance test results for thermistor 490-7171-ND are shown below. If the change in temperature from initial power up increases more than 10 degrees, the ATtiny85 code disables the Max1873.
The battery voltage is attenuated by 1/17th so it can be fed into the ADC input of the ATtiny as shown below. This attenuation will drop the 16.8 volts from a 4S battery down under 1 volt so it can be read by the ADC in the ATtiny.
The ATtiny code could be modified to watch for an overvoltage condition but it would be difficult due to the low resolution of the ADC and the noisy environment causing false alarms. My code monitors this voltage to see if the battery is below 0% SOC. If the battery voltage is below 9 volts for a 3 series pack, or below 12 volts for a 4 series pack, the Max1873 is enabled to charge the battery at 1 amp for a short duration every 2 seconds to slowly pre-charge the battery in a PWM fashion. The "on" time grows longer as the voltage increases. Other charge controller IC's offer a reduced charge current to pre-charge a severely depleted battery but this is not possible with the Max1873.
The ATtiny keeps track of the charge time and disables battery charging after 300 minutes. This value should be changed once you know how long it normally takes to charge your pack. My Dell D630 battery takes 230 minutes to charge from empty to full.
I've made 3 versions of the Max1873 Charger board, improving various design items as I learn more. I increased the width of the board traces that handle high current. I wanted the 1oz copper trace widths to handle at least 3 amps with no more than a 10ºC rise in temperature. The IPC-2152 nomograph shows that I need at least 4mm wide traces. The smallest power traces on my board are over 5mm wide.
I used a schottky diode in earlier versions of the design to "Or-Tie" the battery to the load. The 0.4 volt drop from the diode has been eliminated in the latest board design by using an "Ideal Diode". This consists of a P channel FET controlled by an LTC4412 as shown below.
Per the datasheet, battery capacitor C22 should have an ESR under 1Ω and a value of 68µF when using the Max1873R. It can be reduced to 47µF for the Max1873S or to 33µF for the Max1873T. I've used the Kemet 68µF capacitor given in the parts list with both the Max1873R and S chips. It has an ESR under 200mΩ.
A reflow oven or hot air rework station works best but if you can handle a soldering iron, you can assemble this board. I hand soldered the first board and used my DIY reflow oven for the second with solder paste applied by syringe. For the third board, I used the stencil shown below to apply the paste. This gave the best results with zero rework needed.
The digital latch for turning the 5 volt Raspberry Pi and 10 volt Video Converter regulators on and off is on the Max1873 board. A 74HC132A Schmidt trigger quad NAND is wired as an SR latch to control the enable pins on the 5 and 10 volt buck regulators. The set and reset inputs to the latch are active low. Pushing the "On" button on the keyboard sends a low to the "Set" input of the latch. The "Q" output is latched high and buffered with an inverter to drive the buck regulator enable pins low. When the Teensy receives a shut down signal from the Pi, it drives the "Reset" input of the latch low (thru an inverter), causing the enable signal to the buck regulators to go high. The Pi could be wired directly to the latch but I put the Teensy in the middle so it can shut down the laptop even if the Pi is locked up. The Teensy can also provide a delay before turning off power, if necessary. The latch circuit must operate when the laptop is off so it is powered by a separate 3.3 volt linear regulator fed by the battery or 19 volt input. With the laptop turned off, the battery load includes the quiescent current for the 3.3 volt regulator, Max1873, quad NAND, LTC4412, plus the voltage divider for the ATtiny85 battery monitor. These loads draw 310ua worst case (285ua measured). Compare this with the internal self-discharge of the battery pack (2% per month) plus the protection circuit (3% per month) which draw about 363ua. All together, a fully charged 58 watt hour battery would be depleted in 324 days if the laptop is not plugged in.
The test procedure for the Max1873 battery charger board is available at my Github repo.
For additional information on SMBus communication, battery fuel gauge display, and general laptop repurposing, visit my Instructable titled "Battery Powered Raspberry Pi in Repurposed Laptop" and video.
I hope you find this Hackster project useful for making a portable Raspberry Pi laptop. I will make updates as I learn more and invite you to add questions, comments, or corrections below.
I have designed a second laptop battery charger board (see below) that uses an MP26123 or MP26124 and doesn't need an ATtiny microcontroller. The details are given in my Hackaday.IO project.
Cheers
Comments