Converting a hubmotor to a middrivemotor

Discussions related to motors other than hub motors.
This includes R/C motors, botttom bracket, roller and geared drives.
User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 21 2016 7:15am

i just read through the hall sensor positioning manual crossbreak posted. really nice stuff.
after doing all the math it just showed that the halls need to be positioned 3 slots apart, what they already are. it may be that the distance between them is not 100% exact, but i can't really imagine that.
so i can just do some timing advance to compensate for hall sensor lag and hysteresis. if the kelly controller would be a real FOC controller it would not relate on halls and measure back EMF, which is doesn't seem to do.
i will make a custom hall board that can be moved around and fixed to the motor and do some more testing.

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

no load current of mac 6T

Post by izeman » Jan 22 2016 3:04pm

crossbreak, i know you're always interested in no load current of different motors. so i did a measurement with my MAC 6T turning up to 2.800rpm @43,5v sagged. so this is a 64kV motor from my measurement - you claim 69kV in the wiki. so quite similar. this is motor only. no gears, no case. only stator and yoke.
the kelly sine wave is NOT able to do proper hall sensing. so measurement is somehow wrong. you can see that no-load current goes up very linear up to 2.800rpm. this is with the old 0.5mm lams.
the red line is the somehow weird sine wave, and the blue one the trapezoid kelly.
kelly comparison.JPG
kelly comparison.JPG (27.52 KiB) Viewed 1967 times

User avatar
fechter   100 GW

100 GW
Posts: 12907
Joined: Dec 31 2006 3:23pm
Location: California Bay Area, USA

Re: Converting a hubmotor to a middrivemotor

Post by fechter » Jan 22 2016 7:37pm

Check out this thread from years ago on BMC timing:
https://endless-sphere.com/forums/viewt ... lit=timing

This is the scooter version of the motor like mine, but the winding and hall configuration is the same.
"One test is worth a thousand opinions"

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 23 2016 10:42am

thank fechter. exactly what i was looking for. i just didn't search for bmc, and not 5 years back.
this confirms that the mac's timing is somehow weird. finally i got this information confirmed.
so what i did: i milled slots 4x4x2mm into the stator to try different hall positions.
the good news: the controller's self teaching feature works for the very first time now relyiably.
i just can't get halls recognized in the standard position.
but the difference between different positions is minimal. so it seems the controller compensates for that.
still the halls directly in the middle of one tooth seems to be the best by 5-10% depending on rpm.
i will need to do the tests with a kelly trapezoid controller to compare.
Capture.JPG
Capture.JPG (26.86 KiB) Viewed 1913 times

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 24 2016 10:09am

i did cut some new grooves into the "new" 0.3 lam MAC as well. i hope i did it on the right side, and in the right position :) we'll see how it performs.
IMG_0392.JPG
IMG_0392.JPG (98.95 KiB) Viewed 1907 times

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 24 2016 10:10am

@crossbreak: i hope it's ok to post my findings here. just let me know please, as it's not 100% related to mid drive. but it's not really OT as well ;)

User avatar
amberwolf   100 GW

100 GW
Posts: 25122
Joined: Aug 17 2009 6:43am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by amberwolf » Jan 24 2016 6:02pm

izeman wrote:i did cut some new grooves into the "new" 0.3 lam MAC as well.
IMG_0392.JPG
Keep in mind that doing that shorts the laminations together wherever the metal gets pushed across the lamination edges in each "groove".

So all of those laminations may be shorted together on the hall side of the motor. I don't know exactly how that affects the eddy currents and whatnot, in these cases; I'm sure it's not as bad as having laminations as thick as the shorted area, but I expect it does cause something to happen. I wonder if the effect is measurable in a before-and-after test of some type?

User avatar
crossbreak   100 MW

100 MW
Posts: 2801
Joined: Aug 02 2011 11:20am
Location: Germany
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by crossbreak » Jan 25 2016 1:45am

This is 100% OT (on topic :)). Doesnt matter if the lams are shorted somewhere. The edd current circles act only locally. I have seen stacks that were welded at multiple edges which did not affect core loss IMO. The old tonxin had this for example. Maybe you still remember, amberwolf? Maybe I can dig out an old pic...not sure if I made a shot of that

How did you make these pockets, iceman? End mill? I'd like to try that.. Looks like a quick and simple solution to a complicated problem!!

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 25 2016 4:09am

