Voltage Shifter Circuit for Mixed Scale DRO Controller

Saturday, October 12, 2013
In the last post I introduced the new version of DRO controller that is able to read a mix of common digital scales. You might recall that “Mixed Scale” controller uses the same MSP430 Launchpad development kit as the “Basic” version, but requires a bit of extra hardware. Unlike the the iGaging scales, which work quite comfortably with the 3.3 Volt power supply, most other inexpensive capacitive scales use 1.5V (nominal) power supply. This means that their outputs can’t be reliably read by the MSP430 microcontroller. Similarly, glass scales and quadrature encoders use 5V power supply. MSP430’s inputs can tolerate up to 3.6V, so connecting the glass scales directly to the Launchpad will permanently damage the inputs.

If you're using scales that output square signal at 5V, a simple circuit described here will work just fine.

Technical note: MSP430 digital inputs use a circuit called “Schmitt Trigger”. Instead of switching from low to high and vice versa at a single voltage point, the inputs have hysteresis. According to the MSP430 datasheet, the input transitions from low to high at 2.25V and from high to low at 1.35V. This is done intentionally, so noise on the line doesn’t trigger false high/low transitions.
circuit showing 2N2222 transistor
Basic Input Buffer using a bipolar transistor
To solve the voltage mismatch the controller needs an input buffer/voltage shifter circuit. There are many ways to implement such circuit, ranging from a simple transistor-based approach to a dedicated “bus driver” IC. For the first prototype [of the mixed scale controller] I used the design shown in the schematic. It was very easy to build but had a drawback - the inputs were inverted. I.e. when scale output was high, the microcontroller would read “low” and vice versa. It would be easy enough to compensate in the software but in the long run it created some headaches.
After experimenting with a few different designs, I decided to settle on a circuit that uses a commonly-available LM339 comparator. This IC is readily available from Radio Shack and other electronic component suppliers and can handle two sets of scale inputs, each running at a different voltage. Best of all, it doesn’t invert the inputs. This means that for iGaging scales the buffer can be skipped altogether (since the scales can be read directly by MSP430). The schematic for a circuit that can handle one scale is shown below.
Circuit that interfaces one digital scale to MSP430
Voltage Shifter circuit that can handle one scale
uses half of one LM339 comparator and four resistors
The way this circuit works is pretty straight forward. Resistors R1 and R2 create a “virtual ground” for the comparator’s negative input. The value will be close to 1/3 of the scale’s supply voltage. Any time the voltage at the “+” input is lower than the virtual ground, the output will be pulled to the ground. Otherwise, R3 and R4 will pull the output close to MSP430 Vcc (3.3 Volts).
In practice, when the scale’s output is low, the controller’s input will be low as well, and when the scale’s output is high, the controller will see a high value as well. Since the virtual ground voltage is set in relation to the scale’s supply voltage, the comparator will properly “translate” the input to levels MSP430 can reliably [and safely] read. Furthermore, by replacing R1 and R2 with a 10K trim pot the same circuit can be used with analog tachometer input etc.
Input from 1.5V scale (yellow) is accurately converted
to 3.3V (blue) that MSP430 can reliably read
Glass scale's 5V (yellow) gets converted to
a safe level that won't damage MSP430's inputs


This voltage translator design offers a good compromise between flexibility and ease of build. It can work with a range of voltages from under 1 Volt to over 18 Volts, and doesn’t invert the inputs. A circuit that can handle four scales requires only 16 parts and can be built for under $20. In the next post I will provide parts list and build instruction for a voltage shifter that will have four inputs/outputs and will work with three different voltages (i.e. 1.5V, 3.3V and 5V).


  1. Been waiting for this.. have a Shumatech DRO on my X3 that mostly works but sometimes not. didn't want to change the scales so exactly what I need! thanks in advance.

  2. This is the first time I've seen the LM339 comparator used as a voltage shifter. That's a very clever (and cheap - my favorite part) idea.

  3. Hello,

    I've finished building the MSP430 Launchpad, I got the X and Y hooked up to some Accuremote scales(working great). I originally built the MSP430 board to use all 3 with the Accuremote scales but decided to use a Harbour freight Digital scale instead for the Z-axis.

    I got the Voltage shifter convertor board built for the mixed-scale. Decided to re-use the mini-usb connector board called out in the plans for the z-axis as well. So I cut the clock line going to the z-axis mini-usb board, (originally had them all connected to p1.7 on the MSP430). re-routed the +v and gnd for the +1.5v battery voltage. Re-routed the HF scale data/clock lines to the LM339 from the mini-usb board.

    My only problem I have now is the clock line, If you look at your image above, the Voltage shifter circuit, you have to outputs from the LM339 circuit, one is for the data line, Which I have it connected as before to P2.5 of the MSP430. I'm not sure where to connect on the MSP430 the clock line coming from the Voltage shifter circuit described in your circuit above?

    I've seen in your build with the mixed scales, 2 glass and a HF scale, you used the p2.0, p2.1 and p2.2 as clock lines.

    Where should I connect my Z-axis, a HF digital calipers, clock line coming from the Voltage shifter circuit displayed above in your picture? I have the data line from the voltage shifter going to P2.5(HF data)


    1. How often does Yuriy reply to comments/questions? Does he have an email address or IM to contact him directly? I really would like to resolve this issue as-soon-possible!

      I'm thinking that I might need to connect the clock line from the Voltage shifter to MSP430-P2.0, since I have my other Z-data line going from the Voltage shifter to MSP430-p2.5.

      Not sure what lines are being used for input/output in his program for the MSP430.

      Comment can be directed to someone@zbadlands.com


    2. I think I might of answered my own questions. Just took a peek at he source code available for the Msp430Dro_Basic/Main.c. It says what pins are used for what, however, on his "DRO Project Downloads" page, it says the source code for the mixed scales is not available yet.

      I am using the firmware for the "MSP430 Launchpad Controller for iGaging Scales" flashed to my MSP430.

      I can download the firmware that I need but need to get the source for the mixed-scales so I figure out what pins I need to connect to.

    3. I try to reply as often as I can, which can be between minutes and days... My email address is ycroosh at gmail dot com.
      Short answer - take a look at this post: http://www.yuriystoys.com/2014/01/dro-interface-pin-functions-for-msp430.html
      Long answer: when you mix HF and iGaging/AccuRemote scales, the controller doesn't [yet] provide the clock signal, so you will need to wire one of the displays to provide the clock.

      Hope this makes sense.

    4. Yuriy,

      Thanks for the quick response!
      I read the data from the link you provided, just what I was looking for.

      Onto the "Long answer" response.

      I have two AccuRemote scales hooked up for X/Y axis, trying to use the HF digital caliper for the Z-axis. I understand, since I used the AccuRemote scales without the display unit attached that P1.7 provides the CLOCK signal to them, correct? It must, since they are working!

      Onto the Z-Axis HF scale. I'm going to be connecting the Data/CLK outputs from Voltage Shifter to the P2.2 (Z CLK/A) and the other Voltage Shifter Data output to P2.3 (Z data/B).

      The display unit is still attached to the HF digital calipers and will be powered from the remote battery wired into the circuit. This will be wired into the Voltage Shifter (LM339) inputs and the outputs will be wired into the MSP430 P2.2 and P2.3

      I know I will need to re-flash the MSP430 with the Universal firmware instead of the AccuRemote version I had flashed already.

      Does this sound correct? Is this what you mean in your response about providing a CLK signal? Which is provided from the HF digital calipers?

      Awesome project!

    5. Jeff,
      That's correct. The only problem with the new firmware is that P1.7 doesn't provide the clock yet (I had issues with timing reading the scales, so I had to disable it, and haven't had a chance to redo the firmware yet). Short-term you will need to use one of the display units to provide the clock to AccuRemote scales. You will need to hook up Vcc and Gnd of the display to one of the scale's Vcc and Gnd and connect the clock line to both scales' clocks. Does that make sense?

      Thank you

    6. I understand now, didn't know the P1.7 was disabled with the firmware for the Mixed-scales. I will just keep what I have now and continue to use a dial indicator for my Z-axis until you work out the issues with the timing.

      Thanks so much for responding to my questions.

  4. Small TYPO in the LM339 circuit. Comparator 2A pins, inv-6, non-inv-7, out-1.

  5. I am just verifying what I think I'm reading and from the LM339 circuit. The 'Scale V+' is VDD from the scale? VCC on R3 and R4 is VCC to the LM339 ping 3?

    1. Also is the bias voltage for the LM339 +5V?