Reducing a 12 V signal to TTL levels via a 2N2222

Thread Starter

Kjhall

Joined Dec 12, 2023
33
I am working on a circuit that uses inductive proximity switches that will ultimately feed an IC chip. The output from the prox will be 0-12 VDC, and of course, the Logic circuits need TTL levels to function or will make smoke.
What problems do you see with this design? I will have 9 identical circuits. Any suggestions will be greatly appreciated.Prox sw translator.jpg
 

Sensacell

Joined Jun 19, 2012
3,448
Make R26 300K and flip it around so that it forms a divider, add a 1N4148 diode across R25- now it's bulletproof and noise immune.

You want the threshold to be around 6 Volts.
 

Hymie

Joined Mar 30, 2018
1,284
Why not use two resistors to divide the 12V proximity switch output to 5V, using less components and being inherently more reliable?
 

LesJones

Joined Jan 8, 2017
4,190
Yet another solution is the have a pull up resitor to the 5 volt logic supply from the logic input and have a diode between the logic input and the 0 -12 output of the sensor. (Cathode end to the sensor.) This assumes that the sensor can pull down. (I.E it's output does not just look like an NO contact to +12 volts.)

Les.
 

jiggermole

Joined Jul 29, 2016
161
most of your industrial inductive proximity switches are a sourcing transistor output. It could be a transistor pull up to +rail or it could be a totem pole push pull. I've seen both. On the switch it should give you a max current draw and i've seen 10mA or so. Using the voltage divider would probably work just fine. Just have to get the voltage on the pin above the point of triggering.
The other options of using a transistors above will work as well.
My brain heads to using an opto-isolator, or a level shifter. Just doing a quick search and a level shifter probably isn't the way to go. The optoisolator though, would work just fine. It is also adding something else to fail in the circuit though.
 

crutschow

Joined Mar 14, 2008
34,450
Actual TTL levels have a specific voltage and current requirement for bipolar TTL circuits.
Do you have that for the IC load, or just need 5V signals for CMOS logic?
 

sghioto

Joined Dec 31, 2017
5,390
Any suggestions will be greatly appreciated.
I don't see a problem with the design as drawn assuming that's an inverting buffer to maintain polarity if required.
R25 can be eliminated unless the proximity switch requires a minimum load.
1704210617265.png
 
Last edited:

ericgibbs

Joined Jan 29, 2010
18,849
Hi,
This option in non inverting.
E

EDIT:
Image deleted, due to error in Lower TTL threshold.
 
Last edited:

dl324

Joined Mar 30, 2015
16,922
the Logic circuits need TTL levels to function or will make smoke.
What problems do you see with this design? I will have 9 identical circuits. Any suggestions will be greatly appreciated.
CD4049 and CD4050 can be used for high to low logic level conversions.
1704213160117.png
 
Last edited:

MrChips

Joined Oct 2, 2009
30,808
You don't need active level shifters. Two resistors and a diode will do it.
Or you can get level shifter ICs, for example CD4504 shifts from any voltage Vcc to Vdd.
 

AnalogKid

Joined Aug 1, 2013
11,044
Why not use two resistors to divide the 12V proximity switch output to 5V, using less components and being inherently more reliable?
Better still - one series resistor and one 5.1 V zener diode. Now you have bipolar transient protection, over-voltage protection, plus reverse-polarity protection.

What is the output current sourcing capability of the sensor?

ak
 

Thread Starter

Kjhall

Joined Dec 12, 2023
33
Actual TTL levels have a specific voltage and current requirement for bipolar TTL circuits.
Do you have that for the IC load, or just need 5V signals for CMOS logic?
I am working on a circuit that uses inductive proximity switches that will ultimately feed an IC chip. The output from the prox will be 0-12 VDC, and of course, the Logic circuits need TTL levels to function or will make smoke.
What problems do you see with this design? I will have 9 identical circuits. Any suggestions will be greatly appreciated.View attachment 311495
Just needed to expand this with more detail A further explanation of my reason for the question:
This is certainly not an area of my expertise, just enough for me to be dangerous.

I have 8 similar circuits. Three will be feeding breakout board (BOB)inputs. I had a problem in the past when I used Optical isolators in place of the mechanical switches, optical isolators could not transition the signal to ground when activated, I ended up installing a transistor with the base connected to the optical isolator output, the collector connected to the input of the BOB and the emitter to ground. This solved the problem. The BOB inputs were about 12-13 Volts and I think that at that point they were connected to optical isolators in the BOB circuitry.

I have rebuilt my entire CNC and am in the process of updating my electronics. I decided to go to the proximity switches (SN04N)for numerous reasons and realized that one concern was the 10-30 VDC source to the proximity switch and corresponding output, and the inputs I needed for the BOB and the overtravel limit switches I wrote an Arduino sketch for accommodate the stepper enable, e-stop and recovery of an overtravel.

3 of the proximity switches could probably be directly connected to the BOB inputs (if I stick with the 12VDC), I don't think the floating level of voltage from the switch or the BOB will matter until the switch is triggered. Looks like the proximity switch just turns on a transistor that ties the output to the ground, probably about .5 VDC.

5 proximity switches level need to be at TTL 7404 and/or 7414(inputs to Arduino NANO) In my previous design (with mechanical switches)I used a noise filtering circuit on the switches then inputted that into the 7404 and then the Schmidt triggered invertor to reduce the noise interference. (I have a VFD that generates some EMI nearby so the noise cancellation was necessary) The uno did not like the noise. I needed the inputs to the NANO to follow the trigger, thus two invertors. Sure I could have done it differently, but that was where my mind was at the time.

I just figured if I Had to do 5 of the eight, why not just do all of them and have identical circuits to T/S if it became necessary? I could have used a voltage divider but it would have to be for a specific voltage, and I was not sure if I wanted to be stuck at the 12VDC level thinking that if needed I could go to the higher voltage for whatever reason I had.

I currently have available the following source voltages: 3.3, 5, 12, 24-40, and 48. All have sufficient capacity to provide for this adaptation.

I hope I am not too wordy. I just thought that I should answer as many questions here as possible to help with any suggestions being offered. Some of which are possibly the route I will go. This additional information may create alternatives for me to learn from. Thanks again.
 

MrChips

Joined Oct 2, 2009
30,808
Good to know that this is for a CNC machine.

Limit switches are usually mechanical switches with 12V feeds. These are usually fed to controller boards that already use opto-couplers as inputs. Hence any level shifting is already accomplished.
 

Thread Starter

Kjhall

Joined Dec 12, 2023
33
Good to know that this is for a CNC machine.

Limit switches are usually mechanical switches with 12V feeds. These are usually fed to controller boards that already use opto-couplers as inputs. Hence any level shifting is already accomplished.
So the three switches are most likely good to go, but the other five still need switching to 5 volt logic.
 

Thread Starter

Kjhall

Joined Dec 12, 2023
33
Yet another solution is the have a pull up resitor to the 5 volt logic supply from the logic input and have a diode between the logic input and the 0 -12 output of the sensor. (Cathode end to the sensor.) This assumes that the sensor can pull down. (I.E it's output does not just look like an NO contact to +12 volts.)

Les.
I have never played with prox switches, so I do not know if it really will pull down, I am expecting to see 0, or close to 0, when triggered. I expect to see Vdd or close to it when not triggered.
I wanted an active circuit to allow me the option of what prox voltage I would ultimately use. I am not sure I will stay with the 12VDC, can go up to 30VDC. Maybe just overthinking it.
 

Thread Starter

Kjhall

Joined Dec 12, 2023
33
most of your industrial inductive proximity switches are a sourcing transistor output. It could be a transistor pull up to +rail or it could be a totem pole push pull. I've seen both. On the switch it should give you a max current draw and i've seen 10mA or so. Using the voltage divider would probably work just fine. Just have to get the voltage on the pin above the point of triggering.
The other options of using a transistors above will work as well.
My brain heads to using an opto-isolator, or a level shifter. Just doing a quick search and a level shifter probably isn't the way to go. The optoisolator though, would work just fine. It is also adding something else to fail in the circuit though.
Yes, I leaned toward the opto-isolator in my earlier thinking, still a possibility. Make make the Arduino input circuit cleaner as well.
 

MrChips

Joined Oct 2, 2009
30,808
Use opto-isolators. You can use whatever voltages on the input side and the output side independently, i.e. 12V on the input and 5V on the output.
 
Top