i thought about shorting the lams as well. the MAY be shorted, but may not as well. i can test it if you like. i still can't say if there is some measureable influence.
making those slots was easy and quick. i mounted the stator in a wise. there where two big round spacers positioned on the stator center that i did clamp to, because you can't clamp the windings ;). then i used a 4mm milling cutter to make 4mm x 4mm wide slots, 1.5mm deep. 5min epoxy to hold the whole hall board in place. was a 10min job.
but the first results where not good. it seems the slots are WAY to far off. i will need to make them closer to it's original position.
reminder to myself: the yoke is turning CCW when looked from above and over the stator.

btw: fechter calculated the halls to move 3.75° (mechanical degrees) back, as the timing of the BMC motor is advanced. so CCW in my case.
stator diameter 135mm, gives a circumfence of 424mm. which is 1,18mm / ° or 4,4mm movement CCW, so more or less one width of a hall sensor. (this is the same calculation the fechter already did in the posted thread. i just repeated it to exclude calculation error, and used my own measurements. getting the same result gives me confidence ;).)

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 26 2016 4:24am

hmmm. something doesn't work as expected with the new hall positioning.
good thing first: with the slight offset (4mm), and even with the massive offset (10mm) the kelly sine wave controller finishes auto-config EVERY time without issues. this is working perfectly fine, whereas it is IMPOSSIBLE to do it with the halls at their original position. it just ain't work.
bad thing: it's not running properly. it stutters a lot. it's like a highly oscillating throttle, or accelerating, braking, accelerating ... this behaviour happens with both kelly controllers, but not with the sensorless infineon.
i will have to see if this is an issue with this particular motor (0.3mm lam 8T), as i think i can remember that it did work with the old 0.5mm 6T motor.
more testing to be done ...

User avatar
fechter   100 GW

100 GW
Posts: 12907
Joined: Dec 31 2006 3:23pm
Location: California Bay Area, USA

Re: Converting a hubmotor to a middrivemotor

Post by fechter » Jan 26 2016 9:13am

One method to find the hall locations is to apply constant current to a random pair of phase wires so the rotor lines up with the active stator poles. Once the rotor finds home, one of the hall sensors should be right at the switching point. You could then adjust the hall position so it toggles when the rotor is slightly wiggled. Then pick another pair of phase wires and verify the other halls. This should be the exact spot.

I haven't tried this, but it should be fairly obvious which hall is closest to the toggle point. Setting the halls on this spot will give neutral timing.
In therory, it should be possible to know which hall is supposed to be at the trigger point based on which phase wires are energized.

The constant current needs to be enough to line up the rotor, but not so much that the motor overheats quickly. I'd guess around 5A. For lack of a bench power supply, some big light bulbs in series with a charger or pack might work.

On the Kelly, it sounds like it's trying to do a constant RPM but the feedback loop has too much gain and it's overshooting. If this is happening with no load, it might go away under load. If there are programmable settings, one of them may need tweaking. If you have a choice of speed command vs. torque command, you could try changing that.
"One test is worth a thousand opinions"

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 26 2016 9:43am

thanks a lot fechter. that's cool information. i will try do test some more.
weird global warming makes our winter season warmer than we're used to. it's 10C+ at the moment. i guess i will need to finish that motor soon as bike season may start earlier than expected ;)

attached is a screenshot of the PID settings. unfortunately i have no real idea what to change. i changed that from one extreme to the other to see how/what changes, but couldn't see much difference.
Capture.JPG
Capture.JPG (11.79 KiB) Viewed 1817 times

User avatar
crossbreak   100 MW

100 MW
Posts: 2801
Joined: Aug 02 2011 11:20am
Location: Germany
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by crossbreak » Jan 26 2016 2:29pm

izeman wrote:it's like a highly oscillating throttle, or accelerating, braking, accelerating ... this behaviour happens with both kelly controllers
but it did work fine with the KBS-X with original hall position. At least with my MAC it does

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 27 2016 4:16am

Yes it did. It seems to be some issue with this special motor. It doesn't matter where i position the halls. The motor behaves exactly the same. And that is with both Kellys. Old and new. Auto config works flawlessly with ALL hall positions but the original one!!!
I did the same procedure with and old 8T MAC and all works fine. Maybe i got some winding issues with the new MAC.

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 27 2016 4:47am

@fechter: i did the hall position procedure you proposed. Lab power supply with 3A made the rotor snap to a position where i could be moved by hand.
When i moved the halls by 4mm CCW and observed the hall switching this was 100% spot on. Moving the stator a tiny little bit made then all toggle. So fechter you're 100% correct that moving the halls by 4mm gives neutral timing.

User avatar
fechter   100 GW

100 GW
Posts: 12907
Joined: Dec 31 2006 3:23pm
Location: California Bay Area, USA

Re: Converting a hubmotor to a middrivemotor

