cancel
Showing results for 
Search instead for 
Did you mean: 

Advice on translation for Servo motor control

ESpra.1
Senior

I'm working on a project involving a 5V servo motor with a 3V3 MCU, and I wanted to get some advice on how best to translate the PWM output from the 3V3 MCU to the 5V servo motor. I made the mistake of initially just using a MOSFET that was controlled by the PWM signal, and while the code seems to work, the signal obviously is all wonky.

Right now, the main option I'm considering is a level shifter like an NVT2010,118 (probably something with fewer channels), since I need to level shift some I2C lines anyway, but I wanted to get a second or third opinion on that, and maybe other options I could consider

edit: it occurs to me I should have asked this elsewhere. Apologies for the mistake

1 ACCEPTED SOLUTION

Accepted Solutions

Forgot to mention: table 20 of the data sheet lists the pin functions, e.g. I/O structure FT = Five Volt Tolerant.

Details about the 5-Volt-tolerant GPIOs can be found in RM0438, e.g. in figure 38.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

7 REPLIES 7
Peter BENSCH
ST Employee

The servo motor topic already fits into the STM32 category, because you only have to generate a PWM signal according to whose ratio the rotation angle of the servo is set.

Typically, the frequency of the PWM signal is not particularly high, so you don't necessarily have to use a level shifter. Even a 5V-tolerant output of the STM32 should be able to drive this by setting the relevant GPIO to open-drain and connecting an external pull-up of approx 1...2kOhm, possibly even the internal pull-up of the GPIO is sufficient.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Well, that's good to know. I've actually been trying to determine which pins on the microcontroller I'm using (STM32L552ZET6Q) are 5V tolerant, but I can't find it in the datasheet so far. Are they all 5V tolerant, or is there a list of which specific ones are?

My previous statement was not entirely correct, because you must disable the internal pull-up and use an external pull-up when connecting a 5V component to a 5V-tolerant pin in order not to create an injected current at that GPIO pin.

The list of 5V-tolerant pins of the STM32L552ZE can be found in the data sheet, table 21.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Forgot to mention: table 20 of the data sheet lists the pin functions, e.g. I/O structure FT = Five Volt Tolerant.

Details about the 5-Volt-tolerant GPIOs can be found in RM0438, e.g. in figure 38.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks for the info!

You're welcome!

If the problem is solved, please mark this thread as answered by selecting Select as best, as also explained here. This will help other users find that answer faster.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Does it need conversion?

The Servo can be powered via 5V supply, with adequate current sourcing.

Does the signalling need to be? What's the VIL/VIH expectations of the 50 Hz (20ms) signals with 1-2 ms pulse width?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..