I'm just about ready to test the PI interrupt driven software, with fixed point math! ya! Fake floating point accurate to +/- 0.015!!! Wow! is that crappy or what! But it's enough to get the job done. If the current is at 'x', and throttle is at 'x+1', the PI loop drives it to x+1, and that's all I wanted.
In a PI loop, there are 2 gains (2 constants), called P and I. I'm searching for the perfect 2 numbers between like 0 and 2 or something that will help the current chase the throttle and stay as close to it as possible, without going over much. Here's what I'll do:
I'm going to get a video camera to watch the oscilloscope. Then I'll start with P = 1/16, and I = 0. I'll pulse the motor with a throttle of 0%, 10%, 0%, 10%,... It will do 0% 10% 0% 10% every second. This will give a signal that my $100 crappy oscilloscope can lock on to. It better!!! Or I will whup it like a red-headed foster child (wait, you can't spank them, I mean I'll give my oscilloscope a time-out).
On the oscilloscope I will be watching the output of the current sensor, which is a voltage in the range 2.5v to 3.125v. Oh dear... That means I need to take the box apart again. That's not good, because I glued the ends on it, sealing it once and for all! Oh well, It's just that rubbery caulking stuff. I'll scrape it off and put it on again later.
Anyway, I'm glad I just figured that out. hehe. I didn't know that before writing this. After about 5 seconds of doing the pulses with P = 1/16, I'll bump P up to 2/16, and do the pulses again, watching the current sensor response. Then I'll do it for 3/16, 4/16, etc... Getting it all on tape! Then once I find the highest value of P that doesn't create too much overshoot (or any overshoot???), I'll make P a bit smaller, and that will be my P for ever and ever for this motor! Ben's motor is a little bigger, so I'll have to make my P even smaller so it will run well on his too!
Once I have P, I'll start incrementing I. I'll start at 1/16, keeping P fixed on the special number that I found earlier. Now I'll watch the response on the oscilloscope again. Once it damps really fast with still very small overshoot, I found the beautiful I!!!!!!!! HUrray! I'm so happy! Wait. I haven't done it yet.
Time to go rip that stupid box apart. This seems like a lot of work just to make the throttle work basically like it works right now.
Oh well, at least all the professionals will be able to sleep at night, MAZDA MATT!!!!!! HAHAHAHA!