Engine Dyno Help

About six years ago, me and a buddy added electronics to a Stuska water brake dyno using a load cell and an optical sensor. It was operational, but needed some tuning with the mechanical side to isolate the vibrations and spikes from the load cell and some software tweaking on the RPM counter.

Fast forward to 2019, and my buddy isn't around any longer, and I don't have the code he used to get to where we were back then. He was the electronics/software guy, and I was the engine builder/hardware conversion side of it.

My first goal would be to get a sketch together that would at least output RPM's and Load Cell output to the Serial Monitor. I could just copy/paste that to Excel and create a graph. My ultimate goal would be to add a couple temp sensors and log the data and display of some sort.

If anyone can point me to any shared code that I can play with to get started, I'd really appreciate it. I really don't have a clue where to start, and other searches have lead me to unfinished projects.

I think that the first thing is to identify the hardware that you have to work with unless you will rebuild from scratch. What load cell, load cell amplifier (if present), RPM detection method and any other hardware outputs and inputs. Once you have that information you should be able to find information on the web to work with each part.

I'll gather up that info tonight and post it. There is an amplifier that was built using some chip. I have no idea on the schematic, but I'll see what sense I can make of it. Thanks!

Something to consider:

Depending upon what you find, it might be easier to start over with a digital HX711 load cell amplifier since there is a large code base out there for that part as opposed to an unknown schematic amplifier using an analog input.

OK, here is what I've found. This is the closest I could find on the load cell. Mine is a 100lb - KELI 100lb Load Cell
One question on it though, the shield wire is not hooked to anything on my setup. Where should that be connected?

The amplifier is based off of an INA125P chip and I verified it is wired according to the following diagram - INA125P Wiring DiagramI'm happy to check out that HX711 and go that route if that is a better method.

Here is the optical sensor we used for RPM's - https://www.digikey.com/product-detail/en/lite-on-inc/LTH-301-32/160-1936-ND/3198349

the shield wire is not hooked to anything on my setup. Where should that be connected?

The shield should connect to ground at one end only. If the shield is connected to the load cell, the connection can be through the load cell being attached to ground so the other end should not be connected to anything. This can be confirmed with an Ohmmeter.

Thanks for the info on the shield wire.

So, turns out my load cell is bad. I tested it on the bench, and wasn’t getting any voltage out of the signal wires. I opened it up, and peeled a bit of the silicone away, and could see one of the wires had pulled away from where it was wired. I’m planning on purchasing a new one, so I’m open to suggestions. The dyno will be used for kart engines, and probably a max of 25 foot pounds torque. The mounting is about 8 inches from the shaft, so I’m thinking about a 50lb “S-Type” load cell. I’m open to any suggestions on one if there is anything I should be looking for on them.

Thanks!

OK, on recommendation I purchased an HX711 load cell board and tested it with the code from Sparkfun, and that seems to work just fine. I found some old code in an email with the RPM's working and combined that with the Sparkfun code and I believe it is working as I'd like. I've got an LM393 based optical sensor and a 4 slot wheel. RPM range when testing will be from 2000-8000rpms.

My current code is below. I'm very open to suggestions on the code, and any pointers on a good program for Windows/Mac/Linux that I could use to plot the RPM and Torque, then save and print if needed.

Please be kind, I'm not a programmer...

     /*
 * Optical Tachometer
 * The IR LED is connected to pin 13 and ran continually.
 * Pin 2 (interrupt 0) is connected across the IR detector.
 */

int ledPin = 13;                // IR LED connected to digital pin 13
volatile byte rpmcount;
unsigned int rpm;
unsigned long timeold;

void rpm_fun()
 {
   //Each rotation, this interrupt function is run twice, so take that into consideration for 
   //calculating RPM
   //Update count
      rpmcount++;
 }
 
#include "HX711.h"

#define calibration_factor 80000.0 //This value is obtained using the SparkFun_HX711_Calibration sketch

#define DOUT  6
#define CLK  5

HX711 scale;
// How often do we do readings?
long time = 0; // 
int timeBetweenReadings = 50; // We want a reading every second;

void setup()
 {
  Serial.begin(115200);

   //Interrupt 0 is digital pin 2, so that is where the IR detector is connected
   //Triggers on FALLING (change from HIGH to LOW)
   attachInterrupt(0, rpm_fun, FALLING);

   //Turn on IR LED
   pinMode(ledPin, OUTPUT);
   digitalWrite(ledPin, HIGH);

   rpmcount = 0;
   rpm = 0;
   timeold = 0;
   scale.begin(DOUT, CLK);
   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
 }


void loop() { 
  int analogValue = analogRead(0);

  // running average - We smooth the readings a little bit
  //analogValueAverage = 0.99*analogValueAverage + 0.01*analogValue;

  // Is it time to print? 
  if(millis() > time + timeBetweenReadings){
   //RPM START
   //Don't process interrupts during calculations
   detachInterrupt(0);
   //Note that this would be 60*1000/(millis() - timeold)*rpmcount if the interrupt
   //happened once per revolution instead of twice. Divide 60 by the number of segments
   //in the wheel
   rpm = (15*1000.0)/((unsigned long)millis() - (unsigned long)timeold)*rpmcount;
   timeold = millis();
   rpmcount = 0;

   //Restart the interrupt processing
   attachInterrupt(0, rpm_fun, FALLING); 
   //RPM END

   
 //  Serial.print("RPM=");
   Serial.print(rpm);Serial.print(",");Serial.println(scale.get_units());
    time = millis();
  }
}
if(millis() > time + timeBetweenReadings)

This can, eventually, get you in trouble if millis() ever rolls over (continuous operation without reset after about 49 days). Use subtraction as in the beginner's guide to millis(). That is all that I see.

any pointers on a good program for Windows/Mac/Linux that I could use to plot the RPM and Torque, then save and print if needed.

I don't know of any program to display what you want on the PC. I would write a program using Processing. Pretty easy to learn and there are lots of examples and tutorials and is similar to Arduino programming. Use the serial port (serial prints) to communicate with Processing. Communication can be 2 way, the Processing program can also send control signals to the dyno (start run, end run, ...).

groundFungus:

if(millis() > time + timeBetweenReadings)

This can, eventually, get you in trouble if millis() ever rolls over (continuous operation without reset after about 49 days). Use subtraction as in the beginner's guide to millis(). That is all that I see.

The longest I'd be sampling data would be 20-30 seconds each run, so no worries with the 49 day limit.

I'm a long way from going past the basics at this point with the program, but maybe some day down the road I'll have a look at Processing.

Thanks for the reply!

Good luck. I was in Karting for a few years. Ran Sr. Sportman Yamaha at the PKRA road course in Pnoenix, Arizona. Had a blast.