Battery Backup For DRO Interface

Friday, January 24, 2014

In the first part of the build instructions for the MSP430G2 LaunchPad-based DRO controller I showed a few pictures of the unit I built for my mini mill. Out of necessity my controller had to have battery backup, since the power in my garage was very flaky and the circuit breaker tripped every time I looked at it crooked. The battery backup circuit I built originally was a quick stop-gap measure that would get me through until the garage was rewired properly. I didn't spend much time designing that circuit. Since several people asked me to provide more details about it, I decided to take a more methodical approach for this post.

Let's start by clarifying why one would bother with adding battery backup to a DRO. Most of the scales available on the market use incremental encoders. This means that they don't know the position. Instead, they measure the distance traveled from the moment the scales were powered. Depending on the particular design, the scales output either raw pulses, or some representation of the position. The former is the case with glass and magnetic scales; the latter is common with caliper-type encoders. This design has two vulnerabilities. First, when the power is lost, the scales [eventually] reset and lose their position. Second, there is no way of knowing if the reading head has moved while the scale was off. In both cases the DRO's readout will become inaccurate. If you're lucky, you will notice the error and will need to re-indicate the workpiece. Otherwise you stand a good chance of ruining the part.

The obvious solution is to make sure that the scales are always powered. If the power in your workshop is reliable, simply leaving the controller plugged in full time will solve the problem. If the power is flaky, though, you might want to consider adding some sort of backup.

For capacitive scales this is as simple as powering the scales from one or two AA batteries, depending on the particular model. The LaunchPad doesn't need to store the position, so there is no point in powering the microcontroller. Given that a one or two cell batteries can keep these scales powered for months, or even years, such setup shouldn't pose any problems. Glass scales, on the other hand, are a different story. You might recall that they provide only the raw pulses and the MSP430 microcontroller has to count and keep track of them. Ideally, to prevent any position loss, the scales and the microcontroller need to have uninterrupted power.

I had a hunch that glass scales would draw much more current that the "calipers". As I mentioned earlier, I wanted to be a bit more methodical this time, so I started by finding out how much current different parts of the DRO draw. For that, I cut the Vcc line of the USB cable and connected my Fluke 87 multimeter in series. After several measurements with different components disconnected, here are my findings:

  • The complete DRO controller with three glass scales drew on average 220 mA.
  • Sans the scales, the same unit drew 50 mA.
  • Finally, without the transceiver, the Launchpad drew a touch under 20 mA.
  • Once the LED's were disconnected the current draw went down to 14 mA.
  • Single iGaging scale (without the display unit) drew 17 uA (microamps), or, in other words, three orders of magnitude less than the LaunchPad.
  • Single "Chinese" scale drew 7 uA when the display was off and 18 uA with the display on.

An average AA alkaline cell can provide roughly 2000 milliampere-hours. When powering four iGaging/AccuRemote scales, two such batteries will last approximately 25,000 hours, or roughly three years. Powering the LaunchPad without the transceiver, the same two cells will last 100 hours; finally, powering my glass scales setup will require at least 4 batteries, which will last less than 10 hours. By going to "D" cells the time would become 225,000 hours (25 years) for just the scales, 900 hours (a bit over a month) for the LaunchPad and 81 hours for the complete glass scale setup.

Clearly, powering a complete DRO from batteries for extended periods of time is impractical. Even the microcontroller by itself will eat through the batteries disturbingly fast. Fortunately, as I mentioned before, for iGaging/AccuRemote and other capacitive scales this is not necessary. Glass scales, on the other hand, will pose some challenges. I haven't worked out all of the details for such setup yet, so it will be left for another post. For now let's figure out what can be done for the capacitive scales.

The general idea is to provide power to the scales but not to the "power hungry" LaunchPad board and BlueTooth transceiver. By far the simplest approach is to always power the scales from the batteries. For that you would simply disconnect the scale's Vcc line from the LaunchPad board and connect it to the positive terminal of the battery pack. The negative terminal would need to be connected to the controller's ground. As long as you don't forget to replace the batteries every few years, you're good to go. In fact, for the standard 1.5V scales I would recommend you stick with this approach and don't even bother with a power converter.

For iGaging and AccuRemote scales, we can take a more sophisticated approach that uses the batteries only when the power supply is off. Besides extending the battery life by a few days (or weeks), the main benefit is that when the batteries eventually die, the DRO won't go "flaky" in the middle of a work session. If you choose to keep it plugged in, the batteries will last "for ever". Unfortunately you can't simply connect the batteries in series with the LaunchPad's power supply. The reason is that once the voltage of the battery pack falls below 3.3V, the batteries will start charging from the LaunchPad. At some point they will overhear and either vent, or even explode. Similarly, when the power is off, the batteries will keep powering the LaunchPad and the BlueTooth module. Both scenarios can be easily prevented by a simple circuit shown in the schematic below.

Backup circuit schematic

