Last winter I experienced some problems with my car battery. I knew that it was about time to replace it so off I went to buy a new one. This fact reminded me of an old article about a car battery/charging system diagnostics kit I had seen in one of those 1980s electronics magazines.

That magazine’s battery monitor relied on an IC that had several analog comparators arranged in a way similar to the ones in the old LM3914. This made me think about designing a more up to date battery monitor with today’s microcontrollers in mind which could use a low LED/resistor count and a reduced PCB size and possibly fit inside an empty 1oz Tic-Tac box.

I had originally envisioned building this battery monitor around Microchip’s PIC12F675. However, after reading several instructables on microcontrollers I realized that everybody seemed to prefer Arduino. I concluded that it was about time to get my feet wet in this family of microcontrollers.

After reading this instructable, I also realized it was possible to use Arduino and get a controller with the size needed for this project.

I hope you enjoy it as much as I did putting it all together.

Step 1: Theory of Operation

The operation of this battery monitor relies on what the battery as a voltage source "sees" as a load. Using basic electric circuit theory we have:

Vbatt = Vd + (R1 + R2)•I ……………………….(1)

Vadc = R2•I ……………………………………...(2)

Vbatt = Battery voltage
    Vd = Silicon diode forward voltage drop
Vadc = Voltage that goes to ATtiny 13’s Analog to Digital Converter
       I = current
R1 and R2 are the resistors used in the voltage divider.

From (2):

I = ---------

Substituting in (1)

Vbatt = Vd + (R1 + R2) ------------

Vadc = (Vbatt –Vd) ----------------- …………..……(3)
                                ( R1 + R2 )

Which is the formula used to calculate voltage seen by ADC.

Step 2: Schematic

Battery voltage gets into the battery monitor through connector J1. Diode D1 is used to protect the entire circuit against accidental battery polarity reversal in case you decide to test the battery directly across its terminals in the engine compartment. Should you connect the test alligator clips reversed, nothing will happen.

IC2 is a +5V low dropout voltage regulator. Its input voltage range –with a 100mA load- varies between 5.4V up to its absolute maximum of 30V. I admit that for this battery monitor a 78L05 +5V voltage regulator would have been more than enough, however, I had no 78L05s and several LP2950CZA-5.0 kicking around in my junk box.  Capacitors C1 and C2 (22uF and 1uF) are voltage regulator’s input and output filters. If you want to use pin-compatible 78L05 voltage regulator instead, use a 10uF capacitor as C2.

The battery voltage feeds both, the voltage regulator and the ADC input circuit to ATtiny through a voltage divider formed by a 10K resistor and a 3.3K resistor marked as R1 and R2 respectively. This voltage divider is used to reduce battery voltage to a safe input voltage range between 0V and +5V for ATtiny’s analog input. This voltage divider allows a maximum car battery voltage of 20.8V for this input voltage range. In order to smooth out this analog input voltage, a 10uF (C3) is used to reduce noise.

The visual output to the user is shown by means of three LEDs. A Red LED (LED3) shows either too low a voltage or a dangerous overvoltage. A Yellow LED (LED2) shows a moderate low voltage and the green LED (LED1) shows good voltage and safe charging voltage. Each LED comes with its respective current limiter 330 Ohm resistors, R3, R4 and R5. Resistors R6 and R7 at 10K each are pull up resistors for unused inputs.

Step 3: Software

The software was written based on the hints given by Eric-the-car-guy in this excellent video. He didn't mention the voltage at which a battery can be considered bad. However, my own car's service manual stated that while cranking the engine, voltage should not get lower than 9.6V. If it does, then battery should be replaced which seems to be about right for most car batteries.
This sketch is very simple, just a series of consecutive IF instructions to compare voltage read through ADC3 with some predefined values. If you follow the code closely, you’ll see that the values shown in the Theory of Operation slide show in Step 1 are the same values used in the different IF instructions to decide which LED should come on. 

To create the blinking effect on LEDs whenever voltages are higher than 13.1V, a counter is increased by one on every pass through that portion of the code. Before the code loops back to read ADC3 again, execution is delayed 100 milliseconds. IF instructions turn LEDs on whenever the pass counter is below 6 and turn LEDs off whenever counter is between 6 and 11. Once counter reaches 11, the counter is reset to zero to repeat the cycle.
ADC3 input is used to read the analog voltage coming from the voltage divider. By the way, ADC0 had been the first choice as this project’s analog input, however, when voltage coming from the battery was a bit lower than 8.7V all three LEDs would go out.  This didn’t seem right as I had used a low-dropout voltage regulator. After doing some more research on the web I found that anytime you used a pin as an input  that could also function as hardware Reset, these things could happen. Once ADC3 was selected as analog input, battery voltage could come down close to 6V and red LED would still be on which means the software would still be running. It was then that in order to prevent further problems, unused pins 1 and 5 were pulled up to +5V through 10K resistors.

                         ATtiny 13 code:

// This sketch monitors battery voltage and turns on an LED based on it.
// Processor: ATtiny 13.
// Author: rlarios
// Date: 13.04.03
int rLED = 4;                                    //Red LED pin
int yLED = 1;                                   //Yellow LED pin
int gLED = 2;                                   //Green LED pin
int val = 0;                                        //This variable will hold voltage input value
int dlyctr = 0;                                    //This is the delay counter.
void setup(){
pinMode(rLED, OUTPUT);               //Define Red LED output
pinMode(yLED, OUTPUT);              //ditto Yellow LED
pinMode(gLED, OUTPUT);              //ditto Green LED
void loop(){
val = analogRead(A3);                      //Read voltage through Analog input 3
   if(val<452){                                     //Is battery voltage below 9.6V?
   digitalWrite(rLED, HIGH);               //Yes, this is bad, turn on Red LED
   digitalWrite(yLED, LOW);               //Turn off Yellow LED
   digitalWrite(gLED, LOW);               //Turn off Green LED
      if(val<594){                                   //Is battery voltage between 9.6V and 12.4V?
      digitalWrite(rLED, LOW);             //This is a low voltage, turn off red LED
      digitalWrite(yLED, HIGH);            //Turn on Yelow LED as a warning.
      digitalWrite(gLED, LOW);            //Turn off Green LED
      if(val<629){                                    //Is battery voltage between 12.4V and 13.1V while idle?
         digitalWrite(rLED, LOW);            //Yes, turn off Red LED
         digitalWrite(yLED, LOW);           //Turn off Yellow LED
         digitalWrite(gLED, HIGH);          //Turn on Green LED to indicate fully charged battery voltage.
         dlyctr = dlyctr + 1;                       //increase delay counter. every pass approx. 100ms
         if(val<751){                                 //Is battery voltage above 13.1V and below 15.5V?
            digitalWrite(rLED, LOW);         //Turn off red LED
            digitalWrite(yLED, LOW);        //Turn off yellow LED
               digitalWrite(gLED, HIGH);    //Pulse green LED on for half a second
               digitalWrite(gLED, LOW);     //Pulse green LED off for half a second to show battery is      charging.
                  dlyctr=0;                            //Reset delay counter
            else                                         //Battery voltage is above 15.5V.Danger ! Overcharge
            digitalWrite(yLED, LOW);        //Turn off Yellow LED
            digitalWrite(gLED, LOW);        //Turn off Green LED
               digitalWrite(rLED, HIGH);     //Turn on Red LED for half a second.
               digitalWrite(rLED, LOW);      //Turn off Red LED for half a second.
                  dlyctr=0;                            //Reset delay counter
            delay(100);                             //Stop program 100 milliseconds to help pulse LEDs.

Step 4: Programming ATtiny 13

You'll have to wire Arduino UNO and ATtiny 13 as shown in one of the images in this step. Make sure ATtiny 13 pin 1 is properly oriented. Once wiring is ready, you'll have to load Arduino IDE in your laptop computer and configure it so it can be used as a programmer. 
I won’t get into the details here about configuring Arduino UNO as ISP and where to get ATtiny 13's libraries. After some research I found this excellent video by Chris Stubbs on how to do just that. The video also shows how to wire Arduino UNO and ATtiny 13 together.

After Arduino UNO is configured to function as ISP, and ATtiny 13 libraries have been  loaded, it is time to select our target "board". From Arduino IDE menu bar click on Tools>board> ATtiny 13 @9.6MHz (internal 9.6MHz clock). Next, type in the battery monitor sketch into Arduino IDE and proceed to compile it and upload it into ATtiny 13. The selection of ATtiny 13 with a 9.6MHz clock will cause the blinking rate of LEDs to have a period of about 1.4 seconds. This means, LED will be on 0.7 seconds and off 0.7 seconds which is close to what I originally intended.

We will put our Car Battery monitor together in the following steps.

Step 5: Bill of Materials

The printed circuit board Eagle files are attached to this step. I used the toner transfer method to make the one shown. A couple of traces didn't come out right so I tinned them for better appearance and to ensure continuity.

Make sure the resistors you are going to use for the voltage divider, R1 (10K) and R2 (3.3K), are as close as possible to rated values. All the resistors used here are 5% so make sure they are within this tolerance. The resistors I used as R1 and R2 measured 10.001K and 3.245K respectively.

This project is also available as a kit from Club Jameco.

3          10K 1/4W resistor 5%  
1          3.3K 1/4W resistor 5% 
3          330 Ohm 1/4W resistor 5%
1          22uF 50V Electrolytic 20%
1          1uF 25V Electrolytic 20%
1          10uF 16V Electrolytic 20%
1          1N4004 400PRV 1A
1          Green LED 5mm
1          Yellow LED 5mm
1          Red LED 5mm
1          LP2950CZ-5.0 Low Dropout Voltage regulator +5V               Jameco P/N:266757
1          MCU ATMEL 8-bit ATtiny 13


1          Socket IC 8 pin
1          Jack DC Power Male 2.1 mm                                                 Jameco P/N:101178
1          Printed Circuit Board.


Soldering iron
Clip-on heatsink
Needle nose pliers
Wire stripper

Additional material:

1          Automobile Fused Power Plugs with cord                              Jameco P/N: 124760
2          Connector Power PL 2 Position straight cable mount            Jameco P/N: 191484
1          ft 22AWG red wire
1          ft 22AWG black wire
1          In-Line Fuse holder for 1-1/4" x 1/4" standard fuse                Jameco P/N: 102868
1          0.5A fuse       1-1/4" x 1/4" standard                                       Jameco P/N: 10410
1          Pair Alligator clips, one red, one black.                                  Jameco P/N: 70991
1          1 oz tic-tac empty box.

Step 6: Assembly

As usual, solder in first the passive components such as resistors and capacitors. Then, solder in protection diode 1N4004 into its position using a clip-on heat sink on the lead to be soldered to keep the device from overheating. Do the same when soldering in the voltage regulator. Soldering the LEDs has to be done as quickly as possible because you will not be able to use the clip-on heat sink if you want the assembled battery monitor to fit inside an empty 1 oz Tic-Tac box.
Now insert the 8-pin IC socket. Bend at least two opposite leads to keep it in place and make sure no excess solder is used when soldering. If adjacent pins get shorted together, re-heat solder so you can wipe off the excess.
Now the tricky part, you’ll have to be careful to solder in the DC Power Jack Male 2.1 mm connector.  After inserting the power connector, make sure it doesn’t come off while you are soldering it due to oversized holes. If you guys know of a better Eagle library part for this connector, let me know.
Well, this is it, the battery monitor is finally assembled and ready for testing.

Step 7: Test Leads Assembly and Preliminary Testing

Test leads assembly.

Now we have to put together the test leads by taking 1' of 22AWG red wire and 1' of 22AWG black wire, one connector Power PL2 Position straight cable mount Jameco P/N: 191484 and 1 pair of alligator clips, such as Jameco P/N: 70991, 1 In-Line fuse holder such as Jameco P/N: 102868 and a 500mA fuse that fits inside this In-Line fuse holder.

Strip about 1/8” insulation off the ends on both wire segments. Unscrew the sleeve-like cover off the Power PL2 connector and solder one end of the red wire to the center terminal of Power PL2 connector. Solder one end of the back wire to the remaining outside terminal of PL2 connector.  Make sure these two terminals do not touch each other once cover is back in place. Slide the unsoldered ends of both wires through the sleeve-like cover so it can be screwed back onto PL2 connector.

Solder the black alligator clip to the other end of black wire. Solder In-Line fuse holder to the red wire (cut off excess red wire already soldered to PL2 connector as needed) in such a way that once test leads are finished, both wires have about the same length.  Solder in red alligator clip to the remaining end of in-line fuse holder and test with an Ohm meter to make sure you get an infinite reading. This means, terminals are not touching inside PL2 connector cover.

Automobile fused power plug with cord.

Take Automobile fused power plug with cord Jameco P/N: 124760 and identify the wire at the opposite end that is connected to center terminal of cigarette lighter plug. Solder in this corresponding wire end into central terminal of Power PL 2 connector Jameco P/N: 124760. Solder in the other wire end to the remaining outer terminal of PL 2 connector. Make sure these two terminals are not touching each other before putting cover back on. Test for proper continuity.

Test Battery Monitor Power supply.

Attach the red and black alligator clips of the test probes you just put together to the positive and negative terminals respectively of a 9V battery. For this test, do NOT install ATtiny 13 yet, the following is meant to test onboard voltage regulator. Insert the PL2 connector end of test probes into Battery Monitor Power jack. Using a voltmeter, measure voltage between pins 4 (Gnd) and 8 (Vcc) of DIP IC socket to make sure you have +5V.  If you get this reading this means the regulator is working properly. Disconnect battery from alligator clips.

Battery Monitor preliminary test

Insert ATtiny 13 into its socket making sure its pin 1 is properly oriented. You will need an 8V to 16V variable power supply or the suggested circuit shown in one of the images for this test. Potentiometer in suggested circuit may be either 100K or 10K. Make sure you have a dc Voltmeter to measure the voltage while you perform the test.

Set the voltage on variable power source to 9V and connect the alligator clips to this power source. Red LED should come on, if this is correct, then software was uploaded properly into ATtiny 13. Increase the voltage slowly until you see that red LED goes out and yellow LED comes on. Please note the voltages. In my case, yellow LED came on at 9.78V instead of the expected 9.6V. Continue to increase voltage and note at what voltages the other LEDs go out and come on. If you use the suggested workbench circuit, your batteries’ voltage may dip a little bit when LEDs turn on and off at voltages higher than 13.1V. If your variable power supply is strong enough these dips may not be noticeable.

Well, it seems the 5% resistors may be causing this difference which is about 0.18V or 1.8% deviation from target which is not bad after all. Had we used 1% resistors this deviation would have been much lower. We’ll see how to adjust this in next step.

Step 8: Software Calibration.

Remember that R1 = 100.001K and R2 = 3.245K? Well, R2 should have been 3.3K and here is where part of the problem is. We had determined that for 9.6V we needed the analog input to read 452 so let’s see what it read:

From formulas derived in slides 4 and 5 in step 1:

                                            R2                                 3.245
Vadc(9.6V) = (Vbat – Vd)------------  =  (9.6 – 0.7)---------------------  =  2.1803 V
                                      R1 + R2                      (10.001 + 3.245)

Plugging this value into digital value formula:

dVal(9.6V) = --------------- (1023) =  446.09 ≈ 446 

Which is about 6 units below 452, that’s why voltage had to go higher to switch LEDs. For calibration purposes, the value 446 will replace 452 in the code as follows:
The line in the code:

   if(val<452){                                     //Is battery voltage below 9.6V?
will become:

   if(val<446){                                     //Is battery voltage below 9.6V?
We will do the same for the other voltages as well, new digital value for 12.4V:
dVal(12.4V) = 586
So this line:
      if(val<594){                                   //Is battery voltage between 9.6V and 12.4V?
Will become:
      if(val<586){                                   //Is battery voltage between 9.6V and 12.4V?
dVal(13.1V) = 621
This line:
      if(val<629){                                    //Is battery voltage between 12.4V and 13.1V while idle?
Will become:
      if(val<621){                                    //Is battery voltage between 12.4V and 13.1V while idle?
dVal(15.5V) = 742
And this line:
         if(val<751){                                 //Is battery voltage above 13.1V and below 15.5V?
Will become:
         if(val<742){                                 //Is battery voltage above 13.1V and below 15.5V?
After we’ve done these changes in the code, we’ll have to recompile and upload this modified program to ATtiny 13 as we did on step 4. Once ATtiny 13 is ready, put it back into the battery monitor board and re-run voltage tests we did in step 7 to make sure that we have indeed improved the performance of the code.
The 9.6V transition occurred right at 9.65V, an excellent improvement over our previous attempt. The difference is only 0.5% at this voltage level which is in compliance with the accuracy of most DC Voltmeters. The 12.4V transition occurred at 12.44V with a difference of 0.3%!!
Higher voltage transitions are more difficult to test due to the blinking effect. Based on our results so far those transitions should be OK. Keep in mind that this step was necessary only because we used 5% resistors. Remember, the values shown here for R1 and R2 were the ones I got on the two resistors I used. If you decide to use 5% resistors, use whatever values you obtain in the readings from your own 5% resistors. Besides, based on what I've read so far, I believe most Arduino buffs will love to tweak their code the same way we did here. If for any reason you need to change voltage levels in the future, you now know how this can be done. This procedure is not practical for production purposes, though. This is for educational purposes, only.
This step completes calibration and now we are ready for some real life testing.

Step 9: Final Testing.

We are now ready to troubleshoot our car with our battery monitor built around ATtiny 13. The first test we are going to do is to check the health of our battery in the engine compartment.

                                                          ****   Warning ****

This project is for educational purposes only. Whenever working in the engine compartment always remove from yourself jewelry or any object that could be trapped by moving parts, pulleys, belts, etc. while engine is running. Failure to do so may result in severe injury or death.  If you do not have experience working in the engine compartment, DO NOT perform these tests.  You can test your battery through the cigarette lighter receptacle, instead.

Car Batteries can put out a tremendous amount of electrical current which can be dangerous if not handled correctly.  Do not short circuit battery terminals in any way to check for “charge”. In addition to potential dangerous currents, electrical transients may damage on board computers and/or other sensitive electronic components that control the engine operation. If no damage occurs, important engine operating data stored in non-volatile memory may be erased or get corrupted. 

Engine Compartment

First, make sure your car battery monitor is already inside an empty Tic-Tac box. Use the test probes with alligator clips and insert the connector into the power Jack of battery monitor. With engine off, pop the hood and hook up the red alligator clip to the positive terminal of battery and then the black alligator clip to the negative terminal. At this point if battery is OK, green LED should stay fully on. Have somebody start the engine while you watch the battery monitor. While cranking only yellow LED should come on and once engine starts only green LED will come on blinking indicating that battery is getting charged. If this is the case, your battery is in good working condition. If red LED comes on briefly while cranking this may be an indication that battery may be low on charge or near the end of its life.

Cigarette Lighter receptacle

With engine off, plug in the automobile power connector into the cigarette lighter receptacle and the PL2 connector end into the battery monitor. At this point, no LEDs will be on as there is no voltage available at this receptacle. Turn the key to the ACC position. If everything is fine, green LED should come on. Start the engine, you will notice that green LED will go out and no other LED would stay on while engine is cranking. Once engine starts, green LED should come on blinking. Blinking green LED indicates that battery is charging. To test battery charging while engine is idle with most loads on, turn on A/C, radio, windshield wipers, headlights, etc.  Green LED should continue blinking. IF LED stops blinking and stays fully on this could possibly indicate an alternator that is not putting out enough power to maintain charging voltage. Have a mechanic take a look at your charging system.

To test whether alternator is not overcharging, run the engine to at least 2,000 rpm with most loads on. Green LED should continue to blink as before. In the event red LED starts blinking this indicates a dangerous overvoltage is being fed into the battery which could possibly be caused by a faulty voltage regulator.

<p>good job mr</p>
Dear marsekal,<br><br>Thanks for your comments.<br><br>Regards<br><br>Rlarios<br>
<p>When I compile your code; it gives a lot of errors. what should I do?</p>
<p>The code compiles ok. I still use Arduino IDE 1.6.5</p>
<p>Just make sure your code is as shown in this instructable.</p><p>The laptop where I compiled this project originally went dead. I will try this code with the newest version of Arduino IDE and let you know if it doesn't work.</p><p>rlarios</p>
<p>Thanks rlarios. But I tried in ATMEL STUDIO 6.</p>
<p>Arul,</p><p>You have two choices: either you debug the code on Atmel Studio, or download Arduino IDE, which is what I used in this instructable.</p><p>If I were in your shoes, I would do as electricity does: follow the path of least resistance. I wish I could help you but unfortunately, this is the first time I ever hear about Atmel Studio. Bringing my new laptop up to speed is something I wouldn't like to do, but I have to. </p><p>Good luck, sir.</p><p>rlarios</p>
<p>how would i discriminate the blinking red light for use on my car which doesnt have a voltage regulator? my cars alternator is regulated by the cars computer using a field 1 and field 2 system? car is a 92 dodge spirit. im only asking unsure if it might react differently with the absence of an actual voltage regulator?</p>
<p>Your car's computer does the same a stand alone voltage regulator does. Most car batteries have same limitations regarless of how voltage regulation is done.</p><p>I once (I guess I wrote about it elsewhere in the comments) tested a 2006 Chrevrolett Malibu that had a problem with the &quot;electric&quot; power steering system. Everytime the driver sped up the engine on the road (it didn't happen at the shop) beyond 2,000 rpm, the steering Wheel got hard to turn (this is dangerous and startling to the driver) and the battery warning light lit up on the dashboard. We had thought it was an undervoltage.</p><p>We plugged in this battery monitor into the cigarette lighter receptacle and found that battery voltage exceded 15.5V when this happened. As I said earlier, this didn't happen at the shop, the car had to be moving. This car's alternator was controlled by the car computer the same way you described yours does. The problem turned out to be bad distributor-to-sparkplugs cables which ran very close to the alternator's control cables coming from the computer.</p><p>This problem was found thanks to the blinking red LED of this tester and that we checked Chevrolett's Technical Service bulletins on line. Once distributor cables were replaced, the problem disappeared.</p><p>Hope this helps.</p><p>rlarios</p>
<p>what should i change to make it wrk with attiny45 and attiny 2313?</p>
<p>ATtiny45 pinout is very similar to the pinout described in this instructable. However, ATtiny2313 is a controller with more pins than necessary. Go to:</p><p><a href="http://www.atmel.com/Images/atmel-2586-avr-8-bit-microcontroller-attiny25-attiny45-attiny85_datasheet.pdf" rel="nofollow">http://www.atmel.com/Images/atmel-2586-avr-8-bit-microcontroller-attiny25-attiny45-attiny85_datasheet.pdf</a></p><p>and</p><p><a href="http://www.atmel.com/Images/doc2543.pdf" rel="nofollow">http://www.atmel.com/Images/doc2543.pdf</a></p><p>Part of the fun is to adapt microcontrollers to your application. After you get them to work, nothing will beat the feel of accomplishment you'll get doing it.</p><p>Good luck, sir.</p><p>rlarios</p>
<p>I am sorry to add comments/questions on such an old thread. I am curious to know if the diode and the voltage divider would be able to handle vehicle load dump? Thanks!</p>
<p>Do you mean the Load Dump Transient generated when Battery is disconnected while Alternator is supplying power to battery and other loads? These transients can be as high a 100V!!! If you mean this transient, voltage divider, diode and maybe microcontroller diode protected inputs may be able to withstand it, but onboard voltage regulator may not.</p><p>This circuit is not intended to be used in a situation like the one described above. However, a zener diode at input of regulator may help.</p><p>Good question pdev007</p>
<p>Thanks my friend! I am a software engineer and a newbie to the Arduino world. Your work certainly looks impressive to me, but some of the hardware specifications go way above my head. </p><p>Here is another (and probably a dumb) question. So during the unusual load dump situation, e.g.; Vbatt=100V, I believe the Vadc for this circuit would be about 24.64V. Will the Arduino ADC pin be able to handle that? I can understand that without adding some kind of protection, the regulator will be fried by then. If I ignore that part for now, I am trying to understand how the ADC pin could still withstand that situation. I apologize if I misunderstood something. </p><p>I am not questioning your previous comment. I am just trying to understand if we also need to add some kind of protection to the ADC pin? </p><p>Thanks for your patience and for all your help!</p>
<p>pdev007,</p><p>See attached drawing that shows how input protection diodes could help. I copied input circuit image from datasheet, then added the voltage divider used in this instructable. </p><p>You can google ATtiny13 datasheet for more information.</p><p>BTW, I have used a similar circuit to detect zero voltage crossing of 120Vac.</p><p>Hope this helps.</p><p>rlarios</p>
<p>Thanks mate, this looks nice. Even when I mount one spare digital voltmeter on board (feed directly from battery, not from on-board powering, like cigarette lighter or switch/fuse/relay boxes), this is easy to use for everyone, even when that person doesnt know anything about cars and charging voltage at all. I also starting to learn something about microcontrollers, so this should be great start project. Only thing I would change is overcharge voltage edge to 14.6V or so, since there is voltage regulators in most of european cars set to 14.1-14.4V, so anything about this value may not be overcharging, but indicates faulty regulator. Thanks again, good work, and great explanation of each step and mode! </p>
Thanks for your comments maniacse!<br><br>As you can see, the design is open to adapt it to your own needs. <br><br>Cheers! <br><br>rlarios
<p>Hello, I'd really like to do this project but I don't have the same voltage regulator as in your instructables. Could I use this one istead? http://www.gmelectronic.com/linear-voltage-controller-st-microelectronics-thomson-78l05-p330-011 Thank you very much</p>
You can use this +5V voltage regulator. Just make sure leads are oriented properly. See section on instructable where 78L05 is mentioned.<br><br>rlarios
<p>Many thanks Pal. I have incorporated small Volt Panel meter, and using silicon test-lead wire able to withstand 150 Deg.C with large alligator clips.</p>
You're very welcome!<br><br>If you are still using the three LEDs, try to increase blinking rate by changing the 100 milliseconds number to 20 milliseconds in the code so you get 5 blinks per second.<br><br>I just tested a Chevrolet Malibu 2007 Lt with an overcharge problem that lasts a bit less than a second and 1 blink per second made it confusing. I was unsure whether it was under voltage or over charging because red LED came briefly on. <br><br>I still don't know whether the computer, the alternator or wiring is at fault, though. This problem causes the electric power steering to stop working and only occurs when engine runs higher than 2,000 rpm while driving and doesn't happen in the shop.<br><br>I wonder if your display would be fast enough to show actual voltage in such a short time. Troubleshooting something like this while driving would make it difficult for one person so you would need somebody else to help you.<br><br>Keep up the good work!
<p>Thanks Pal. now I am crazy on little Solar works. haha. Btw, I made many little DIY, however too lazy uploading the pictures, and doing the write out. This is mine based on your genius idea. My friend simply love it, wanna pay me to made one. Have to turn them down, precious time keep for my own silly works. haha....</p>
Great instructions! Today I decided to follow your instructions and made one myself, but I stumbled upon a problem. I'm having a problem with compiling te code to the ATtiny13, because the code is higher than 1024 bytes. I've used the exact same code you made. Looking on the Atmel site it says that the ATtiny13 can only handle 1K bytes. The code is when I press compile 1120 bytes. I tried to reduce code, but I'm stuck at 1062 bytes. Is there a way you can help me and reduce it to 1024 bytes? I hope you can help me?
Dear harmenschippers,<br><br>I can tell you are trying hard to make this work. Let me tell you what I can do. I will post my source sketch &quot;.ino&quot; file on the instructable itself on the software step so you can download it and try. <br><br>As a matter of fact, I sent this very same file to Jameco so they could pre-program ATtiny 13 for the kit they sell. As the saying goes, &quot;No news, good news&quot;, so I can deduce that it has worked without a problem because this kit has been selling steadily since this instructable was published.<br><br>On the other hand, I will go back to Randofo's original instructable where there are links to sites where different ATtiny &quot;libraries&quot; can be downloaded from. I will check that myself and see whether that also makes a difference.<br><br>If for any reason that does not work either and as a last resort, you can give me the values of your voltage divider resistors and I can program an ATtiny 13 for you so you can have a functional microcontroller for your battery monitor.<br><br>Please, let me know what works for you.<br><br>rlarios
<p>Dear rlarios,</p><p>Today I did a quick look on google for ATtiny13 core files. I thought maybe, if there are actual core files made for the ATtiny13, it would work better instead of just changing the wiring.c file in the arduino core file. To my surprise I found a link on instructables ( <a href="https://www.instructables.com/id/Installing-Attiny13-core-files/" rel="nofollow">https://www.instructables.com/id/Installing-Attiny1...</a> ) where you can download at the bottom ATtiny13 core files. I copied every file to it's place and verified your code and I got 602 bytes. So that seems to be good news. I accidentally worked with Arduino 1.0.5 for mac, so if it works that would be proof it will work with a newer version of the Arduino IDE. Tomorrow night I probably have time to compile the code to the ATtiny13 and I will let you if it worked out.</p><p>I'm really thankful for being so helpful. That makes working on a project much more fun.</p><p>harmenschippers</p>
<p>Dear harmenschippers,</p><p>You are very welcome!</p><p>Good to know that you finally nailed it. I am pretty sure that you will make it work tonight. By the way, don't forget to calibrate resistor values in the software.</p><p>Good luck</p>
<p>harmenschippers,</p><p>Here is an image of the sketch right after being recompiled. Look at code length right at the bottom of attached image.</p><p>rlarios</p>
<p>Hi rlarios,</p><p>I hope to have some time next week to check the code with arduino IDE 1.0.4 on windows. Normally I use the Mac OSX version 1.0.5, but I will run the windows version on Parallels and I wil let you know if it worked out. </p><p>Thanks already for this quick answer.</p>
<p>Hi harmenschippers,</p><p>I look forward to hearing about how this ends.</p><p>rlarios</p>
<p>Hi rlarios,</p><p>It still didn't work out for me and something strange happened. I thought I had it working with Arduino 1.0.4 for windows, because after installing 1.0.4 for windows, adding ATtiny13 to the boards, adding the line in wiring.c, copying your code in Arduino 1.0.4 for windows and then pressing compile, it said the code was now 962 bytes. Still too high compared with your 642 bytes, but I was very pleased to see it worked out with a different version. But when I compiled it a second time, just to be sure, it gave me an error that the code is to big and the code is now 1108 bytes. Same message I get in Arduino 1.0.5 for windows and mac and also in Arduino 1.0.4 for mac, but with different sizes of code. So now I'm really confused.</p><p>I already ordered an ATtiny85 to run this project, cause I think it's a great project! But I'm eager to solve this problem with the ATtiny13. </p><p>I will let you know what I will find, but it's something really weird.</p><p>harmenschippers</p>
Hi harmenschippers,<br><br>I just had the sketch re-compiled 5 minutes ago using Arduino for Windows vrs. 1.0.4 and the size of this binary code was reported as being only 648 bytes long.<br><br>You may be using a newer Arduino for Windows version (or another version in a different platform, if that's your case) because as soon as I opened my copy of Arduino for Windows, I got a message saying that there is a newer version available.<br><br>Please check the above and download the version mentioned from Arduino's site to see whether this fixes the problem. If it does not, let me know so we can together find a way to help you out.<br><br>On second thought, I believe ATtiny 13 is pin compatible with ATtiny 85 which has a bigger memory size. Use this chip instead if the Arduino for Windows version I mentioned above in no longer available. Don't forget to specify ATtiny 85 on Tools&gt;board drop-down menu if you follow this path.<br><br>Nevertheless, I repeat my offer to help if necessary.<br><br>Thanks for your comments.
Hi rlarios, <br>Extremely well done instructable. My question is, wouldn't it be more accurate to place R1 on the anode side of the protection diode instead of the cathode? Sometimes diodes have different forward bias drops between manufactures and sometimes batches. I know its typically between .6 to .7 volts. It would also be one less variable in your calculation. And again, thanks for the wonderful instructable. I'm going to try to make one soon.
Hi there again Ilitlepage, <br>I did test the circuit doing what you suggested and it didn't seem to affect ATtiny 13 with voltage polarity reversed. Analog input was subjected to a negative voltage equivalent to one diode voltage drop with respect to ground. The rest of circuitry was not exposed to any negative voltage at all due to D1. Then, I applied voltage with correct polarity and ATtiny 13 worked normally. <br> <br>To answer your question, yes, it would be more accurate taking D1 out of the equation and apparently there is no danger to ATtiny 13. <br> <br>Thanks for your input.
WOW, rlarios,<br>You are awesome! Thanks for trying my idea. I must admit, I didn't consider the reverse polarity on the input pin. I'm thinking, to make the circuit more &quot;bullet proof&quot;, one could add a second diode to the circuit. I would place it with the cathode on the input pin and anode to ground. So, upon reverse polarity the worse case voltage would be -0.7v on the input pin.
All input pins come already protected with diodes which is why about -0.6V were obtained between analog input under test and ground when polarity was reversed. As it seems IC designers had already considered negative voltages I think there shouldn't be any potential damage to the microcontroller. You can add an extra diode if you wish.<br><br>I feel a change like this will be done in version 2.0. Thanks Ilittlepage and have a good night.
Hi Ilittlepage,<br>Thanks for your comments. I originally didn't even think about using protection diode D1 until I realized that accidents could happen. I also thought of doing exactly what you are saying but I ended up doing what you saw in the instructable. <br><br>You just made me think that doing what you are suggesting may not be that dangerous after all to ATtiny 13 in case of an accidental voltage polarity reversal due to the device's internal analog input-to-ground-protection-diode. I guess I'll do a test in the next few days and let you know what happened.<br><br>Hey! Thanks for your input and have a good night!
This instructable is awesome...and something i could use right now as my car idle seems to be very low along with other issues. I have a suspicious feeling its the battery. This device would come in very handy and looks fun to build. Kudos my 'ible' friend
Thanks PyroMonger, good luck with your car!
Thanks. One last question...which ATtiny 13 ic do i need? ive searched but theres a few different ones. Please help
Well, to tell you the truth, I just bought the first one I came across with. I knew the software was going to be small so I didn't need too many resources. Click on the following link:<br><br>http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_765302_-1<br><br>Good luck PyroMonger!
Nice instructable. And the device is a very reasonable thing to have. <br> <br>I bought a very similar device for my family member. It was cheap enough to dare to open the case and void warranty right away. That one had three zener diodes for main components. No controller, all analog. I reverse engineered it and almost managed to replicate the functionality on breadboard, just one non-fatal quirk remained. I plan to make few of them with nice smd leds next summer for couple of old motorcycles we have in the family - motorcycles have tended to to get charging problems often, would be useful addition to the dashboard. <br> <br>Now I know there's an alternative to do it digitally which is more precise. Maybe that precision is not desperately needed, but if I get some other ideas and collect them into one Atmega controller ... would be cool ... <br> <br>If anyone is interested in the analog charging voltage monitor schematic, I could draw that reverse engineered thing in a somehow presentable way. Let me know if interested.
You have a multimeter I saw it. Why go through all this work when you have a multimeter that gives you exact readings not ranges. Although if you could put a digital read out instead of green yellow and red LEDs that would be sweet! But idk how possible that would be
At least two reasons. Maybe not for the author, but for some people it is easier to read info in LED colors rather than remember what was supposed to be the normal voltage reading. Secondly in case of suspicious battery or charging system it is very beneficial to keep an eye on it for longer periods while riding the car. Taking a look at multimeter while driving in the dark would make crashing the car very likely...
Hi buskrat, <br>You are right, you can troubleshoot your car battery with a multimeter. You can also add a digital read out if you want to. You would agree that not everybody has battery problems everyday as to remember the readings you have to watch for. This is an educational project, though. <br> <br>Thanks for your comments, sir.
Your list of parts has 2 errors, you've listed the 10k and 330ohm resistors as 1.4W, but the Jameco kit this instructable is based of calls for 1/4W, which BTW are much easier to find ;)
Hey deykos! Thanks for letting me know. Error corrected.
That's what I call a well put together instructable!
Thanks sir! I'm glad you liked it.

About This Instructable




More by rlarios:Troubleshoot your car battery with ATtiny. Build a simple water level control The mexican... Watt ? ? Calculate Watts on motors with Amp and Volt readings. 
Add instructable to: