In the VW air cooled engine the distributor shaft turns at a half of the speed of the crankshaft. Then for a given RPM the distributor turns at RPM/2. In terms of time the engine takes T to perform a full turn while the distributor takes 2*T.
Since the distributor generates 4 impulses at each turn, the time interval between two impulses is a quarter of the time for a full turn of 2*T/4 which equals T/2. We must use this ratio to choose a prescale factor for the Timer1 that will provide good timing resolution for higher RPMs and yet don't overflow at lower RPMs.
Assuming the AVR will operate at 16MHz, we have 62,5ns per cycle. The prescaler values availabe are 1:1, 1:8, 1:64, 1:256 and 1:1024
The engine idle speed is around 900RPM and the maximum speed is around 6000RPM, but during startup the engine RPM is low so let's check consider a range from 300RPM up
In that range we have an interval between impulses (T/2) from 100ms to 5ms. Within these times we can have the following amount of impulses for different prescalers.
The smaller prescale value that fits to our need is 64. With this value we and time engine speeds as low as 150 RPM yet we still have resolution of 10 RPM around 6000 RPM.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.