Code for wind tunnel lift and drag measurement

Hi everyone,
I'm a newbie to Arduino. I've a wind tunnel project going on for measuring lift and drag of lifting surfaces. I find an arduino based DAQ system cheap, albeit the programming needed is quite out of my understanding at the moment. But I'm pretty sure there must be a freely available code for my purpose since such projects have been carried out in the past too.

I've already ordered an uno board along with 2 10-kg load cells and HX711 amps. Also have the arduino IDE already installed and running on my PC.

However, directly connecting 2 load cells onto an arduino to get separate readings for lift and drag seems quite tricky. Do I use the Robotshop 2 channel load cell shield with their free code for 2 load cells? If possible, I would love to not use the shields but rather directly connect the load cells to the uno using the hx711 amps.

Any help would be of great help!

Regards

I don’t think you will find ready to go code for this sort of stuff and writing your own ( or paying for it ) is the way forward ; but using two loads is possible. I stole this from this forum :

HX711 firstCell(3, 2);

HX711 secondCell(5,4);
...
void loop() 
{

val1 = firstCell.read();
val2 = secondCell.read();

Hello Hammy,
Thanks for your answer and the code. I'll save your code for now until I finally have the hardware in my hands.

Do you think the code you provided is complete and will work for my purpose?

Kindest regards,
Tsheten :slight_smile:

TSHETEN_DORJI:
Do you think the code you provided is complete and will work for my purpose?

It clearly isn't complete and wasn't intended to be. Just a skeleton for you to build a sketch around.

Hmm.. Robotshop.com sells a 2-channel load cell shield. It also seems like the code can be downloaded for free from their website

https://www.robotshop.com/en/strain-gauge-load-cell-amplifier-shield-2ch.html

Does anyone think this could be the solution I've been looking for? Will this load cell shield allow for wiring both load cells to the arduino and take their separate readings at the same time?

Regards

Yes, I think it could be the solution you are looking for, based on the very little information you have given so far. You have said nothing about the range, precision or sample rate you need, for example. Or how & what you will connect the Arduino to, in order to store, view and analyse the data.

You said that you would prefer to use the separate 2 X hx711 amps and that you would "love not to use" this shield but you have not explained why you feel that way.

Hello PaulRB,
I want to use PLX DAQ (MS-EXCEL) to store and plot the data. And in all honesty, I've no idea about the sampling rate, etc... Is it baud rate you're talking about?

And I would love not to use shield because I was thinking it would be cheaper and easy for me to not use a shield. But it seems like I was wrong. Not using the shield seems more complicated due to the complex code required.

However, should this shield serve my purpose I would love to use it and save myself from badly scratching my head over a glitchy code. LOL!

Regards

No, sample rate is the number of readings per second (or minute or hour) you want to capture from the load cells. Baud rate is the speed of data sent along a serial line, for example from the Arduino back to the pc.

I'm not sure I understand your argument about code complexity using this shield compared to building your own circuit with hx711 chips. Both the shield and the hx711 seem to have Arduino libraries which include example sketches, but I doubt either library will have an example sketch which will do exactly what you want. So in either case you will have to modify and enhance the example sketches for your application. I imagine the challenges that presents will be similar whichever of the two approaches you decide on.

To me, the advantage of using the shield is simpler wiring. The code will be basically identical.

Do you need to log any other data? Angle of attack, airspeed, temperature, density? Tou may need to stack a few shields to add those sensors.

Processing the HX711 data is important. Usually you woukd run the DAC at its native speed (10Hz or 80Hz for the HX711) and then apply some averaging before sending out the Serial summary data.

Hello PaulRB,
Thank you for the clarification. So, either way it's a challenge facing me.

MorganS, I of course would love to log and plot other data as well. But that would also mean added complexities with the code, right? Anyways, lift and drag are what I'm mainly after.

Regards

Then you don't need an Arduino. 2 bathroom scales could do the same job.

Otherwise you just have a big long list of numbers with no idea what test point they relate to.

Hello MorganS,
I totally agree with you!! :slight_smile:

Regards

Downloaded a library for the load cell shield. DO you think it's going to work? I'm a little impatient although I've yet to receive the arduino board:

/* Wheatstone Bridge Interface - Library */

/*
This library was created by Sébastien Parent-Charette for RobotShop.
It is meant to be used with the RB-Onl-38 from RobotShop.
This product is available here: http://www.robotshop.com/en/strain-gauge-load-cell-amplifier-shield-2ch.html
This library may work with other WheatStone bridge interface boards that use an analog pin for input.

Changes history:
2016-07-28
v1.10-16
Changed output to be on one line.
Corrected default init of strain1 to be 1000 (instead of 750).

2016-04-21
v1.10-08
Added reading and display of both load cells to the basic example.

2015-10-08
v1.0
First release of the library. Basic functionality is available.
*/

#include <WheatstoneBridge.h>

WheatstoneBridge wsb_strain1(A0, 365, 675, 0, 1000);
WheatstoneBridge wsb_strain2(A1, 365, 675, 0, 1000);

void setup()
{
Serial.begin(9600);
Serial.println("< Wheatstone Bridge Interface to Serial >");
Serial.println("");
}

int val1;
int valRaw1;
int val2;
int valRaw2;

void loop()
{
// Read strain 1
val1 = wsb_strain1.measureForce();
valRaw1 = wsb_strain1.getLastForceRawADC();
Serial.println(">> Strain 1 << ");
Serial.print("\tRaw ADC value: ");
Serial.print(valRaw1, DEC);
Serial.print("\t\t");
Serial.print("\tCalculated force: ");
Serial.println(val1, DEC);
delay(100);

// Read strain 2
val2 = wsb_strain2.measureForce();
valRaw2 = wsb_strain2.getLastForceRawADC();
Serial.println(">> Strain 2 << ");
Serial.print("\tRaw ADC value: ");
Serial.print(valRaw2, DEC);
Serial.print("\t\t");
Serial.print("\tCalculated force: ");
Serial.println(val2, DEC);
Serial.println("");

// Delay for readability
delay(1000);
}

/* Wheatstone Bridge Interface - Library */

Regards

Please read the forum guide in the sticky post, then modify your post above and put in the code tags.

To be honest , I think you need to just play with the board for a while , using the IDE examples - learn a bit of coding , then assess what is needed for your project, what is easy/hard . Then start in small steps and try out different aspects of the project.
Your growing spec is implying a complex project for someone starting out.

Agreed, Hammy. :slight_smile:

Regards