Go Down

Topic: Brushless hub motor arduino control (Read 6844 times) previous topic - next topic

mortonc

This is my first post so please excuse any naivety.

I would like to control 2 hub motors (those things you get on ebikes) from an Arduino (preferably uno). I need to be able to control speed, direction (forward & reverse) and brake. If it's possible to build in regenerative braking that would also be good but not a must.

I've been looking into this and the most common suggestion seems to be to buy a motor controller such as a Sabertooth but these are crazily expensive!

Is there another solution such as using an H Bridge or a load of transistors? If so what would you suggest?

Thanks in advance

nilton61

Brush-less motors need a three phase bridge to provide a three phase voltage that generates a rotating field in the three motor windings. And the voltage, frequency and phase must align to current rotor position and speed.
This is either done by hall sensors in the motor or something called sensorless driving where you measure the induced emf in the motor windings.

None of them are easy to achieve. So get a motor controller suited to your motors. That will be less expensive then spending money on motors and not be able to use them.

Also, Sabertooth is a controller for brushed motors, not suitable for brush-less motors at all

MarkT

These hub motors come with a controller - you just need to control the controller.
Reverse - you'll be lucky to find one with reverse, its not needed on a bike.

Hub motors are BLDCs with hall sensors so it isn't super-hard to build your own
3-phase bridge to drive these, but its not trivial either.  You need a 3 phase gate
driver like the FAN7388 and 6 n-channel MOSFETs with suitable ratings, protection
components and preferably a current sensor and over-current-shutdown circuit.
An Arduino can provide commutation and PWM drive.  Its not a first electronics
project however and an oscilloscope is needed I think.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

mortonc

I saw that some of them come with controllers but must say that daunted me a little. Is it possible to simply attach a PWM output to the controller in order to control it. Similarly for the brake?

What I was worried about was that it had some weird pedalling control or speed restriction, do you know if this might be the case?

If reversing's not possible using the controller, which makes sense, do you think I could attach an H bridge or something on as well?

Thank you,

Charlie

nilton61

It depends on the controller how the interfacing is to be done. Some use a potentiometer as throttle providing a control voltage to the controller. In that case you can take a pwm output from the arduino, send it through a low pass filter and on to the controller.  Other use a hall sensors. Its possible to fake these by a arduino but you have to study the design first.

Because brush-less motors are three phase motors they can be reversed by shifting two of the phases with a switch or a relay. But you must shift the sensors as well, and i believe it must be the right sensors associated with the shifted phases.

Also watch out for threads unscrewing themselves when reversing such a motor.

MarkT

You reverse a multphase motor by reversing the current, the commutation is unchanged
other than the reverse current sense to the relevant pair of windings.  You can also
think of this as 180 phase shift in the hall sensors (simply invert them all)
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

cgo

Hi,


I saw that some of them come with controllers but must say that daunted me a little. Is it possible to simply attach a PWM output to the controller in order to control it. Similarly for the brake?


That's pretty easy in fact. You need to smooth the PWM with a resistor an capacitor (forming a RC filter) for controlling the speed. You might need a operational amplifier to correct the output impedance of the RC filter.

For the direction, you can control it by inverting two phases with two relays.

smoothing pwm: http://provideyourown.com/2011/analogwrite-convert-pwm-to-voltage/

I'll try to find some schematics of how  I did this and post them here.

Enjoy,
charlot

nilton61

I'm not quite sure about the reversal. I believe you have to switch not only the motor phase sequence but also the commutation phase sequence.

michinyon


You reverse a multphase motor by reversing the current, the commutation is unchanged
other than the reverse current sense to the relevant pair of windings.  You can also
think of this as 180 phase shift in the hall sensors (simply invert them all)


To me,  both of those explanations seem odd.    The way I see it,  to make the motor run the other way,   you excite the three phases in the opposite order.

MarkT

That's true for open-loop driving, but here we have a commutation system.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

Go Up