| Electronics > Projects, Designs, and Technical Stuff |
| How to convert logic level ? |
| (1/2) > >> |
| Jan Audio:
Hi, i have digital logic levels on : around 12 volt, off : around 6 volt. The levels are somewhat varying in level, there is a clear on and off state, anough space in between. How do i convert this into a clean 0 to 5 volt logic level ? thanks in advance |
| IDEngineer:
Having no more information about your circuit or situation than two "logic" levels, my first thought is to use an open-collector digital comparator and set the threshold midway between your two levels. Put a pullup on its OC output to whatever high output voltage you need. More info about your system might yield a better suggestion! |
| SiliconWizard:
A very simple way of avoiding the use of an high-voltage opamp with an open-drain output would be to put a resistor divider before the comparator to scale your 6V-12V signal down to 2.5V-5V. Then use any comparator fast enough for your requirements, powered at 5V, and set some hysteresis for added robustness, with the two thresholds at something like 3.25V and 4.25V for instance. We don't know about your speed requirements or if you need to discriminate a low level (~6V) from the absence of signal (<< 6V). The above approach will work fine unless you need very high speed switching (the resistor divider will act as a low-pass filter with the input capacitance). For the second point, you could always add a second comparator. |
| IDEngineer:
I didn't say opamp, opamps are a poor choice for a comparator particularly if the signals have slow slew rates (though we don't know much about the OP's environment, as I mentioned in my original response). I said comparator, as in (for example) the very common LM339/2901 family. Runs on single supplies from 3-36V so immediately compatible with what the OP described, open collector output so he can set whatever output high voltage is desired, available from multiple manufacturers in a variety of packages both SMT and throughhole, and costs ~20 cents even in low quantities. Given that he said: --- Quote ---The levels are somewhat varying in level... --- End quote --- ...I felt the ease of adding hysteresis with a comparator such as the LM339/2901 would be a good idea. I considered a resistor divider but again, given that we don't know much about OP's low/grey/high "levels" it's hard to know that a given divider ratio would work reliably in all of the so-called "varying" conditions. A comparator avoids all of that and makes adding hysteresis easy to accommodate his "varying levels" for more reliable operation. All for under a quarter USD including the necessary discretes. |
| soldar:
You can try something like this. It should convert 6-12 V to 5-0.3 V. (It inverts the input.) |
| Navigation |
| Message Index |
| Next page |