Author Topic: 5V+ -> 24V Logic Level Translator Simulation Question  (Read 595 times)

0 Members and 1 Guest are viewing this topic.

Offline hboyp0805Topic starter

  • Newbie
  • Posts: 1
  • Country: us
5V+ -> 24V Logic Level Translator Simulation Question
« on: January 22, 2021, 09:20:36 pm »
Hello, I'm creating a logic level translator to communicate between our PC an an external pneumatic system. The pneumatic system operates of 24V logic, and I'm using a 5V uController.


The circuit on the left is the current model I have working, and I recently discovered from the person who has the system that there is an LED that the digital line controls (thanks remote work for not letting me see this myself haha). I'm not able to take apart the system due to it's design, and I can only assume the LED is wired in series with the digital input(Digital input is represented by the output node).


My friend is telling me that this doesn't matter and the systems fine, but I'm under the impression that would create a voltage divider in the left circuit, and therefore we would not obtain proper logic levels.


I considered switching to low side switching to avoid this issue as shown in the right circuit, but it according to the simulation that causes issues as well and I'm not achieving 24V output. Could anyone point me in the right direction as to why this doesn't work or what I'm doing incorrectly here?


Thank you very much in advance, I really appreciate any help :)


Please see the two attached screenshots, the first is of the left circuits values, and the second is of the right circuits values. Please note that the FETs and Diodes are not the actual models used in the final circuit.


Link: https://imgur.com/a/BOMVnvP
 

Offline gnuarm

  • Super Contributor
  • ***
  • Posts: 2218
  • Country: pr
Re: 5V+ -> 24V Logic Level Translator Simulation Question
« Reply #1 on: January 22, 2021, 11:40:51 pm »
This is hard to address. What you need is not completely clear and your terminology is not clear. 

What you are calling high side switching is not "high" side switching.  It is a low side switch on the R1 resistor with a lower impedance load... which won't work.  High side switching would be if you put the FET where R1 is and removed R1 from the equation which is pretty much what you have with the right side schematic.  Remove R5 (doing very little) and the right hand circuit is a high side switch... that would not work because the controlling input is only 3.3V.  Whatever the switching threshold of the n-FET is, that would be subtracted from the 3.3V gate voltage to appear on the source output.  So  nowhere near 24V.  Pull the gate up to 28V and you will see pretty much the full 24V on the source. 

To use a high side switch you need to use a p-FET.  A resistor is needed to pull the gate high and the n-FET in the left hand circuit you currently have is used to drive the gate of the p-FET low.  That will work the champ, but I would pick another part, 2N7002 is good with a threshold about 2.0V. 

A low side switch would be if the 24V supply were connected directly to the input and an n-FET were in the ground leg of the pneumatic system.  If that "system" has anything other than a single 24 V solenoid coil on the circuit, a low side switch would activate all the relays.  So a high side switch it is, but a proper high side switch! 

You will most likely need to add a diode across the relay coil to absorb the inductive "kick-back" when turning it off.  This voltage can get very high and destroy the transistor.  Do you know the current of the coil?  That's the current the diode will need to handle. 
Rick C.  --  Puerto Rico is not a country... It's part of the USA
  - Get 1,000 miles of free Supercharging
  - Tesla referral code - https://ts.la/richard11209
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: 5V+ -> 24V Logic Level Translator Simulation Question
« Reply #2 on: January 23, 2021, 12:19:55 am »
I'm just going to focus on the left hand circuit (because I, too, cannot understand what your broader situation is.)

You are hoping that when the MOSFET is off, Output will rise to 24V. However, if you pretend that it's off (i.e., remove it from the circuit entirely), you'll find that the Output line has a 10k resistor pulling it high, but a 1k resistor (and an LED) pulling it low. If the LED were shorted out, that'd make a voltage divider delivering 2.18 Volts; with the 2.4V drop of the LED added in, that gives the 4~5 volts that you're seeing.

That's why the simulation shows a 4~5 Volt output. You could raise that output voltage in the simulation by increasing R2 (because 20mA is a lot for a modern LED) and/or reducing R1.



Moving over to the right hand side circuit, that circuit is just wrong. Did you mean to implement high side switching, like on this recent forum post? The "current model" on the left is already low side switching.



Does R3 represent a relay coil, or a high impedance digital IC input?
 

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1109
  • Country: lt
Re: 5V+ -> 24V Logic Level Translator Simulation Question
« Reply #3 on: January 23, 2021, 12:32:27 am »
Generally, this is not how things are done. You are guessing and making assumptions. From your post, I understand, that you know very little about the 24V signal input. Is it a solenoid, relay or is it a high impedance logical input? Someone should give you some documentation of the device or at least take a multimeter and measure how much current this input sinks when you apply +24. Maybe there is pullup on the input (it is possible)? What is the voltage of this input, when it is not driven and left floating? Maybe a pulldown? What is DC resistance of this input?

If you really need to do this blindly, then I guess go with half-bridge output. Possibly you may use an isolated gate driver for that. There are some which are high voltage, like 35V. You will get quite powerfull sink-source 24V logic output and also some protection for MCU (galvanic isolation).
 

Offline gnuarm

  • Super Contributor
  • ***
  • Posts: 2218
  • Country: pr
Re: 5V+ -> 24V Logic Level Translator Simulation Question
« Reply #4 on: January 23, 2021, 01:26:33 am »
As Manul says, you should take measurements on the input to see if it is a solenoid coil or not (which I'm almost certain it is, but not perfectly certain).  It could already have a driver built in.  So measure the resistance.  I expect it to be under 1 kohm.  It might be important to know the current drawn if it is higher than expected. 

If it is indeed a solenoid, here is a driving circuit.  Since your power supply is 24V.... btw, is that DC or AC?  Most such systems are made to work with AC and relays.   Anyway, for a DC system the p-FET will need to be sized for the current and the voltage.  Check the voltage gate-source.  This is typically less than the drain-source voltage.  That's why I used R3, to reduce the voltage the gate will see. 

Let us know how it goes.
Rick C.  --  Puerto Rico is not a country... It's part of the USA
  - Get 1,000 miles of free Supercharging
  - Tesla referral code - https://ts.la/richard11209
 

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1146
  • Country: ru
Re: 5V+ -> 24V Logic Level Translator Simulation Question
« Reply #5 on: January 24, 2021, 06:00:49 pm »
The simplest solution is to use an optocoupler, also called a solid-state DC relay.
For example: https://lcsc.com/product-detail/Solid-State-Relays_Cosmo-Electronics-KAQY212A_C194713.html
And sorry for my English.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf