-12V +6V to logic level - Page 1
Forum section: electronics / projects

author: Tnixsw
author_rank: Contributor
timestamp: December 19, 2022, 08:22:43 am
content: HI all,First post :-)I am trying to interface a 5V microcontroller to an early (70's era) circuit board, and I need to monitor the system clock which is -12V to +6V at around 200KHz.I thought a simple diode with a pull down resistor would work, but the diode was not fast enough or a fast Schottky type passed too much negative voltage.The resulting signal needs to track the original rise and fall as close as possible or the delays introduced will cause problems with the software operation, as it has to interact with other signals the host board as well.Any ideas for the clueless would be appreciated.many thanksTony

author: RoGeorge
author_rank: Super Contributor
timestamp: December 19, 2022, 09:35:11 am
content: There are RS232 to TTL transceivers, i.e. MC1488/1489 or MAX3232, that should work. Can be baught as chips or mounted on a small devboard if you search for RS232 to TTL adapter.

author: Ian.M
author_rank: Super Contributor
timestamp: December 19, 2022, 10:10:07 am
content: If the clock source can sink an extra half mA, it could be as simple as three resistors. See attachedLTspicesim.

author: tooki
author_rank: Super Contributor
timestamp: December 19, 2022, 10:54:48 am
content: I also immediately thought of using an RS-232 transceiver. Or you could use a comparator.

author: DavidAlfa
author_rank: Super Contributor
timestamp: December 19, 2022, 01:05:27 pm
content: This converts a 6V...-12V signal into 5.25V...25mV without using the clamping diodes, +250mV shouldn't cause any problem (Only the two resistors, the rest is the mcu input model).Also the input might have larger capacitance, heavily depends on the MCU, check the rising/falling times with a scope!The ADC in some MCUs have been reported to be very sensible to slight overvoltages on IO pins, affecting the measurement, so check it out too.If the clock is sensible to small loads or the rising times aren't good enough, interface this circuit to a low input capacitance op-amp/comparator.

author: Terry Bites
author_rank: Super Contributor
timestamp: December 19, 2022, 07:36:12 pm
content: Cheapskate level shifter.The old common base.Any npn.

author: Tnixsw
author_rank: Contributor
timestamp: December 19, 2022, 09:34:03 pm
content: Thanks everyone for the replies.The circuit board for this project is the same size as a DIP 18 package so RS232 converter is a good idea but not practical. (Apologies, I should have mentioned this). The other ideas I will try out using a PIC micro, thanks again.cheersTony

author: Someone
author_rank: Super Contributor
timestamp: December 19, 2022, 11:12:18 pm
content: Quote from: Terry Bites on December 19, 2022, 07:36:12 pmAlways a good option with some extra protection for the power rails coming up at different times. Simple transistors are almost as cheap as resistors! use the internal pull-up/pull-down on the micro and get it down to 1 resistor + 1 transistor.

author: BrianHG
author_rank: Super Contributor
timestamp: December 20, 2022, 01:33:39 am
content: If you are feeding a CMOS logic input, which has rail diodes, a series 500k-100k ohm resistor will do.

author: BrianHG
author_rank: Super Contributor
timestamp: December 20, 2022, 03:55:02 am
content: You can also add a series cap with the 100k resistor, something like 0.1uf, to better center the duty cycle transition point of the waveform since it is a continuous clock signal.

author: Tnixsw
author_rank: Contributor
timestamp: December 20, 2022, 04:28:46 am
content: I tried the 2N3904 circuit, but to get reasonable result I had to reduce the 10K down to about 2K which I think is too much of a load on the original clock driver as its amplitude had decreased. I have to be careful here as the original clock driver is hard to replace if damaged.The blue/yellow(analog) trace in the image is the output clock signal, the red output is as would be seen by the PIC which in this case is pretty much what I need.Maybe a simplistic circuit is not the way to go. I did try a 2N7000 N FET with 1K gate resistor to clock and 10K load, source grounded. Worked ok at lower frequency but otherwise similar results. Granted the test wiring connected to the original circuit is adding capacitance.The newer PIC inputs are nowhere near as tolerant as the older ones with regards to series resistor to limit voltages through the protection diodes.cheersTony

author: james_s
author_rank: Super Contributor
timestamp: December 20, 2022, 05:07:14 am
content: Can you feed it through a resistor to limit the current then clamp it with a zener diode? I've used that approach to turn an AC sine wave into a logic level signal feeding a microcontroller and it worked adequately for that.

author: DavidAlfa
author_rank: Super Contributor
timestamp: December 20, 2022, 09:11:17 am
content: The best option will always be a fast comparator!Nowadays PICs are very much the same thing!Try directly feeding the clock through a 100K resistor, you might get good enough response. Won't burn anything!

author: Kleinstein
author_rank: Super Contributor
timestamp: December 20, 2022, 09:36:05 am
content: One could try a voltage divider with rather high resistor values in combination with a small capacitor (likely 5-10 pF range) to speed things up. The resistive voltage divider (e.g. 100 K range) alone would be rather slow because of capacitive loading. The extra capacitor of the right size would compensate the divider to make it fast again. As the target AC amplitude is about 1/4 the starting amplitude a capacitor of about 1/3 to 1/2 the input capacitance would be OK. The modern chips should be Ok to clamp slightly larger signals from a slightly larger than ideal capacitor. Measuring the signal would effect the signal as even some 5 pF from a probe is quite a bit compared to usually some 10-20 pF of logic inputs.P.S. The old signal may have a reltively slow rise time to start with and modern chips may not like that very much. A schmidt trigger gate would be a good idea.

author: Terry Bites
author_rank: Super Contributor
timestamp: December 22, 2022, 10:05:17 am
content: I thought it only fair (fun) to improve the basic idea but make it a bit faster and cleaner.

author: BrianHG
author_rank: Super Contributor
timestamp: December 22, 2022, 10:05:13 pm
content: Why not use a J-Fet and 1 or 3 resistors?

author: Tnixsw
author_rank: Contributor
timestamp: December 22, 2022, 11:07:00 pm
content: Thanks everyone for the replies.I am continuing to "play".The newer PICs are not friendly anymore with overvoltage on inputs by relying on a resistor and internal clamping diodes, especially with negative voltages. The main culprit being FET pass gates on pins with analog capability. Ref: Microchip doc TB3013 - although it seems a bit ambiguous when considering digital only inputs.I suppose if in doubt, don't do it.cheersTony

author: DavidAlfa
author_rank: Super Contributor
timestamp: December 23, 2022, 12:26:06 am
content: The RC network might need some tweaking, too low and it will have slow response, too high and it might cause spikes.

author: Tnixsw
author_rank: Contributor
timestamp: January 04, 2023, 11:41:40 pm
content: Hi all,I received some fast Schottky diodes today in a SOT-363 case (MBD54DWT13) and I got the result shown in the image. Bottom trace is +6V -12V, the top trace is the clipped 0-6V through a 10K resistor, at about 180KHz. I'm not sure I'll get better with minimal parts count.cheersTony