Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
babyeatingpsychopath
Oct 28, 2000
Forum Veteran


Collateral Damage posted:

The code itself looks OK. If you find that it can't keep up because digitalWrite takes too much time, you can try one of the high performance IO libraries for Arduino, or just do low-level calls on your own.

There are probably some people over in the Arduino thread who are much better at optimization than I am who can tell you if there are any other performance pitfalls.

There's actually a DIY ECU thread. I'm using an arduino nano on my bike now -- same processor as the Uno; ATMEGA328. I think the nano has enough power to run a 2-stroke 2-cylinder up to 14k rpm. A complete crank cycle takes 4.28ms at that RPM, so all your math has to be done in less time than that. The clock is 16MHz, and the arduino IDE is pretty well optomized to generate code.

Be intelligent with your function calls, and you'll have plenty of headroom on your timing; maybe not so much headroom on your memory space, though.

The thread has good info about what transistors to use to fire your coil, too.

Adbot
ADBOT LOVES YOU

  • Locked thread