help with approach for automated testing equipment code

I am currently in development of an automated testing equipment. The test will consist of measuring distance and force. Plotting the distance on the x axis and force on the y axis I then can determine key points in the test such as peak force, distance traveled till peak force, and determining the area underneath the curve for total energy. That being said, I have constructed a testing stand that consists of a stepper motor attached to a acme lead screw. A acme nut then runs thru a tube with a slot cut in the side where an aluminum beam can come out of. This aluminum beam has a reduced cross section at the base with a full bridge strain gage and is used to sense the force. I built this bending beam load cell myself. I also have a microSD 2GB module from libelium to record and save a test profile. I have code that can run a stepper motor and I also have code and a working circuit that can output the strain value to serial, but i do not have any code that combines the two and that can record the test profile to the SD card.

Now that you have kind of a background and understanding of what this contraption is, I was wondering if anybody could give advice on what kind of structure is needed to combine these three functions of simultaneously record the distance based on the number of steps, strain value at each distance, and then record the values to the sd card.

Not sure if any of this makes sense but I would really appreciate some help as I have limited experience in coding and arduino. Thanks in advance for your time and efforts.

Austin

Post the code you allready have , so we can help.

From what I read the way I would approach is to write one record of measurements per step of the steppen motor

in pseudocode

step = 0;
endcondition = false;
while (step < MAXstep &&  endcondition == false) 
{
  step++;
  move steppenmotor one step;
  delay(100);    // give system time to adjust to new situation
  measure force distance etc;
  
  write to SD card (time, step, distance, ...);
  endcondition = func(measured data);
}

Hi,

Is this going to run a similar type of test with the same applied distance and same maximum force?

Or do you want to make a more general testing system that can be used for a variety of tests.

If it's more like Rob suggests,

-move the mechanical actuator over a range in some size of step(s),

  • record force at each step
  • stop at maximum force OR distance
    ???

Hey thanks Rob,

I cant post any code till later today but that helps alot thanks. I may need to ask a few questions on writting to the SD card as I have not even played around with that yet.

AND Terry thanks for your input. And yes this test will be for just one application where the distance and peak force should not vary very much from test to test. And that was my idea to have a stop condition that stopped the test when the force exceeded a certain value as that would mean the travel of the mechanism had stopped. I then would have the stepper motor retract to the home position.

Thanks again,
Austin