![]() _BV(ICES1) // Input Capture Edge Select (1=Rising, 0=Falling) TCCR1B = _BV(CS10) | // start Timer 1, no prescaler TIFR1 |= _BV(TOV1) // clear Overflow Flag so we don't get a bogus interrupt TIFR1 |= _BV(ICF1) // clear Input Capture Flag so we don't get a bogus interrupt For testing, uncomment one of these lines and connect Note: Since this uses Timer1, Pin 9 and Pin 10 can't be used for The 'micros()' function is limited to 4-microseconds precision and subject to various interruptions.Įxample code for the Uno/Nano/Mini: // Measures the HIGH width, LOW width, frequency, and duty-cycle of a pulse train That will let you measure rising or falling edges with a precision of 1/16th microseconds. English is not my native language.įor more precision, you can use the Input Capture feature of the UNO, Nano, Mini, Mega, Leonardo, or Micro. I also apologize for any grammar mistakes I probably made. Therefore the refresh rate of the RPM counter would also need to be quite high. It would also need to be quite accurate because the timing when the fuel injector opens is calculated from the current RPM. in the picture), spaced only a few milliseconds appart to calculate the RPM. My question is how can I with this signal measure the RPM of the motor using an Arduino? What would a script that could do that look like? I would like to use the two voltage drops (1. The two sensors are spaced exactly 35° appart. ![]() When the magnet on the flywheel passes the second sensor it creates the second voltages drop (which can be seen at 2. When it is running and the magnet on the flywheel passes the first sensor, it creates the first voltages drop (as you can see this in the picture at 1.). When the engine is not running it just outputs a +5V signal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |