Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New way of defining wheels
I'm designing a new way to define the crank/cam wheel patterns for Ardu-Stim. As of now (sept 11, 2015) this is a DRAFT and may be subject to change as the idea develops further...

The primary motivator behind this is a lack of FLASH space on the arduino (a paltry 32 K, which also includes the code itself).  Some complex patterns with 1 degree resolution each, take up to 720 bytes EACH, and it doesn't take long at all to gobble up all the flash, as I'm right on the edge now and a new pattern is likely to push it over the edge, and I have 38 patterns already and would prefer to support a LOT more including user provided patterns over the serial link (this method allows that)

The secondary motivator is that the patterns are cumbersome to edit and debug and staring at columns of ones and zeros is hell on the brain....

So here it is so far:
/* New Wheel definition strings
 * All patterns start with a "C" meaning "crankshaft" or "c" meaning "camshaft
 * The second parameter determines the pattern style
 *  "A" for an angular defined wheel (time on, time off in degrees, total time must equal 360 degrees)
 *  "S" is for the simplest symmetric, non-missing teeth wheels ONLY
 *  "M" is for M-N or more complex M-N+N styles
 * Third param (pattern tooth duty cycle) (1/2 == 50%, 1/4 == 25% and so on, any ration allowed)
 *  up to 5 characters (xx/yy) to allow for really odd duty-cycles
 * Fourth param depends on 2nd param (A,S, or M)
 *  For "A" (angular (complex or odd)) defined wheels the sequence is 
 *   the number of degrees the tooth is "high" followed by low for each tooth, The total MUST equal 
 *   360 for crank wheels and 720 for cam wheels
 *   i.e. for a wheel that is 40 degrees high, 50 deg low with 4 teeth it would be:
 *   40,50,40,50,40,50,40,50
 *  For "S" simple/symmetric pattern, you just need the number of teeth that the wheel should generate in a revolution
 *   i.e. 2  (dizzy 4 cylinder)
 *  For M-N(-/+N...) (missing teeth pattern, any style)
 *   List the number of teeth the wheel would have if it had NO MISSING teeth, then
 *   the SEQUENTIAL present teeth followed by sequential missing teeth as follows until you complete the whole pattern
 *   The total number of teeth and missing MUST equal the number the preceding number as shown
 *   36t,1m  (36-1 pattern)
 *   13t,2m,16t,2m,1t,2m (Mazda 36-2-2-2)
 *  So for a simple 4 cylinder distributor (2 teeth per crank rotation, 50% duty cycle)
 * The pattern is "CS1/2,2"
 * For a 36-1 with 33% dutycycle (short teeth, 2x as wide gaps) it would be:
 * CM1/3,36,35t,1m  (15 bytes vs 108 bytes with the current setup)

 * For Crank+Cam setups the CRANK pattern is always defined FIRST, 
 * then a colon character ":" and the same structure as the crank but with lowercase "c" instead
 * in the same style as above.  You need to be careful to "word" your pattern in a way to get the
 * crank to cam relationship right.  The crank pattern will repeat every 360 degrees, the cam one, every 720 degrees
 * Example:
 * 60-2 bosch wheel (crank only)
 * CM1/2,60,58,2
 * hypothetical wheel with 60-2 crank and half-moon single tooth cam
 * CM1/2,60,58,2:cS1/2,1                                                                                                       

When a pattern is selected by the serial UI, the arduino will parse that string and build the output array in RAM and output the pattern as usual,  there's plenty of RAM to accommodate 1 degree resolution for all wheels, and I have thought of ways to compress that by a factor of 8, though I'm not 100% sure if that'll impact the output signal significantly or not.

-- David

Forum Jump:

Users browsing this thread: 1 Guest(s)