#$%@$#@ <--- (insert favorite swearword here), IT WORKS !!!!

Electric Motors and Controllers

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby markobetti » Thu Dec 01, 2011 9:42 am

incredible...dont know if its possible to implement it to xie chang hardware ... but that would be crazy cool .....and you could sell us the chip with program and instructions....
markobetti
10 kW
10 kW
 
Posts: 769
Joined: Fri Jul 17, 2009 1:28 am

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Thu Dec 01, 2011 9:53 am

Lebowski wrote:I would love some input on how the algorithm works with different motors. It's not ready for it at the moment as
the video was literally made 5 minutes after I got it to work, but maybe it's an idea to mail some programmed
30F4011 chips around so people can try it in their own controllers (you would need to build the power stage etc
yourself or do a brain transplant on a Lyen controller)...? Your motor has to be able to deal with field weakening
though (I read somewhere that field weaking can damage the permanent magnets but I don't know how tricky this is).


I think it would work in a standard controller. You need to de-solder the microcontroller, connect the 30F4011 the correct
way (halls, 6 signals to the 6 FET drivers, 5 V supply) and add two high-current current sensors. I think
these sensors would work:

http://ch.farnell.com/allegro-microsyst ... dp/1791392

(it needs to be a sensor that for 0 amps gives out 2.5V from a 5V supply with 5V out for 50 Amps and 0V out
for -50 Amps. there's also 200amps versions)
User avatar
Lebowski
100 kW
100 kW
 
Posts: 1466
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Arlo1 » Thu Dec 01, 2011 9:59 am

Awesome once I get my controller finished I would love to use your code to flash my dspic and try it out on colossus.
Thanks Justin of http://www.ebikes.ca/
Also a thanks to Methy at http://www.methtek.com/ :)
And Dave who has some good deals on STUF
RC lipo and most other types of Lithium batteries you MUST know your individual cell voltages while charging and discharging.
Batteries of all kinds need respect they can burn your house down, so don't sleep with them under your bed or any other were you cant afford smoke or fire!
[color=#FF0000][b][size=150]Never above 4.2v never below 2.7v EVER!!!
User avatar
Arlo1
100 GW
100 GW
 
Posts: 5219
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby parabellum » Thu Dec 01, 2011 11:41 am

Bravo Lebowski, looks like a huge step or two in right direction. It was long period since last significant controller breakthrough.
User avatar
parabellum
10 kW
10 kW
 
Posts: 871
Joined: Fri Nov 19, 2010 9:55 am

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby gtadmin » Fri Dec 02, 2011 4:30 am

Lebowski wrote:...
I think it would work in a standard controller. You need to de-solder the microcontroller, connect the 30F4011 the correct
way (halls, 6 signals to the 6 FET drivers, 5 V supply) and add two high-current current sensors. I think
these sensors would work:

http://ch.farnell.com/allegro-microsyst ... dp/1791392

(it needs to be a sensor that for 0 amps gives out 2.5V from a 5V supply with 5V out for 50 Amps and 0V out
for -50 Amps. there's also 200amps versions)

This looks good, well done mate. These current sensors are the ones I use, and available from the US (more applicable to Arlo1 though)
User avatar
gtadmin
10 kW
10 kW
 
Posts: 755
Joined: Fri Aug 07, 2009 7:46 am
Location: Whyalla South Australia

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Arlo1 » Fri Dec 02, 2011 10:35 am

gtadmin wrote:
Lebowski wrote:...
I think it would work in a standard controller. You need to de-solder the microcontroller, connect the 30F4011 the correct
way (halls, 6 signals to the 6 FET drivers, 5 V supply) and add two high-current current sensors. I think
these sensors would work:

http://ch.farnell.com/allegro-microsyst ... dp/1791392

(it needs to be a sensor that for 0 amps gives out 2.5V from a 5V supply with 5V out for 50 Amps and 0V out
for -50 Amps. there's also 200amps versions)

This looks good, well done mate. These current sensors are the ones I use, and available from the US (more applicable to Arlo1 though)

I will have to look at them again but I got 4 Alegro ACS758ECB-200U-PFF-T http://www.allegromicro.com/~/Media/Fil ... sheet.ashx
Thanks Justin of http://www.ebikes.ca/
Also a thanks to Methy at http://www.methtek.com/ :)
And Dave who has some good deals on STUF
RC lipo and most other types of Lithium batteries you MUST know your individual cell voltages while charging and discharging.
Batteries of all kinds need respect they can burn your house down, so don't sleep with them under your bed or any other were you cant afford smoke or fire!
[color=#FF0000][b][size=150]Never above 4.2v never below 2.7v EVER!!!
User avatar
Arlo1
100 GW
100 GW
 
Posts: 5219
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Fri Dec 02, 2011 1:05 pm

Just put in a 'lost of lock' detection :D It has the capability to detect a 3 degree
phase error (at 6000 e-rpm) and shut down the controller.

Still thinking about recapturing lock after such an event... maybe I'll cheat and use the
hall sensors which are there for startup anyway, what do you guys think ?
User avatar
Lebowski
100 kW
100 kW
 
Posts: 1466
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Alan B » Fri Dec 02, 2011 1:12 pm

I was wondering if the algorithm could be configured so the halls and the BEMF were both used together in an intelligent fashion. Perhaps the halls for coarse lock and the BEMF for fine tuning. Then it could not get too far out of sync.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby parabellum » Fri Dec 02, 2011 1:16 pm

Lebowski, how is your throttle working in given case? Changing multiplication factor to BEMF and then chip modifies PWM accordingly?
User avatar
parabellum
10 kW
10 kW
 
Posts: 871
Joined: Fri Nov 19, 2010 9:55 am

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Fri Dec 02, 2011 1:18 pm

Alan B wrote:I was wondering if the algorithm could be configured so the halls and the BEMF were both used together in an intelligent fashion. Perhaps the halls for coarse lock and the BEMF for fine tuning. Then it could not get too far out of sync.


That was an earlier version... It interpolated between the hall signals using a timer and then
corrected for the remaining phase error with a 1st order control loop. The loop is now 2nd
order so it doesn't need the halls anymore.

some info: a 1st order loop can control a system to 0 error when the input is constant (like a phase error)
a 2nd order loop can control a system to 0 error also for a constantly rising / falling input. Since the position
of a running motor is represented by a constantly rising phase I use a 2nd order for control to 0 phase error
User avatar
Lebowski
100 kW
100 kW
 
Posts: 1466
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Fri Dec 02, 2011 1:21 pm

parabellum wrote:Lebowski, how is your throttle working in given case? Changing multiplication factor to BEMF and then chip modifies PWM accordingly?


That is what I use currently, though the multiplication factor is fixed and I use my lab supply.
I want to go to (motor phase) current control though as close control / monitoring of the currents will prevent
the killing of FET's and will make the system more user friendly (torgue is proportional to current).

I've seen Luke's videos :mrgreen:
User avatar
Lebowski
100 kW
100 kW
 
Posts: 1466
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Alan B » Fri Dec 02, 2011 1:24 pm

There are more than one way to combine the two sets of information.

The second order control is not much good if it loses lock.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby CNCAddict » Fri Dec 02, 2011 1:35 pm

As long as you have a really elegant way to control phase current during fault conditions then some sort of recovery is fine. It would really suck to have a front wheel mounted hub motor lock up hard at full speed!!! Maybe even a fallback to sensorless trapezoidal control if lock is lost?
Last edited by CNCAddict on Fri Dec 02, 2011 1:36 pm, edited 1 time in total.
CNCAddict
100 W
100 W
 
Posts: 173
Joined: Wed Sep 17, 2008 7:13 pm

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Farfle » Fri Dec 02, 2011 1:36 pm

Excellent work lebowski!
The race bike:
24s5p 50c nano tech
Badass custom mofo outrunner 205x177mm 26kv
Peak power in : 318A at 91v
Peak power out: 24 Hp and 151ft/lb

Build to last...
"It will be assaulted by the elements, It will be ravaged by time and it will be destroyed by the user. BUT, if you Stick to the little rules: K.I.S.S., Overbuild everything, and test, review, revise, repeat. It will last"


Team Farfle blog!! http://www.farfleselectrics.blogspot.com
User avatar
Farfle
1 MW
1 MW
 
Posts: 1712
Joined: Sun Jun 27, 2010 10:42 am
Location: Bend Oregon

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Fri Dec 02, 2011 1:49 pm

Alan, I don't see how you can build a sensorless control loop to track a constantly rising phase without at least a 2nd order loop ?

CNC: this is why I put the 'lost lock' detector in, I configured it such that it turns all the FETs off when this happens. I don't like
flying over the handlebars either :? the cool thing would be to recover lock again in a sensorless way and preferably so fast
the user doesn't even notice. I could use the halls (there for startup from standstill anyway) but that feels like cheating
User avatar
Lebowski
100 kW
100 kW
 
Posts: 1466
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby grindz145 » Fri Dec 02, 2011 1:52 pm

saweet!
http://www.endless-sphere.com/forums/viewtopic.php?f=18&t=19548 - Ebike Nerd Podcast
Thanks to Justin @ ebikes.ca! Go there, buy stuff. Support the Revolution :D
User avatar
grindz145
100 MW
100 MW
 
Posts: 2672
Joined: Tue Apr 07, 2009 12:10 pm
Location: Rochester NY

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby CNCAddict » Fri Dec 02, 2011 2:30 pm

if the FET's are off it would be possible measure the BEMF and then activate the sensorless algorithm again after rotor position is known. Since the BEMF waveform is already stored, it shouldn't take but a few samples of the BEMF to find rotor position. I imagine the only time this would need to happen is under some sort of rather abnormal occurance such as a loose phase wire or some other problem. Having a super fancy motor drive isn't much good if it's continuously faulting out, just ask luke :twisted:
Last edited by CNCAddict on Fri Dec 02, 2011 2:38 pm, edited 2 times in total.
CNCAddict
100 W
100 W
 
Posts: 173
Joined: Wed Sep 17, 2008 7:13 pm

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Alan B » Fri Dec 02, 2011 2:31 pm

I would use two loops and combine the outputs, or one loop with logic to combine the inputs. Maybe a little fuzzy logic. I haven't looked closely enough to have a detailed suggestion. Take a step back and look at all the available information. The goal is to determine the commutation points reliably and accurately using all available information in an integrated fashion.

Cutting out when accelerating to get out of the way of an oncoming <whatever> is just not an option. Control Systems need to do the best they can even if it means less optimal.

We found when making controls at a few nanometers level that some cleverness beyond control theory is required.

Great progress by the way.
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Sat Dec 03, 2011 2:38 am

The control loop at the moment is a bang-bang loop. It's second order with a bandwidth of around 100 Hz and a sample
rate of 4 kHz (which will be increased to 50 to 100 kHz later, the slow 4 kHz gives me the possibility to output a 16 bit measurement
value over 115 kbaud RS232). The algorithm gets positioning information every clock cycle (so 50000 to 100000 times a second)
but has to take into account the slow motor parameters (to explain the relatively low 100Hz bandwidth). (The 'delay' of a motor
is L/R, I don't know these values so took a conservative long delay value)
Anyway, to loose lock you would need to slow down the motor to half its speed in a few 0.001 of a second. Based on the
typical inertia of a fast-spinning motor, this is just not going to happen. Because of the 50 to 100 kHz clock rate the algorithm
is going to know something is up long before it actually happens :D . The setup has actually never lost lock during
normal running, only when I did stupid stuff like accidentally shorting a PWM output signal when I tried to measure it
with my scope. This was quite a violent event but not the fault of the loop.
User avatar
Lebowski
100 kW
100 kW
 
Posts: 1466
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby bigmoose » Sat Dec 03, 2011 3:37 pm

Lebo here are some motor constants if you are wondering where they might be. The motor indicated as Axial is a floor scrubber motor from Mars Electric now Motenergy.

MotorConstants.jpg
MotorConstants.jpg (34.17 KiB) Viewed 716 times
bigMoose's electronic pieces & parts (GENUINE IRFB4110Pbf's, Nomex 410, AntiCorrosion Grease, Current Sensors) available HERE.
Thanks to Justin ebikes.ca for securing the board then setting us FREE! Tech Tips in the WiKi: http://endless-sphere.com/w
"Live simply. Love generously. Care deeply. Speak kindly. Leave the rest to God..." all the best, Dave
User avatar
bigmoose
10 MW
10 MW
 
Posts: 2450
Joined: Thu Aug 06, 2009 3:05 pm
Location: Northern Ohio, USA

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Tue Dec 13, 2011 1:45 am

The controller is progressing nicely :D I only need to add a throttle and some calibration
menu's and it's ready for a powertest on the bike.

The way I got it setup now, the algorithm is clocked at 40 kHz but about double this speed
is possible though doesn't make sense (as my output stage only runs good up to 20 kHz, after
that the drivers cannot handle the large output transistors anymore.... killed off a whole
regiment of 33N10's this weekend due to slow turn on/off gate signals :oops: ). While the motor
is running you can send a 1-character command (over RS232) to the PIC which will then respond
by sending an internal variable back at a rate of 5000 samples per second so you can real-time
monitor things like e-phase, output voltage amplitude, motor current, the signal used to determine
the motor phase (during sensorless) etc etc.

The thing is very cool now, during fast acceleration of the motor, instead of a cogging type
noise (which you get with a simple china controller) it makes a very soft turbine / jet engine
type noise :mrgreen: like a plane spinning up. Once on speed you just hear the bearings and
air 'whoosing'.
User avatar
Lebowski
100 kW
100 kW
 
Posts: 1466
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Gordo » Tue Dec 13, 2011 2:33 am

Lebo,
whoosing is what you do the night after a piss up. A jet goes "whooooosH!
I will be very happy if I can get my 3KW scoot to go whoosing or whoshing instead of cogging. :lol: :mrgreen:
X-treme 3KW Scooter...OFF ROAD ONLY....Giant 1KW 48V 24" Hubmotor....E-Apex 1KW 48V 26" Hubmotor, built 2012-05-26
Thanks Justin, for saving ES. May Grin Tech grow and prosper.
User avatar
Gordo
100 kW
100 kW
 
Posts: 1387
Joined: Sun May 23, 2010 4:46 pm
Location: THE COLD WHITE NORTHWEST, EH?

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Tue Dec 13, 2011 8:47 am

Am thinking about the throttle interface now... I know just connecting an analog throttle is quite
easy but this is also very limiting. Therefore I'm thinking about adding a small 8 pins PIC (with internal ADC)
to connect the throttle to. This smal PIC will then transmit the digital value over SPI to the main
motor controller PIC.

There's 3 reasons for this. One is that I'm planning to run 2 motor controllers on my bike as my
motor is actually 2 motors in parallel on the same axle. Kind of similar to running
2 hubmotors, then you also need 2 controllers. Having the throttle as a digital signal enables easy
transmission (via optocouplers) to the 2 motor controllers. These can then be totally isolated from
each other and even run on seperate battery packs. Second reason is that, here in Switzerland an
e-bike with throttle is legally not allowed. A digital throttle allows me to run an extra 24F type PIC
which measures road speed, maybe inclination, pedalling force etc to build a proper fully automatic
pedelec. The 24F then transmits the motor-torgue requirement to the 30F motorcontrollers.
The 3rd reason is that receiving SPI is a hardware function of the 30F, it actually doesn't cost
any 'time' to the algorithm. Reconfiguring the ADC's to read the throttle channel plus the ADC conversion
time, you're easely looking at more than 1 usec, this seems like a big waste when the main
motor algorithm takes 10 to 12 usec...

The SPI bus is a very simple 2-wire approach, one wire clock second wire data. There's no speed
dictated in the protocol so you can transmit at a very low data rate (for good noise immunity). Maybe
I'll implement a 3-to-2 error correction algorithm as the ADC's in the 8 pins devices are 10 bit...

what do you guys think ?
User avatar
Lebowski
100 kW
100 kW
 
Posts: 1466
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Alan B » Tue Dec 13, 2011 8:53 am

Seems reasonable.

Might want to have a failsafe timing out the throttle input. Out of control motor controllers are not fun.

Is a throttle illegal, or is there just a requirement to be pedaling?
-- Alan W6AKB Cromotored FS GreyBorg, Novara MTB 9C, eBikeE Bent BMC, myEbikeWeb and Thanks to Justin at ebikes.ca for rescuing this forum!
User avatar
Alan B
1.21 GW
1.21 GW
 
Posts: 3876
Joined: Sat Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA

Re: #$%@$#@ <--- (insert favorite swearword here), IT WORKS

Postby Lebowski » Tue Dec 13, 2011 9:02 am

Alan B wrote:Seems reasonable.

Might want to have a failsafe timing out the throttle input. Out of control motor controllers are not fun.

Is a throttle illegal, or is there just a requirement to be pedaling?


Out of control motor controllers, that would be, eh, interesing :oops: especially when
you need to explain this to the police :D

AFAIK throttle is illegal and you must be pedaling for the motor to work. The motor is not
allowed to power the bike on it's own though the law is being changed now to allow
this upto 5 kmh (so you can walk next to the bike up a steep hill without having to
push it). So maybe then throttle is allowed upto 5kmh, but at the moment no.
User avatar
Lebowski
100 kW
100 kW
 
Posts: 1466
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Next

Return to Motor Technology

Who is online

Users browsing this forum: No registered users and 9 guests