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.
|Basic Input Buffer using a bipolar transistor|
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.
|Voltage Shifter circuit that can handle one scale|
uses half of one LM339 comparator and four resistors
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