Spinning a gimbal motor with an L298N or other basic controller?

Hi! I should say that this seems like an awesome community so I’m looking forward to hearing your thoughts and I’ve been browsing other threads. Really cool stuff.

That being said, I need to spin a brushless gimbal motor at a fixed velocity. I’ve tried a few ESC’s and nothing seems to be able to spin it. It just jitters in place and makes weird sounds (hasn’t blown yet!). I suspect that they’re not able to drive it with the voltage they’re supplying or something else is off. I could be completely off base.

I don’t need encoder feedback/FOC. I just want to spin the gimbal motor ‘infinitely’.

Does anyone know of a simple solution to this problem using an L298n or other “purchasable” brushless motor driver? Price isn’t the issue but I would like something that is easy to obtain in this market and potentially something that I could integrate onto a board later.

Any help would be appreciated! I am pretty new to this. Thank you.

Hi @spinyourightround,

You should be able to move a gimbal motor using a L298N. Check out this post: 3$ BLDC and Stepper FOC driver - L298N - #6 by Antun_Skuric

Things to note:

  • the main loop need to execute fast, you can’t call delay() or do lots of println()s in the main loop or it will interfere with the motor control
  • you need to set the pole-pairs correctly. Motor jittering about is often due to incorrect pole pairs. Small gimbal motors typically have 7 or 11 PP, but there are plenty of models with other numbers.
  • if you’re not working with a sensor, you want open-loop mode. Check our documentation for code examples.
  • set driver.voltage_power_supply, and set a driver.voltage_limit to some appropriate value. What is the resistance of your motor, and what voltage are you running at?

I think soon we’ll have your motor spinning!
Like a record, baby, right 'round, 'round, 'round :slight_smile:

Thank you! This was a lot of fun to work with. This is a great community. Very helpful! I’ve got it to spin in open-loop mode with no sensor. It’s a little bit jerky. I haven’t modified the code you linked me at all. Except to change ControlType to MotionControlType and added the setup line for the driver.voltage_limit. So no extra delays or anything in there just yet.

The motor configuration is 24N22P so I’ve set the pole pairs to 11.
Resistance for this motor is 25.6ohms.

Any ideas on smoothing it out?

(whoops, accidentally deleted it… repost here)

Hi!

There have been some other posts recently on this, I see you’ve found one of them.

It just isn’t the greatest driver, it was never intended to drive BLDCs… so short of reducing PWM frequency, tuning PID values I don’t know what to advise… you can also try adding a bit of load, if its been unloaded so far - that can change the dynamics and help smooth things out sometimes…

L298N puts out 2A continuous current. Which means for your purposes, the Mosquito board may be fully sufficient (TI8313 puts out 2.5A peak and trips at 3A).

I don’t sell those but given the recent high number of requests by people who just want to try out SimpleFOC with a simple and low cost board, I may change my mind. Problem is that this is a fully integrated board, no external MCU needed, so you need to know how to program STM32 using an external SWD.

Are you interested?

Cheers,
Valentine

Makes sense! I was glad to see that I could spin this gimbal motor. Thank you for helping. I’ve had such trouble trying to figure it out. I think maybe it’s time to graduate past the L298N that I had laying around to something with better quality.

Those specs work for me. I’m a bit worried about heat in open-loop without the giant heatsink like in the L298N. But I can add a fan or something.

What if I briefly explain my use case and timeline. My device needs very smooth rotation as I need high positional precision, so obtaining a better controller to fix this jitter is a must. I should add that this is open-loop. My motor is sensorless. I am not commanding positions. I am just spinning it infinitely but I would still like to know where it is at all times. So, I have a Teensy reading an external encoder (not directly attached to the motor housing like a 5048). I have already figured out all of the kinks with Teensy reading this encoder and also communicating to my computer effectively so I don’t want to replace it at all. If the new controller board has its own STM chip on there to enable the controller, that’s okay, I don’t mind programming that too in order to drive the motor, (as long as there are some instructions! haha).

Is this board easy to obtain? What is the delivery timeline to North America? And can it be integrated into another board that I am hoping to make?

Thank you again!

You won’t have a problem with that. TI’s 8313 (the Mosquito board) is explicitly designed to drive high precision BLDC for robotics, factory automation and camera gimbals requiring positional control.

Well, not sure what your setup is but as they say whatever floats your boat. The Mosquito board has a footprint on the back to solder high precision sensor but you can also attach any external SPI or 3-hall sensors. Or not. That’s up to you.

It does, that’s the whole idea, a fully self contained tiny SimpleFOC board. If you tell me what your motor is, I could even try to guess the parameters and pre-load an open loop SimpleFOC code to make it spin whatever speed you need, unless you want to control the speed externally with a potentiometer or something, or Serial protocol?

Well, I could use you as a guinea pig and test my instructions on you, and you get one board for free, but you have to pay for shipping, how’s that for a deal? I’ll mail you a board with USPS, I guess it’s probably a few bucks. In exchange, until I figure out how to sell this, which I’m not doing for money but for the sport, you can test my instructions and if it doesn’t work, or you burn it, toss it in the trash and you are out a postage stamp and a little bit of frustration.

Yes, I have currently a few still in the factory wrappers. Can you solder the connectors? I could either send them to you and you practice your soldering skills or I could solder the connectors for you.

Yes, I did it with the idea to be easily integrate-able. It’s got it’s own tiny MCU power supply and needs only the external power, and also you can power up and attach sensors, or even attach other external boards, it will buck up to 500mA 3.3v regulated for powering up a teensy or whatever else. You may need an external bulk capacitor though. Also I can attach a heat-sink for you if you have not done this before.

Well, let me know if you are ready to be a guinea pig. These days I’m really busy but will try to do this in my spare time. I’m west coast (Bay Area).

PM/DM me on the board if interested.

Cheers,
Valentine