My first attempt to get an idea of the absolute accuracy of the current=20 shunt had indeterminate results, as I don't know how many of the ten 50=20 ohm 10 watt resistors were still attached. They melted the solder=20 holding them. Still, I got the idea that I'm in the ballpark. A=20 value of 0x3e worked out to 0.302V and at 73 mV per Amp, worked out to=20 4.13 A where ideal would have been 4.8A. So I went on to the motor on the bike, and used the brake to load the=20 motor. With the simple on / off control of PWM, it does pretty much as=20 I expected, with the PWM coming on for short bursts of about 5 mS under=20 high load. I should be able to avoid blown fuses or motor burnout with=20 this. I'm collecting max shunt readings indicating about 20A when the=20 limit is set for 10 A. I wish I had started this in the old MPLAB 8.x rather than MPLAB X. =20 Two immediate gripes: o "Alt F S" to save a file needs just the right timing, else you end up=20 with an unsaved file with an extra 's' character in it, and you find=20 that out after it fails the next build. o It just loses synch with the ICD3. The pacifier keeps wiggling well=20 after I've hit pause or "Finish debugger session" and I frequently need=20 to unplug, replug the USB to ICD cable to get it back to a known state. =20 Or, I need to do that AND close / restart the program. Joe W On 9/5/2012 8:23 AM, Sean Breheny wrote: > I think you are wise to focus on torque limiting. In my experience, > the first components to be damaged in a fault condition are the FETs > and their power dissipation depends primarily on current, not motor > power. > > Sean > > > On Wed, Sep 5, 2012 at 1:55 AM, Joe Wronski = wrote: >> On 9/3/2012 6:17 AM, Peter wrote: >>> Joe, decide on power or torque limiting (these are 2 different things),= then >>> implement it. It is a closed loop so you just do Pwmcontrol =3D (limiti= ng)? >>> Demand: Demand - LimitingSignal; Cycle by cycle current limiting is ano= ther >>> thing, and is actually a good idea, but that requires that you see the >>> individual current pulses. It may be, that individual pulse current lim= iting is >>> all you really want, and that is best done in hardware alone imho. >>> >> Yeah, I'm going to have to tinker with this a bit to get a feel for it. >> I had to look up the difference between torque and power. I'm going to >> have to choose torque, since no work will be done if the motor stalls. >> I guess I can implement the above logic using a scaling factor k for >> LimitingSignal. I can start with k large enough to effectively shut >> PWM off when limiting. If that works, I can try decreasing k and >> observe the effect. >> I finally added the wiring for this (and speed and pedal torque input) >> now it's time to see if it works. >> I wish I had put more effort into understanding some physics and >> whatever math is needed for motor control applications way back when. >> Joe W >> >> >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .