Yes, it's a follow. I just want to make sure if resistors values are okay for the design and if the circuit is reliable.Looks like a follow on of this post.
https://forum.allaboutcircuits.com/threads/active-high-vs-active-low-logic-optocouplers.147852/
I would also consider a mosfet, 2n7000 for e.g.
Max.
I need 24V to drive stepper motors drivers. They need 24V signal, so I need to convert my FPGA TTL output to that voltage levelWhat are you trying to do? What current are you switching, what is the load?
if it is just switch a 24V load with a 5V signal, a logic level FET and a couple of resistors are all you need.
Is electrical isolation needed?
This may help...
https://forum.arduino.cc/index.php?topic=61308.0
I will replace the 2n3904 with a MOSFET 2n7000.Looks like a follow on of this post.
https://forum.allaboutcircuits.com/threads/active-high-vs-active-low-logic-optocouplers.147852/
I would also consider a mosfet, 2n7000 for e.g.
Max.

"R2 and R3 will affect the turn on time and the input frequency", but will affect it drastically? Does it happen only if I use a PNP transistor? I don't want my parameters to be affected as I will driving steppers motors signals.Please don't try to use the low level as the active signal then it will occurs can't predictable result during the system at the initial time, the Vgs setup to close to 12V when the MOSFET is turn on.
The P MOSFET can be replaced by use a PNP as 2N2906, and the R2=4.7K, the values of R2 and R3 will affect the turn on time and the input frequency.
View attachment 150719
All the BJTs and MOSFETs will be affected by R2 and R3, you don't have to worry too much about that and you just need to set up the values to works, when it can't be works in any frequency and then you need to adjust the values, if the value more lower then the working frequency will be more higher, but the draw current will be more higher."R2 and R3 will affect the turn on time and the input frequency", but will affect it drastically? Does it happen only if I use a PNP transistor? I don't want my parameters to be affected as I will driving steppers motors signals.
I'm not sure right now about the specific frequency. All I know for know is that frequency won't be higher than 100 kHz. You told me above not to try to use the low level as the active signal. That got my wires crossed because the tech support of the FPGA Card 5i22 (that I'm using), they told me not to use active high because it's not reliable and by using active low signal I guarantee outputs are off at startup from a hardware standpoint. Maybe he's wrong.All the BJTs and MOSFETs will be affected by R2 and R3, you don't have to worry too much about that and you just need to set up the values to works, when it can't be works in any frequency and then you need to adjust the values, if the value more lower then the working frequency will be more higher, but the draw current will be more higher.
How high of the frequency that you trying to use?
1. The 24V is simply a signal input to an actual driver. It's not going to drive the stepper directly.Let's back up.
- Is the 24 volt signal going to drive the stepper motor directly or is it simply a signal input to an actual driver?
- Is there some data available on the driver if that is what is being used?
- If it is to drive the motors directly, what current is required?
- Mention has been made of 100 kHz. What is that for? Even a microstepping controller would not require anything that fast. There is no chance of getting 100 kHz through an ordinary coupler without access to the base of the photo transistor. There are suitable couplers.
- Is there a need for isolation? Isolation can be very useful in managing ground currents in some situations, but if it just for level shifting it isn't necessary.
Returning to the original circuit: It does need a base-emitter resistor on the transistor to prevent leakage current problems. If the output is to go to a signal input that requires just a small current, all the resistor values could be changed to reduce power consumption and improve long-term reliability.
"Maybe he's wrong." He is not.wrong.
Using low level as input active signal was designed by the hardware of 5i22, so probably you can't change it.I'm not sure right now about the specific frequency. All I know for know is that frequency won't be higher than 100 kHz. You told me above not to try to use the low level as the active signal. That got my wires crossed because the tech support of the FPGA Card 5i22 (that I'm using), they told me not to use active high because it's not reliable and by using active low signal I guarantee outputs are off at startup from a hardware standpoint. Maybe he's wrong.