Post by fechter » Jan 27 2016 8:05pm

izeman wrote:@fechter: i did the hall position procedure you proposed. Lab power supply with 3A made the rotor snap to a position where i could be moved by hand.
When i moved the halls by 4mm CCW and observed the hall switching this was 100% spot on. Moving the stator a tiny little bit made then all toggle. So fechter you're 100% correct that moving the halls by 4mm gives neutral timing.
Great work. I never had occasion to try it myself. In theory, this could also be used to map out the proper hall/phase wiring on a typical controller without trial-and-error but I don't know the exact sequence.

Those PID parameters in the Kelly programming will definitely fix the oscillation problem if you can figure out what settings to use. There are some articles on PID tuning on the web, but most of them were over my head.

From https://endless-sphere.com/forums/viewt ... 4#p1145464
Kp and Ki values are used in the PID to control overshoot and oscillations. If they're too high=oscillations, if they're too low=slow response.
"One test is worth a thousand opinions"

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 28 2016 3:50am

fechter wrote:Those PID parameters in the Kelly programming will definitely fix the oscillation problem if you can figure out what settings to use. There are some articles on PID tuning on the web, but most of them were over my head.
From https://endless-sphere.com/forums/viewt ... 4#p1145464
Kp and Ki values are used in the PID to control overshoot and oscillations. If they're too high=oscillations, if they're too low=slow response.
thanks. in theory i understand how PID controllers should work (from flying quadcopters which need a lot of different PID tuning). but i have NO idea how kelly implemented that feature, and it's missing the setting for derivative factor - but maybe this should be the "speed err limit" and is just not called KD ;). however i hope it can be done.

from the manual:

Code: Select all

Torque Speed KP: Speed Percent Kp in Torque Mode. Range: 0~10000 Factory set is 3000
Torque Speed KI: Speed Integral Ki in Torque Mode. Range: 0~500 Factory set is 80
Speed Err Limit: Speed Error Limit in Torque Mode. Range: 50~4000 Factory set is 1000

These three parameters are used for PID adjustment.
If you think the acceleration performance is very very strong, please adjust them to a lower value respectively.
though the motor/controller combination has this strange effect that letting the throttle go from WOT, running at full rpm, the rpm SHOOTS UP for the blink if an eye, HIGHER then full rpm and then starts to settle down. i can't find an explanation for that effect.

User avatar
madin88   100 MW

100 MW
Posts: 2760
Joined: May 27 2013 2:02am
Location: Austria

Re: Converting a hubmotor to a middrivemotor

Post by madin88 » Jan 28 2016 1:32pm

izeman wrote: though the motor/controller combination has this strange effect that letting the throttle go from WOT, running at full rpm, the rpm SHOOTS UP for the blink if an eye, HIGHER then full rpm and then starts to settle down. i can't find an explanation for that effect.
the adaptto unit does the same if the hall angle and timings are not set properly, and iirc it also behaves like this if i have higher values of field weakening enabled.

btw: this week i have gotten an eZee 350RPM motor (6T i believe) which i bought from ebikes.ca garage sale.
it's stator and rotor design is identical to the MAC's (only not so wide from what i know) but guess what, after taking off the sidecover it looks like the halls are placed differnt^^
tomorrow i will take it completely apart and remove the rotor so that i can see the position better. will definitely shoot some pics and post them here!
- 10kW belt drive with Neumotor 8057: viewtopic.php?f=30&t=91144&start=50#p1377787
- Fully road legal (L1E approval) e-bike based on Votec V-FR frame
/ MXUS 3T / 17" Mitas MC11 / Adaptto Max-E / 20s12p 25R
- KTM Hardtail Pedelec / eZee V2 6T / 27,5" / Kelly KBSX @ 1,5kW / Torque PAS / CA-V3 / 13s4p Sanyo GA in Shark case

User avatar
fechter   100 GW

100 GW
Posts: 12907
Joined: Dec 31 2006 3:23pm
Location: California Bay Area, USA

Re: Converting a hubmotor to a middrivemotor

Post by fechter » Jan 28 2016 10:40pm

Wild guess, I'd try lowering the Kp and Ki values and increase the speed err limit. If there's enough range, it should be possible to make the motor respond very slowly to changes in throttle.
"One test is worth a thousand opinions"

User avatar
madin88   100 MW

100 MW
Posts: 2760
Joined: May 27 2013 2:02am
Location: Austria

Re: Converting a hubmotor to a middrivemotor

Post by madin88 » Jan 29 2016 10:54am

