Continue to Site

Help me design a circuit for level shifting

Status
Not open for further replies.

mickelsen

Junior Member level 1
I want to read the digital data coming from a digital caliper. The caliper runs on a 1.55v battery so the digital data swings between approx. 0v and 1.55v. In order to read the data using a PIC micro the data needs to be at standard levels, namely 0v-5v. Once the data is at standard levels I know how to handle it but I don't know how to design the circuitry to do the level shifting. Can anyone help me?
Thanks,
Mark

Level shifting

simple comparator adjust its threshold to be 1.55/2 (or any other inbetween value) and make the suplly 0,5 V

Re: Level shifting

I agree a simple compartor would do the job nicely. In fact if the PIC has an onbaord comparator you dont need an extra IC.

Cheers
Slayer

Re: Level shifting

Okay, great. I'm a digital kind of guy, not analog. Is the comparator in the PIC a voltage comparator as opposed to a current comparator (at least I know enough to ask the question)? How do I get the .75v reference for one side of the comparator? Also, is there any kind of signal conditioning I need to do to the signal coming from the caliper?
Thanks again.
Mark

Re: Level shifting

Hi,
AFAIK the PIC has a voltage comparator. In order to get the ≈.75V a simple resistive voltage divider can be used - provided that the caliper's supply is usable. Otherwise a dedicated voltage reference or a zener diode and some voltage dividing can do the trick. This ofcourse does not yield 100% 0.75V but as you only want to detect the edge any voltage somewhere between the 2 extremes will do just fine.

Cheers
Slayer

mickelsen

Points: 2
Re: Level shifting

I realize now that I'm going to have to have two external comparators because the caliper has a data line and a clock line that will both have to be shifted to TTL levels. It uses an SPI type of protocol so I'll need them both at TTL levels so that the data can be shifted into the PIC's SPI interface by the clock. I guess I won't be able to use the PIC's internal comparator.

Any help on choosing the external comparators and on how to wire them up with whatever extra components they will need would once again be greatly appreciated.

Mark

Re: Level shifting

Hi Mark,
It all depends if you can use the power supply of the caliper or not, as this will dictate the topology of the external circuit.

Cheers
Slayer

Re: Level shifting

The caliper uses a very small battery. I would try to avoid using the battery power to run the rest of the circuitry if at all possible.

Re: Level shifting

Hi Mark,
This circuit produces near TTL levels, this however should not be a problem as anything above 3.5V in a 5V system is considered logic 1.

Quickly checked it on some breadbord and it seems to work OK, i didn't have the same OpAmp though, and used some good ol' LM324s. They provided a lover output voltage but the PIC picked it up ok.

Cheers
Slayer

mickelsen

Points: 2
Re: Level shifting

That looks great! I can then duplicate the circuit to generate the clock signal. Thank you very much. One question. Your notation for resistors is a little different than I'm used to. Is a 7k5 the same as a 7.5k?

Thanks again.
Mark

Re: Level shifting

Yes indeed the 7k5 is the same thing as 7.5k. It just depends on if you use the US or EU or IEE style.

Cheers
Slayer

Re: Level shifting

mickelsen said:
The caliper uses a very small battery. I would try to avoid using the battery power to run the rest of the circuitry if at all possible.

Check if caliper put out power on line (1.55 Volt = silver oxide battey ?) via (MOS) transistor or pullup or have simple open collector output.

If caliper feeds power out to dataline and long time have high level state, you must build input with very high impedance (MOhm = FET-input OP-amp/comparator) or caliper battery draws out in short time via your PIC.

you can also see different solution on interface on

(using 4049 as amplifier to detect edge of pulse train via DC-blocking capacitance.)

but this very depend of used caliper interface protocol.

---

I you have more than one pair cable to caliper, try make power feed to caliper from your PIC-board so batteys not going down so long PIC-boart is connected and powered. If you make 1.55 Volt (+ 0.4-0.7 Volt for protection diode voltage loss) on PIC-board and connect to calipers battery (via protection diode) caliper battery should not draws out even with load on data output.

Re: Level shifting

You may like to try
Voltage level shifting using a npn transistor
or a optocoupler device.
The interface circuit consist of only a few components.
They can be operate to switch voltage level,
and acts as a voltage converter
(voltage level conversion function).

The current limiting resistor are to be chosen,
depending on the voltage input and output.
It prevent the transistor from being destroy.

References: