0
\$\begingroup\$

I need to control 4 servos using a PLC that operates with 24V. The problem is that servos use only 5V. To accomplish this, I built a simple circuit using some 7805 and a large 1000 µF capacitor to reduce noise. It's also important to mention that the grounds of the 5V and the 24V lines are connected together.

schematic

simulate this circuit – Schematic created using CircuitLab

Here's the actual circuit:

Photo of the circuit

It's working just fine and I see no problems with the PWM signal after the 7805 (voltage levels are good and PWM cycles are all right). The reason why posting this is because I want to turn this into a custom PCB and I want to make sure that I don't print several boards with a flaw. So my question is: is the right way of doing it? I have no formal education in electronics, so I fear I'm missing something important.

Thanks!

\$\endgroup\$
4
  • \$\begingroup\$ Does this answer your question? When would I use a voltage regulator vs a voltage divider?. Although you're asking the opposite of the usual take on that... \$\endgroup\$
    – brhans
    Commented Jul 23, 2023 at 20:57
  • \$\begingroup\$ Thanks! I did see that answer when I was still trying to find the differences between a divider and it helped me understand that, in my case, a regulator would be the best choice (smoother output, electronic quieter, more robust to changes in current, etc...). But my question is indeed the opposite: did I built it right? Am I missing a component, like smaller capacitors for high frequency noise or any other important feature? \$\endgroup\$ Commented Jul 23, 2023 at 21:11
  • 3
    \$\begingroup\$ Unfortunately if your interpretation was that you should use a voltage regulator in your application, then you've misinterpreted something. You're reducing the voltage level of your PWM signal, not using your PWM to provide power to your servos. Voltage dividers would have been the correct choice here. In fact you're lucky that those 7805 regulators are working at all in the way you've used them. \$\endgroup\$
    – brhans
    Commented Jul 23, 2023 at 21:15
  • \$\begingroup\$ Thanks, @brhans! Indeed, reading more about it, I see the mistake I've make. I designed everything considering that the PWM signal would power the motors, but this is (of course) a terrible blunder. \$\endgroup\$ Commented Jul 23, 2023 at 22:17

1 Answer 1

5
\$\begingroup\$

Welcome.

I had a quick look at the datasheet of the 7805 from ST (nb: there might be other manufacturers, I didn't checked), and there is no specification of what happens when turning on and off the input voltage. It is clearly not the intended usage of a voltage regulator (which expects the input voltage to be on (with sometimes changes in voltage), and the output current to sometimes change, and manages to keep the output voltage stable in those conditions).

What you are doing, is basically turning your device on and odd several hundreds/thousands times per second: it is not what the device is meant for. If you do it slowly enough, I expect halfway acceptable results (it's nothing other that turning on and off your device). How slow, I have no idea: 1 time every 10 seconds is very likely to be fine. One millions times per seconds is probably not fine. Where the limit is, I have no idea.

If it works for you, and it is a one off project without anything at stake, you can try it if you want, but no guarantee that it will continue working. Expect problems if you increase the PWM frequency. You might also run into trouble at very low duty cycle.

So now, what would be the typical approaches:

1) Voltage divider:

schematic

simulate this circuit – Schematic created using CircuitLab

This is the simplest solution, provided you need far less current on the 5 V PWM than what the 24 V PWM can provide.

The output voltage (i.e. 5 V PWM) will be the input voltage (24 V PWM) multiplied by R1/(R1+R2). With the resistors I chose: output_max=24 V * 10k/(10k+39k) = 4.9 V.

You can chose any other pair of resistors you want, as long as the ratio gives you the right output voltage, and the current I=24 V/(R1+R2) is bellow the maximum current your 24 V PWM can provide.

Note that the current I should be at least 10 times the current needed by the 5 V PWM (otherwise the voltage will be smaller than expected).

2) Zener diode + resistor.

schematic

simulate this circuit

We replace the lower resistor by a Zener diode (conducting with a fixed voltage, in this case 4.7 V, or blocked): the resistor limits the current (otherwise it's a short circuit).

This solution is more robust if your 24 V varies a lot, as the output voltage don't depends on the exact input voltage.

3) The power solutions:

If you expect to need to provide "significant" current to the 5 V PWM (more than the 2 solutions above, which are "signal only" solutions), then you will have to use transistors of one kind or another (or other integrated circuits). I will not expand on this option for now, as I don't think it's needed (and explanations are a bit more complex), but if you think you need >0.1 mA current, then just ask, and I will expand.

I would suggest you try solution 1 first (as you likely have already some resistors)

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Thanks! I did try the voltage divider solution before going for the voltage regulator (I used a 330Ω and a 100Ω resistors and it did work. The only reason why I went to the voltage regulator is because I thought that the voltage would vary frequently, but you just made me realise that it won't, as this is just a PWM signal and power is coming through a separate line. \$\endgroup\$ Commented Jul 23, 2023 at 22:13
  • 1
    \$\begingroup\$ And no, the 24V source is pretty stable. Now that you explained it clearly, I think that even a Zener diode is too much! \$\endgroup\$ Commented Jul 23, 2023 at 22:14
  • \$\begingroup\$ I hope your 24V PWM is capable to provide some current. 24/(100+330)=56mA : more than what most signal pins can safely provide. Also, your output voltage should now be around 24*100/(100+330)=5.6V, check that it isn't too much for your servos (or replace the 330Ω resistor by a 390Ω resistor) \$\endgroup\$
    – Sandro
    Commented Jul 24, 2023 at 10:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.