unfortunately i was not able to take the rotor off because on eZee motors this isn't as easy as it is with the MAC.
but i took some closer pics of the halls. they are shifted about 3-4mm counterclockwise (in the direction it spins). thats a positive timing or pre-ignintion.

Image

Image

Image
- 10kW belt drive with Neumotor 8057: viewtopic.php?f=30&t=91144&start=50#p1377787
- Fully road legal (L1E approval) e-bike based on Votec V-FR frame
/ MXUS 3T / 17" Mitas MC11 / Adaptto Max-E / 20s12p 25R
- KTM Hardtail Pedelec / eZee V2 6T / 27,5" / Kelly KBSX @ 1,5kW / Torque PAS / CA-V3 / 13s4p Sanyo GA in Shark case

User avatar
izeman   10 GW

10 GW
Posts: 4690
Joined: Jun 21 2011 8:25am
Location: vienna, austria
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by izeman » Jan 29 2016 12:01pm

thanks maddin. that's exactly where i positioned them. so there must be something about it :)
i will post pictures of my mod soon. i did not cut the stator and glued the halls on top of it. if it doesn't work i can still mod the stator.

Altair   100 W

100 W
Posts: 267
Joined: May 03 2014 10:35am
Location: Quebec, Canada

Re: Converting a hubmotor to a middrivemotor

Post by Altair » Feb 16 2016 12:07pm

Very interesting posts, guys, reviving this thread.
I also converted a 12t MAC motor for my build, and I'm running it with the Adaptto controller.

Madin, you wrote about the halls: "they are shifted about 3-4mm counterclockwise (in the direction it spins). thats a positive timing or pre-ignintion."
Technically, with the motor viewed from the stator side, it spins counterclockwise, and the halls are shifted clockwise, giving timing advance, is that what you meant? :)

With my Halls right in the slots, the Adaptto didn't have a problem doing the auto-detect.
However, I have a problem with the low-speed control. When I crack the throttle open, the motor immediately starts at what seems like 30% of its max torque. Of course the bike launches abruptly. I can modulate the torque from 30 to 100%, but below that, it's like an On-Off switch. This spoils the fun of an otherwise good combination.

I would be curious to know of other people who run the Adaptto with the MAC mid-drive, successfully or not.
Adaptto basically told me there isn't anything they can do about it. But I find that incredible that this controller can't put out a pulse width narrow enough to accelerate a motor smoothly.

In the pics below, I don't have the pedals installed, and those are footpegs that I made to go trail riding in the snow. I like that configuration much better than with the pedals... 8)

Cheers!
Attachments
P1060454.JPG
P1060455.JPG

User avatar
crossbreak   100 MW

100 MW
Posts: 2801
Joined: Aug 02 2011 11:20am
Location: Germany
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by crossbreak » Feb 16 2016 12:34pm

nice built! Looks like you run two chains but no pedals!? why two chains?`one would do the job much better, no :? ??
do you have the old version of the MAC, like in the spinningmagnets tutorial or do you have the new late 2015 one? Would be nice to see some pics of the new MAC internals.

i have low speed issues, too. I run the 6T MAC with FOC kelly KLS and originial hall positions. Motor does not start smoothly from a dead stop. It pulls lots of watts (like 2000) but only stutters and turns VERY slowly. As soon as it turns some rpm it is all fine, all i need to do is let go the throttle of a blink of an eye. Strange.
Autodetection worked fine for me... worked the first time i tried. But there is some sort of rpm limit. it wont turn faster than 2000rpm (32000 erpm), no matter if i use 44V or 54V battery.

Altair   100 W

100 W
Posts: 267
Joined: May 03 2014 10:35am
Location: Quebec, Canada

Re: Converting a hubmotor to a middrivemotor

Post by Altair » Feb 16 2016 12:40pm

Finally figured out how to attach images, but not how to paste them in large format. Anyway...

I think that 2000RPM is about the maximum that we can get from this motor. From reading old posts in this forum, the pole count is too high.

User avatar
crossbreak   100 MW

100 MW
Posts: 2801
Joined: Aug 02 2011 11:20am
Location: Germany
Contact:

Re: Converting a hubmotor to a middrivemotor

Post by crossbreak » Feb 16 2016 12:51pm

your pictures are fine. if you click them, they get enlarged.

the controller can do 60000erpm, adappto also. This is 3750rpm. This is definitely a bug. The mentioned 2000rpm are the reasonable rpm for middrive use. the range is 1500-2000rpm. Below it is weak/gets too warm at load. When spinning much faster it gets warm even without any load. Mine eats ~350W no load at 2500rpm.

still...whats the reason you use two chains instead of one?

Post Reply