model engine thrust dynamometer; help needed with programming

Trying to figure out the programming for a model engine thrust dynamometer; build the hardware but now struggling with the programming as I have “0” experience with this kind of programming...found a script that does what I like the dynamometer to do but when I check the code there are error reports. I use an Arduino UNO, load cell, HX711 type board (with 80 measurements a second) and a keypad shield...I would like the dynamometer to be self-zeroing, start with a button push, have a 10 second delay before starting and than records for 10 seconds so I can convert the readout afterwards in Excell...

code that I found is as follows:

[color=#24292e][/color]
/* 
[color=#24292e][/color]
Model Rocket Engine Dynamometer - Nick Cinquino 9/1/15 - V.5 Original 10Kg loadcell 
[color=#24292e][/color]
Modified from Nathan Seidle, SparkFun Electronics, November 19th, 2014 
[color=#24292e][/color]
Output data in grams (g). There are 101.97 gram-force per Newton, for conversion. 
[color=#24292e][/color]
Your calibration factor may be very positive or very negative. It all depends on the setup of your individual loadcell, and the direction the sensors deflect from zero state. Need to experiment! 
[color=#24292e][/color]
Hack the HX711 board to set pin 15 high, for 80 samples per second. 
[color=#24292e][/color]
This example code uses bogde's excellent library: https://github.com/bogde/HX711 
[color=#24292e][/color]
bogde's library is released under a GNU GENERAL PUBLIC LICENSE 
[color=#24292e][/color]
Arduino pin 2 - HX711 Clock 
[color=#24292e][/color]
pin 3 - Serial Data In 
[color=#24292e][/color]
5V - VCC 
[color=#24292e][/color]
GND - GND 
[color=#24292e][/color]
Yellow LED on pin 13, igniter transistor/relay on pin 11, momentary pushbutton on pin 12. 
[color=#24292e][/color]
Most any pin on the Arduino Uno will be compatible with DOUT/CLK. 
[color=#24292e][/color]
The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power is fine. 
[color=#24292e][/color]

[color=#24292e][/color]
*/ 
[color=#24292e][/color]

[color=#24292e][/color]
#include "HX711.h" 
[color=#24292e][/color]
#include <LiquidCrystal.h> 
[color=#24292e][/color]
LiquidCrystal lcd(8,9,4,5,6,7); 
[color=#24292e][/color]
const int buttonPin = 12; // start sequence button 
[color=#24292e][/color]
const int ledPin = 13; //LED indicator and/or buzzer 
[color=#24292e][/color]
const int igniterPin = 11; //igniter transistor circuit 
[color=#24292e][/color]
int buttonState = 0; 
[color=#24292e][/color]
#define DOUT 3 
[color=#24292e][/color]
#define CLK 2 
[color=#24292e][/color]
float calibration_factor = -560; //-560 works for my 10kg loadcell.
[color=#24292e][/color]

[color=#24292e][/color]

[color=#24292e][/color]
void setup() { 
[color=#24292e][/color]
pinMode(buttonPin, INPUT); 
[color=#24292e][/color]
pinMode(igniterPin, OUTPUT); 
[color=#24292e][/color]
pinMode(ledPin, OUTPUT); 
[color=#24292e][/color]
Serial.begin(9600); 
[color=#24292e][/color]
Serial.println("HX711 Rocket Motor Dynamometer, V.5"); 
[color=#24292e][/color]
Serial.println("Affix motor nozzle up. Place igniter in nozzle. Move away from test stand."); 
[color=#24292e][/color]
Serial.println("Press start button to initialize ignition sequence."); 
[color=#24292e][/color]
lcd.begin(16, 2); 
[color=#24292e][/color]
lcd.clear(); 
[color=#24292e][/color]
lcd.setCursor(0,0); 
[color=#24292e][/color]
lcd.print(" MODEL ROCKET"); 
[color=#24292e][/color]
lcd.setCursor(0,1); 
[color=#24292e][/color]
lcd.print(" DYNAMOMETER"); 
[color=#24292e][/color]
delay(2000); 
[color=#24292e][/color]
scale.set_scale(); 
[color=#24292e][/color]
scale.tare(); //Reset the scale to 0 
[color=#24292e][/color]
long zero_factor = scale.read_average(); //Get a baseline reading 
[color=#24292e][/color]
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects. 
[color=#24292e][/color]
Serial.println(zero_factor); 
[color=#24292e][/color]
Serial.println(" "); 
[color=#24292e][/color]
} 
[color=#24292e][/color]

[color=#24292e][/color]
void loop() { 
[color=#24292e][/color]
lcd.clear(); 
[color=#24292e][/color]
lcd.setCursor(0,0); 
[color=#24292e][/color]
lcd.print(" Rocket Dyno"); 
[color=#24292e][/color]
lcd.setCursor(0,1); 
[color=#24292e][/color]
lcd.print(" STDBY " ); 
[color=#24292e][/color]
scale.set_scale (calibration_factor); 
[color=#24292e][/color]
lcd.print(scale.get_units(),1); 
[color=#24292e][/color]
lcd.print(" g"); 
[color=#24292e][/color]
delay(500); 
[color=#24292e][/color]
buttonState = digitalRead(buttonPin); 
[color=#24292e][/color]
if (buttonState == HIGH) { 
[color=#24292e][/color]

[color=#24292e][/color]
lcd.clear(); 
[color=#24292e][/color]
lcd.setCursor(0,0); 
[color=#24292e][/color]
lcd.print(" Rocket Dyno"); 
[color=#24292e][/color]
lcd.setCursor(0,1); 
[color=#24292e][/color]
lcd.print(" STAND CLEAR!"); 
[color=#24292e][/color]
Serial.println("IGNITION SEQUENCE ACTIVATED!"); 
[color=#24292e][/color]

[color=#24292e][/color]
for (int i=0; i <= 50; i++){ 
[color=#24292e][/color]
digitalWrite(ledPin, HIGH); 
[color=#24292e][/color]
delay (100); 
[color=#24292e][/color]
digitalWrite (ledPin,LOW); 
[color=#24292e][/color]
delay (100); 
[color=#24292e][/color]
} 
[color=#24292e][/color]
lcd.clear(); 
[color=#24292e][/color]
lcd.setCursor(0,0); 
[color=#24292e][/color]
lcd.print(" Rocket Dyno"); 
[color=#24292e][/color]
lcd.setCursor(1,1); 
[color=#24292e][/color]
lcd.print(" AQUIRING DATA"); 
[color=#24292e][/color]
digitalWrite(igniterPin, HIGH); 
[color=#24292e][/color]
Serial.print("Start time, ms: "); 
[color=#24292e][/color]
Serial.print (millis()); 
[color=#24292e][/color]
Serial.println(" "); 
[color=#24292e][/color]
Serial.println(); 
[color=#24292e][/color]
 
[color=#24292e][/color]
for (int i=0; i <= 800; i++){ //800 samples at 80sa/sec = 10 seconds theoretical 
[color=#24292e][/color]
scale.set_scale(calibration_factor); //Adjust to the calibration factor 
[color=#24292e][/color]
Serial.print(scale.get_units(), 1); 
[color=#24292e][/color]
Serial.println(); 
[color=#24292e][/color]
} 
[color=#24292e][/color]
Serial.println(); 
[color=#24292e][/color]
Serial.print("Stop Time, ms: "); 
[color=#24292e][/color]
Serial.print(millis()); 
[color=#24292e][/color]
digitalWrite (ledPin,LOW); 
[color=#24292e][/color]
digitalWrite (igniterPin,LOW); 
[color=#24292e][/color]
Serial.println(); 
[color=#24292e][/color]
 } 
[color=#24292e][/color]
}
[color=#24292e][/color]

[color=#24292e][/color]

This code gives me a "scale was not declared in this scope" error when run.

Can anybody help me to addept the code so it will work?

Kind Regards,

Bulldog

Look at the examples on GitHub. You are missing a declaration of the scale object.

like mentioned I have no programming experience which is a huge drawback when you try to solve software :slight_smile:

I Looked at the Github examples of bogde, but am failing to identify the "declaration" part of the scale object: can you give me a pointer in the form of a code example?

In the basic example in the version of the library I was looking at, this line appears near the top above setup and is missing from yours:

HX711 scale;

Thanks!

It is compiling now! no more errors :slight_smile:

now I can start testing my set up

thanks again!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.