Motor Position Control

I would like some help on choosing some hardware for a project I’m working on.

I need a motor to product mechanical resistance (i.e I need the motor to always want to spring back to a known position, or better yet have that position dynamically change to a few degrees behind its current position.) At this stage I just want to make a proof of concept model so the cheaper the better.

Would someone be able to help me in what hardware I would need to create this?

Hi, and welcome here.
Sounds like a classic “racing simulator steering wheel” application? That has been done several times with simplefoc.
I’d look for an used hoverboard in your local classified ads. The motors are really strong and most of the controllers have already been hacked to run with simplefoc.

1 Like

Thanks for the great response.

I’m actually trying to create a fitness device that would replace the need for physical weights for a university project.

I haven’t thought about other similar applications like a racing simulator and that would be a great starting place for me to look. I will also look into getting a hoverboard too, would the motor and controller from this be able to be connected directly to a microcontroller like an arduino?

There are a lot of broken Hoverboards out there, but the motors themselves are typically fine. This is a good place to start, particularly as you’ll eventually need some decent torque to represent physical weights.
These hoverboards are bldc motors with 3 hall sensors on them. They’ll need a driver board to power them + an mcu. My recommendation is to avoid older 8bit controllers e.g. Arduino Uno r3 and chose a more modern mcu e.g esp32. If you go the 8bit route, then you’ll be posting messages about your code not fitting on mcu or have difficulties tuning the PID because the control loop is slow.

So you could get an esp32 + simplefoc mini + hoverboard motor. Note, you might outgrow the simplefoc mini, but it can certainly turn the hoverboard motor.

Another approach is to pair B-G431B-ESC1 with your hoverboard motor - it includes mcu and driver on same board. However you’ll need to get your head around stm32 mcu - it is also a small unforgiving board (easy to break / hard to solder).

If you just want to do a proof of concept, then I might replace the hoverboard motor with a small £20 gimbal motor (resistance ~10 ohms). They are so forgiving - it is hard to damage them or the board whilst you play and learn. They are comparatively weak though. This option is losing the hall sensors that comes with hoverboard motor, so adds its own complexity as you probably want closed loop (you’ll need to select and attach a sensor)

Decisions, decisions!

1 Like

Hey! I built what you’re trying to do. In it’s current state, SimpleFOC code cannot actively regenerate power back from the motor to an energy sink, like a resistor or battery. You’ll find that to be limiting for your use case. I recommend using something like an odrive controller for your project.

How come? Why is it not possible?

That’s what I did with a hoverboard motor and it’s original controller. It was a rowing machine. It worked quite well on my test-bench.
Now I need to build a welding-room for all the frames I’m planning to put together.

I should be more clear. I’m not sure that, in it’s current form, SimpleFOC can do active regeneration when v_bemf < v_batt. This means that if you apply as opposing torque, and eventually you cause the shaft to rotate in the opposite direction, they’ll be a region where regeneration occurs through the body diodes of the fets and motor windings, getting dumped as heat into the windings instead of boosted to v_batt and captured.

I might be off base here, but after reading about password vs active regen I came to that understanding.

Here is an example in Torque mode.
At 0A target, my power supply shows 0.188A
With 0.5A target, if I spin the motor by hand in the other directly, The minimum I see is 0.169A, so energy must be going back to my controller, but not back to my PSU fortunately.

When not recording, with my 2 hands, I could go lower than 0.120A.
Would be cool if I could use this motor as a brake for another motor.

[EDIT] Spinning it with a hoverboard, almost blowing my PSU for science lol

1 Like

I think you are confusing original poster. He doesn’t need regenerative breaking, he simply needs to apply a torque to resist user motion. I agree that motor needs to do work and could heat up, but those hoverboard motors can take 100W i expect.

I guess it would be cool if device could do regenerative breaking, but it’s certainly not required.