Engine Dynamometer project with interrupts


I am building a small engine dyno for a school club project.

I need to record the force on a load cell and the engine RPM at the same time. From these two parameters i can determine/plot horsepower and torque at a given RPM.

So far i have the following code for the load cell working and calibrated. It consisted of a sparkfun 10Kg load cell and a HX711 amplifier.

For engine RPM I have a small neon lamp that will be triggered via inductance from a wire wrapped around the spark plug wire and a phototransitor to count the number of flashes from the neon lamp. This eliminated the chances of me letting the white smoke out of my arduino by not having any physical connection to the arduino lol
I have tested this separately using a multimeter and it works when i flash a light the phototransistor voltage goes high.

Now the issue…

How do i measure the load and the RPM at the same time?

Initial thoughts:
Use an interrupt to increment a counter triggered by the rising edge of the phototransitor.
BUT with RPMs getting close to 4000 at maximum that is only 15 milliseconds between lamp flashes.

Will i be missing important load cell readings while the interrupt is running?
also, will i have problems with the rise time of the phototransistor being to long?

 This sketch uses HX711 library from https://github.com/bogde/HX711. 
 The "_MASTER" must be removed from the .zip folder for the arduino IDE to find it.
 The calibration factor depends on units. The HX711.h file contains the calibration 
 curve and offset. The equation is linear (y=mx+b) and was detemined by MECA 380 
 final project. Alternative calibration can be found at https://github.com/bogde/HX711/issues/70

 Pin Configuration:
 Arduino pin 4 -> HX711 CLK
 5 -> DAT
 5V -> VCC

 The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.


#include "HX711.h"
#include <LiquidCrystal.h>        // I think this is from arduino IDE libraries 
#define calibration_factor-213    // This value is obtained using the SparkFun_HX711_Calibration sketch

#define DOUT  5
#define CLK  4

HX711 scale(DOUT, CLK);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);  // initialize the library with the numbers of the interface pins

void setup() {
  Serial.println("HX711 scale");
  scale.set_scale(calibration_factor);  // This value is obtained by using the SparkFun_HX711_Calibration sketch
  scale.tare();                         // Assuming there is no weight on the scale at start up, reset the scale to 0
                                        // The curve offset is -0.4 defined in the HX711.h file. neg. 0.4 because the 
                                        // program subracts the tare value. 


void loop() {
  lcd.begin(16,2);                     // set up the LCD's number of columns and rows:
  lcd.print("Force:");                 // Print a message to the LCD.
  lcd.setCursor(0, 1);                 // Move cursor to row 1 column 0
  lcd.print("RPM: ");                  // Print a message to the LCD.
  lcd.setCursor(7, 0);                 // set the cursor to column 8, line 0
  lcd.print(scale.get_units(), 1);     // print the weight
  lcd.print(" g");                     // Units
  lcd.setCursor(5, 1);                 // set cursor to 
  //delay(30);                         // Delay is sometimes needed to allow readable LCD screen (refresh rate) 
  Serial.print("Reading: ");
  Serial.print(scale.get_units(), 1);  // scale.get_units() returns a float
  Serial.print(" g");                  // You can change this to kg but you'll need to refactor the calibration_factor

The following code is derived from a project in which my Arduino measures the RPM of a small DC motor up to 18,000 RPM. The Arduino also does PID calculations to keep the speed constant and receives instructions by wireless. Your Arduino will have no trouble reading the engine speed and the load cell. The code is not complete but it should give you the idea.

volatile unsigned long isrMicros;
unsigned long latestIsrMicros;
unsigned long previousIsrMicros;
volatile boolean newISR = false;

void loop() {
   if (newISR == true) {
     previousIsrMicros = latestIsrMicros; // save the old value
     noInterrupts(); // pause interrupts while we get the new value
        latestIsrMicros = isrMicros;
        newISR = false;
     microsThisRev = latestIsrMicros - previousIsrMicos;

void myISR() {
   isrMicros = micros();
   newISR = true;

You should check to make sure the code for reading your load cell does not block the Arduino while it is waiting for the load cell to produce a reading.