View Single Post
Old 01-15-2009, 01:35 PM   #203 (permalink)
MPaulHolmes
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,831

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,367
Thanked 1,115 Times in 730 Posts
I was just kidding about the 50% current at 1 and overcurrent at 2. Since I was typing out each iteration, I didn't want to type very much. Assuming no current control, a problem with overcurrent could happen with the throttle at maybe 25 or 30, assuming a direct drive 11 inch warP motor with TINY internal resistance and near zero inductance (like Ian's motor), and near zero rpm.

This is a $2 8 mHz chip. It does have 10 bit max resolution, but running at the full A/D converter speed makes the bottom 2 LSBs pretty worthless. I switched all A/D channel resolutions from 0-1023 to 0-255 mainly because it was required in order to get the PWM frequency up to 16 kHz. Then, because the throttle was now 8 bit, I made it so it could be a single 8 bit read for each input, which is twice as fast as a 16 bit read. Because I was only using 10 of the possible 16 bits, and because 2 of the bits weren't accurate at that speed, 8 seemed the way to go.

The current limiting resolution will be about 1 - 2 amps per A/D channel division. In practice, I'm told that this gives very smooth results in a car. Ian told me that his 600amp current limiting with the ATMega8 feels very smooth. He even has a worst case motor for current control. I do think it would be better with an 80 MHz chip, and 16 bit resolution. I'm just trying this at first. The Atmel ISP I'm using has an extension possible, to upgrade the STK500 to an STK600, which allows for 32 bit 150 MHz micro-controllers I believe. The STK600 is $200, so I was holding off and just keeping things simple and cheap. The fancier micro-controllers were more like $20-30 each on digikey. I've already wrecked one ATMega8... hehehe.

I'll see what the loop speed is by this weekend (toggling an output. great idea!). I haven't seen anything in the 300 page (aaahh!!!) ATMega8 PDF on using 2 8 bit PWMs to get 16 bit.
__________________
kits and boards
  Reply With Quote