CMOS Battery Tester V2
Hello there and welcome to my Instructable! In this Instructable, I'll be showing you how to make a DIY CMOS battery tester for use when working with computers that use the CR2032 coin cell batteries to store BIOS settings. Let's get started. Watch the YouTube video I made on this here: Revisiting my Custom CMOS Battery Tester This Time Making it Open Source! - YouTube
Supplies
All links are NON-affiliate links.
2.54MM Female Headers (for Arduino)
Order the PCB for this project at PCBWay here
Also check out PCBWay's 3D printing services if you don't have a 3D printer at home so that you can make the battery holder piece!
Solder All Components to the Board EXCEPT the Two Resistors
Go ahead and solder all of the components to the board, following the schematic as necessary. Though, it's highly important to NOT solder the two resistors that form the voltage divider to the board yet! There is something that needs to be done to those resistors before they can be soldered to the board.
Measure the Exact Value of the Resistors You Chose
Next, you need to measure the exact value of the resistors that you chose for this board with a multimeter. All resistors have a tolerance, which defines how far off of their advertised value they're allowed to be. The 1.5K and 3K ohm resistors that you picked out of your resistor stock are almost certainly not exactly 1500 ohms and 3000 ohms respectively. They're going to have some error, and that error will mess up the battery tester's voltage reading if we don't account for it. Grab a multimeter and measure the resistance of the two resistors you're going to be soldering to the board. Write these values down, and then solder the 1.5K resistor into R1's place and the 3K resistor into R2's place.
Enter Your Voltage Divider Conversion Value Into the Code
Next, now that you have your resistor values, you need to run them through the part of the equation in the picture attached that's in the denominator of the rational expression. Basically, run your resistor values through the equation "R2 / (R1 + R2)". Take the result from this equation and paste it into the code I've provided where there's a comment telling you to change "ENTERVALUE" into the value this equation gave you. Keep as many decimal points in this value as possible (its likely there will be a lot of points - it's almost never a pretty number) but I don't recommend going to more than 15 decimal places.
Note: When performing the equation, the units that you keep the resistor values in don't matter as long as they're consistent. You can keep your resistor values in Kilohms or convert them to ohms. If you keep them in Kilohms, just make sure to keep as many decimals in the resistor values as your multimeter gives you.
Downloads
Find Your OLED Screen's I2C Address
Depending on the OLED screen that you receive, it's I2C address might be different than the address of the ones that I use. If this is the case, the screen won't work until you change the address in the code. This isn't a challenging thing to do, just copy the code from This Webpage and upload it to your Arduino board. When the Arduino is connected to your computer, I highly recommend fully disconnecting the 9V battery clip from the battery to avoid any chance of damaging your USB port by back feeding voltage into it. Once the code is uploaded, open the serial monitor while leaving the Arduino connected to your system and you should see the address of your I2C screen being sent by the Arduino. With this information, find the comment in my program (it's close to the top) where I point out the screen's address so you can change it and get your display working.
Finalize the Project!
Now you're pretty much done! The only thing left to do is to upload the final version of your code to the Arduino - that is, the version of the code with your specific voltage divider conversion value and your specific screen's address punched in - and plug the Arduino into the board! If you choose to make the 3D printed 9V battery holder so that the 9V holds on to the back of the board securely and is still easily replaceable, go ahead and hot glue it onto the back of the board.
Now you're done! At this point, you should have a fully functional CMOS battery tester that you can use to test the CMOS batteries of all computers you work on. One final word of caution: don't leave a CMOS battery in the tester for a long period of time, as even though the load it places on the battery is very light, it can and will drain it over time, so just make sure to remove it once you've tested it. Cheers!