Now let's see how it works. You might recall that diodes allow the flow of electricity only one way, from positive [anode] to negative side [cathode]*, or in other words, from higher to lower voltage. When we connect the batteries to a powered down unit, diode D1 will see3V at the anode and 0V at the cathode, since the scales aren't getting power from anywhere yet. It will turn on and let the current flow to the scales. At this point D2 is turned off, since the voltage is reversed from its point of view, and the batteries will not be powering the rest of the controller. When the LaunchPad is powered, D2 starts seeing 3.3V at it's anode and 3V at the cathode, so it will be turned on. In turn D1 is now seeing higher voltage at the cathode and will turn off, so the batteries will not be charging from the higher voltage.

*Yes, I know that the electricity actually flows in the opposite direction but for the sake of this post let's stick with the "conventional" model.

There are two nuances that we need to keep in mind here, though. In the real world diodes have two characteristics that throw a small monkey wrench into this setup. First of all, they have some amount of voltage drop across them. In other words when D1 gets 3V at the "input", it will output a few tenths of a Volt less. The common diodes you are likely to get at your local Radio Shack will likely have the voltage DROp in the neighborhood of 0.7V. This will drop the voltage at the scales to 2.3V, which is too low for the iGaging scales. Second, diodes don't switch on instantaneously; there is a small delay. I.e. when the power to the LaunchPad is cut, the scales will lose power for a brief moment.

The circuit above addresses the first problem by using "Schottky" diodes (specifically BAT85) that have voltage drop of 0.3V. The second problem is addressed by the large electrolytic capacitor that will hold enough energy to power the scales for the brief moment the current is now flowing through the diodes. As an added bonus this capacitor will smooth out any ripples on the line as well.

The complete bill of material for this circuit consists is as follows:

  • Two Schottky diodes (BAT85 or similar)
  • One 2200 uF, 6V or better electrolytic capacitor
  • One 2-cell battery holder (pick whichever cell type you like)
  • Two Alkaline batteries
Parts required for the simple battery backup circuit

Side note, if you wish to use rechargeable batteries, you'll need to use three cells, since they are rated at 1.2 when fully charged. Additionally, use standard (not Schottky) diode in D1 position.

Building this circuit is pretty straight forward:

Start by soldering the negative lead of the battery pack and the ground line to the negative lead of the capacitor

Negative lines soldered to the capacitor

Once that is done, solder the two diodes and a piece of wire together, making sure that the black strips on the diodes are facing the junction point.
Wrapping the leads with some thing wire before solder will make the process much less frustrating.

To keep the parts together, wrap the leads with thin wire before soldering
Diodes soldered to the capacitor

Now solder the positive lead to the other side of one of the diodes.

Positive lead from the battery pack soldered to D1

Finally connect the ground to LaunchPad's "Gnd" pin and D2 to the "VCC" lead (with a short piece of wire)

Completed circuit connected to the LaunchPad

The other red wire in the picture above should be connected to the Vcc lines on the scale(s)

The circuit described in this post will work for iGaging and AccuRemote scales. Don't try using it with standard 1.5V scales or calipers. For those scales I would use a single C or D cell to power the batteries and the "virtual ground" for the comparators. Every once in a while take a look at the scale's built-in LCD, and if it looks faded, replace the battery. Finally, I will try to come up with a workable backup scheme for the glass scales in the near future. I ordered a few parts, and once they arrive will start experimenting, so stay tuned for the future posts.

8 comments :

  1. Yuriy,
    First and foremost, thank you for putting this project together, it has helped me tremendously. Secondly, I have a question regarding the statement: "Side note, if you wish to use rechargeable batteries, you'll need to use three cells, since they are rated at 1.2 when fully charged. Additionally, use standard (not Schottky) diode in D1 position." What specifications do you recommend for the diode at D1 when used in that capacity?
    Thanks,
    Zach

    ReplyDelete
    Replies
    1. Zach,
      Three batteries will amount to about 3.6V; the regulator will output 3.3V. If you use the same two diodes, the batteries will be powering the whole unit until they discharge below 3.3V. If you use a diode with 1.2V dropout from the batteries and one with 0.6V dropout for the regulator, the final voltages will be 2.4V and 2.6V respectively.
      Does this make sense?
      Regards
      Yuriy

      Delete
  2. Hi Yuriy,
    great project!
    I'm about to put this together and was looking for the MSP Launchpad. I found a Launchpad with MSP-EXP430G2, this one: http://www.watterott.com/de/MSP430-LaunchPad-MSP-EXP430G2
    Would that work?
    Cheers,
    Alex

    ReplyDelete
  3. Can you please suggest a diode for d1 or will any diode work? if it is to charge is there not a need for power to flow into the battery's? with standard diode in d1 no flow to battery i understand about the rechargeable needing to use 3 batteries

    ReplyDelete
    Replies
    1. Any diode should work but Schottky would be better since it has lower voltage drop.
      If there is flow to the batteries, they can (and probably will) explode, even if they are rechargeable.

      Delete
  4. Hi Yuriy,
    I just finally got my project assembled and I am installing this battery set up now. Just curious, is it necessary to have two diodes? As I look at the set up it looks as though the diode that prohibits backflow to the battery is the only one that is necessary. Am I seeing this incorrectly? Thanks again for all the great information!
    James

    ReplyDelete
  5. Ok never mind, I think I see the reason, is it to prevent the battery from backflowing into the board?

    ReplyDelete
    Replies
    1. Yes. You don't want to power the whole board and you definitely don't want to accidentally charge the battery.

      Delete