I'm trying to break into the world of Arduino's and have no clue where to start. I'm in no rush and really want to learn this and more.
My project is to find the forces exerted on a screw (simply put) and I'd like to use an Arduino to record the forces. So I need to get positive and negative forces on all 3 axis and log the data in real time to be put into excel for calculations.
I have people that can help me trouble shoot any code problems. Before I get that far I need assistance with the hardware selection tho. I'm sure I'll need more help along the way because, honestly, the get started stuff is simply in a language I don't understand just yet. I assure you I will learn and I appreciate your help and patients.
I'm looking at:
Starter kits
Load sensors
And control board?
EDIT: This project is working and moved into stage 2. The code for this project is on page 3 along with questions for stage 2.
The Starter Kit looks good, only the 9V block battery is not very useful with Arduino projects.
The Load Sensors are for 50kg force/weight, how much force do you intend to apply to the screw?
These sensors are quite big, do you have enough space on your "screw" for mounting them?
Rotational forces also can occur, you'll need 6 sensors to measure these as well.
In general you should only buy components coming with data sheets and Arduino libraries and example code.
The extent of my knowledge is being able to identify a resistor. The getting started pages here are still a bit over my head. If there is someone that can remember what it was like to get started and point me in the right direction that would be great. I've got a school project I'd like to accomplish with the arduino that I posted about yesterday. However, I may be asking the wrong questions as a result of not knowing what or how to ask just yet.
FirstRodeo:
My project is to find the forces exerted on a screw (simply put) and I'd like to use an Arduino to record the forces. So I need to get positive and negative forces on all 3 axis and log the data in real time to be put into excel for calculations.
As with many Arduino projects, it's a lot harder and more complex than you may think.
What sensors exactly do you plan to use?
How do you plan to mount those sensors to your screw, to measure the force without influencing the force or the way the screw is used? Screws tend to be small, and forces large.
Do you want to look for tensile or rotational forces? There indeed are six, not three.
When you know all that, you can start to look at what hardware there may be available that can do what you want to measure.
wvmarle:
As with many Arduino projects, it's a lot harder and more complex than you may think.
What sensors exactly do you plan to use?
The sensors shared in the link above are my initial thoughts. However, I am open to any suggestions as they are the only ones I am aware of. The half bridge is enough accuracy for my needs. I also intend to get the amplifier to make them work. If there is a sensor that is better at the job I'll take it. If there is a way to get positive and negative results, that would be ideal as I need pullout force as well as drive in force.
wvmarle:
How do you plan to mount those sensors to your screw, to measure the force without influencing the force or the way the screw is used? Screws tend to be small, and forces large.
The screw will be encased in a solid material and the sensors surrounding the material. I expect acceptable error percentage from this method. However, the pullout force still have some investigating to be done. The cad work is still in development.
wvmarle:
Do you want to look for tensile or rotational forces? There indeed are six, not three.
I'm sorry I don't fully understand the direction of this question. However, I will need every force acting on the object, so both?
wvmarle:
When you know all that, you can start to look at what hardware there may be available that can do what you want to measure.
Your description of the project doesn't seem to match what you say you want to measure.
As I understand it, you take a screw, encase it in some material, then grab it and pull it out, all the while measuring the force it takes to do this pull.
That'd be a single direction tensile force. That's a whole different thing than trying to measure rotational and tensile forces in all directions all at the same time. The first is very easy. The second may be nigh impossible.
A simple 4DOF joystick with only switches can detect movement left/right, back/fwd, up/down, and cw/ccw turns. It can be used to e.g. activate motors while the related contact is closed.
Question is what you intend to do with the forces, i.e. what shall happen if the stick is pushed into one direction, and what when it is released afterwards. In this case the motor speed can follow the force, or what else shall the force value be used for?
According to your last reply it looks to me like you do not want to build a joystick at all. The pullout and drive in force can be understood in two ways: brute linear force in in/out direction, or torque required to drive the screw in and out (for electric screwdriver...). So what's the way you apply the force to the screw?
wvmarle:
Your description of the project doesn't seem to match what you say you want to measure.
It appears you would like a full description of the problem to make a better determination. I have an engineering project for my college statics course. The following actions will be performed to complete this project:
• Calculate the maximum amount of force every mechanism can handle while maintaining smooth operation of the hinges and locking mechanism.
• Create a model of a typical door and its mechanisms.
• Compare experimental results with analytical calculations
My idea to attack this problem is to 3d print an entire door, frame and hinges. Around the screw area (of every screw) there will be a place to embed the load censors on the axis of the screws. The screws and door will be scaled to accept the size of the load censors. (if there are smaller ones, I'd love to know about them. The ones I'm looking at are 32x32mm)
wvmarle:
As I understand it, you take a screw, encase it in some material, then grab it and pull it out, all the while measuring the force it takes to do this pull.
As I hope is more clear now, I will need to measure the static forces placed on a door in open and closed positions. So a simple pull test will not suffice.
wvmarle:
That'd be a single direction tensile force. That's a whole different thing than trying to measure rotational and tensile forces in all directions all at the same time. The first is very easy. The second may be nigh impossible.
Now that we know we're dealing with the later, the hardware needed for the theoretical project is what I believe I need. The the design, location and assembly I am most certain I can handle. The code should be easy enough to make work with the help of my wife. She is a very capable programmer (not in C++, but she can pick up any syntax fairly quickly).
Hope I'm not leaving to many unanswered questions. As time goes on I assure you I will grasp more and more concepts, once I get some kind of baseline. Thank you for your patients!
Sounds like it's mostly an engineering problem. You don't just place such sensors in critical spots - the door has to be suspended directly from them. So the hinge attaches to the force sensor, which attaches to the door frame.
Now you can also see the problem of measuring multiple axis at the same time: they will affect one another, as in the end your sensors basically share the weight. The door having to hinge in the process just adds a lot to the complexity of the whole system.
wvmarle:
Sounds like it's mostly an engineering problem. You don't just place such sensors in critical spots - the door has to be suspended directly from them. So the hinge attaches to the force sensor, which attaches to the door frame.
Now you can also see the problem of measuring multiple axis at the same time: they will affect one another, as in the end your sensors basically share the weight. The door having to hinge in the process just adds a lot to the complexity of the whole system.
Exactly! However, right now the engineering isn't my problem. I am trying to figure out the hardware needed to collect the data just on the arduino side. I'm no expert, but already somewhat familiar with testing methods. I believe I can make it work.
DrDiettrich:
The Starter Kit looks good, only the 9V block battery is not very useful with Arduino projects.
I have found a similar kit with a plug in adapter. But, my questions still are; how many cells can I run on this arduino uno? Will there be anything needed in addition to this kit (excluding load cells and amplifiers for the cells)?
DrDiettrich:
The Load Sensors are for 50kg force/weight, how much force do you intend to apply to the screw?
The force at this time on any single cell is estimated to be less than 25kg.
DrDiettrich:
These sensors are quite big, do you have enough space on your "screw" for mounting them?
The project will be scaled to allow space for the sensors. If you know of smaller ones, I'd love to hear of them.
DrDiettrich:
Rotational forces also can occur, you'll need 6 sensors to measure these as well.
I believe that you are referring to the rotational torque of driving the screw in? If so we do not need to measure that force. In the setup I am creating I do not anticipate any torque force that could not be analyzed in their component forms. So, for now, x,y,z axis measurements will do.
DrDiettrich:
In general you should only buy components coming with data sheets and Arduino libraries and example code.
I'm afraid I'm not yet fully familiar with all of the nuances of each of these and their purposes. I'll look into each.
Thanks Dr. Diettrich and wvmarle. You both are helping lots.
FirstRodeo:
It appears you would like a full description of the problem to make a better determination. I have an engineering project for my college statics course. The following actions will be performed to complete this project:
• Calculate the maximum amount of force every mechanism can handle while maintaining smooth operation of the hinges and locking mechanism.
• Create a model of a typical door and its mechanisms.
• Compare experimental results with analytical calculations
There remain more questions than before
I hope to find the right English wording, I'm not very familiar with the physical terms related to your task.
Your load cell sensors require that the force is applied at right angle, to the bracket on their tops. They are designed for measuring positive forces only. The set of 4 sensors is intended for building a body scale, where the 4 sensors support the four corners of the step-on platform.
From your statics course you should know about strain, and that's what can be measured with strain gauge sensors, and that's how the load cells work. Of course the strain is related to a force, but only depending on the stretched material's characteristics. Look up how strain gauges can be used to measure linear force and torque, then find out how they can help you in your experiment. The application of strain gauges is a science of its own, because the glue must hold them exactly in place, without any displacement under stress (creeping,...), so that the elongation of the gauge reflects perfectly the elongation of the surface to which they are glued. That's why readily usable components are used in serious applications, with already mounted strain gauges, but load cells certainly are not applicable to your task. Find out what other components are available, and figure out how these could be used in your task.
As the strain depends on the stressed material, I have no idea how to map values measured on a (down-scaled?) plastic model, to some other door mounted to a wooden (metal, stone...) door case.
All these questions are not related to an Arduino at all, I'd suggest that you ask your teacher about these details of your task. Or you tell us more about the values obtained from the analytical calculations, so that we can find ways to measure their equivalents on the 3D printed model.
FirstRodeo:
I have found a similar kit with a plug in adapter. But, my questions still are; how many cells can I run on this arduino uno? Will there be anything needed in addition to this kit (excluding load cells and amplifiers for the cells)?
A typical amplifier takes four load cells, but is designed to treat them as a single measurement. Typical under a single plate on which the load is placed, like a typical scale.
How many you can connect to a single Arduino depends on many factors, such as sampling rate, type of Arduino or other microprocessor, and the interface with the load cell amplifier. A better approach is to figure out how many of such load cells you need, then you see how you can interface them, and then you will see what microprocessor you need.
wvmarle:
A typical amplifier takes four load cells, but is designed to treat them as a single measurement. Typical under a single plate on which the load is placed, like a typical scale.
How many you can connect to a single Arduino depends on many factors, such as sampling rate, type of Arduino or other microprocessor, and the interface with the load cell amplifier. A better approach is to figure out how many of such load cells you need, then you see how you can interface them, and then you will see what microprocessor you need.
Thanks! That was the(main one anyway) answer I was looking for. I'll keep y'all updated as I progress. It will be a slow process. The project isn't due until December. As I come up with more problems I hope I can come back for more answers.
DrDiettrich:
There remain more questions than before
I hope to find the right English wording, I'm not very familiar with the physical terms related to your task.
Your load cell sensors require that the force is applied at right angle, to the bracket on their tops. They are designed for measuring positive forces only. The set of 4 sensors is intended for building a body scale, where the 4 sensors support the four corners of the step-on platform.
From your statics course you should know about strain, and that's what can be measured with strain gauge sensors, and that's how the load cells work. Of course the strain is related to a force, but only depending on the stretched material's characteristics. Look up how strain gauges can be used to measure linear force and torque, then find out how they can help you in your experiment. The application of strain gauges is a science of its own, because the glue must hold them exactly in place, without any displacement under stress (creeping,...), so that the elongation of the gauge reflects perfectly the elongation of the surface to which they are glued. That's why readily usable components are used in serious applications, with already mounted strain gauges, but load cells certainly are not applicable to your task. Find out what other components are available, and figure out how these could be used in your task.
As the strain depends on the stressed material, I have no idea how to map values measured on a (down-scaled?) plastic model, to some other door mounted to a wooden (metal, stone...) door case.
All these questions are not related to an Arduino at all, I'd suggest that you ask your teacher about these details of your task. Or you tell us more about the values obtained from the analytical calculations, so that we can find ways to measure their equivalents on the 3D printed model.
As more details become Available, I will surely share the data. The strain gauge was my initial thought. However I had read that the accuracy was much less reliable. Could you recommend a tiny strain gauge to experiment with? And would I need a different amplifier than the one in the link above? I called it a "control board" in the first post, before I knew slightly more about it.
I cannot recommend a special strain gauge nor amplifier. Load cells are fine for your first steps, later you'll have to consult application notes on mounting strain gauges.
So I've run into a few issues. Hoping you guys may have some insight. I am able to get the half bridge load cells from the first post to run by using 100ohm resistors to complete the bridge. Below I've posted a cheap diagram I drew (from load cell to amplifier to uno), the cpp code, test code, and the calibration code that I've started with. Took me quite some time to get that far. But now my problem is that there is some negative drift in the readings from the load cells. e.g. I put a weight on the cell, get it calibrated and after a very short time (seconds) the given weight value consistently falls.
//>>>>>>>>>Here is the HX711.cpp
#include <Arduino.h>
#include <HX711.h>
HX711::HX711(byte dout, byte pd_sck, byte gain) {
PD_SCK = pd_sck;
DOUT = dout;
pinMode(PD_SCK, OUTPUT);
pinMode(DOUT, INPUT);
set_gain(gain);
}
HX711::~HX711() {
}
bool HX711::is_ready() {
return digitalRead(DOUT) == LOW;
}
void HX711::set_gain(byte gain) {
switch (gain) {
case 128: // channel A, gain factor 128
GAIN = 1;
break;
case 64: // channel A, gain factor 64
GAIN = 3;
break;
case 32: // channel B, gain factor 32
GAIN = 2;
break;
}
digitalWrite(PD_SCK, LOW);
read();
}
long HX711::read() {
// wait for the chip to become ready
while (!is_ready());
unsigned long value = 0;
byte data[3] = { 0 };
byte filler = 0x00;
// pulse the clock pin 24 times to read the data
data[2] = shiftIn(DOUT, PD_SCK, MSBFIRST);
data[1] = shiftIn(DOUT, PD_SCK, MSBFIRST);
data[0] = shiftIn(DOUT, PD_SCK, MSBFIRST);
// set the channel and the gain factor for the next reading using the clock pin
for (unsigned int i = 0; i < GAIN; i++) {
digitalWrite(PD_SCK, HIGH);
digitalWrite(PD_SCK, LOW);
}
// Datasheet indicates the value is returned as a two's complement value
// Flip all the bits
data[2] = ~data[2];
data[1] = ~data[1];
data[0] = ~data[0];
// Replicate the most significant bit to pad out a 32-bit signed integer
if ( data[2] & 0x80 ) {
filler = 0xFF;
} else if ((0x7F == data[2]) && (0xFF == data[1]) && (0xFF == data[0])) {
filler = 0xFF;
} else {
filler = 0x00;
}
// Construct a 32-bit signed integer
value = ( static_cast<unsigned long>(filler) << 24
| static_cast<unsigned long>(data[2]) << 16
| static_cast<unsigned long>(data[1]) << 8
| static_cast<unsigned long>(data[0]) );
// ... and add 1
return static_cast<long>(++value);
}
long HX711::read_average(byte times) {
long sum = 0;
for (byte i = 0; i < times; i++) {
sum += read();
}
return sum / times;
}
double HX711::get_value(byte times) {
return read_average(times) - OFFSET;
}
float HX711::get_units(byte times) {
return get_value(times) / SCALE;
}
void HX711::tare(byte times) {
double sum = read_average(times);
set_offset(sum);
}
void HX711::set_scale(float scale) {
SCALE = scale;
}
float HX711::get_scale() {
return SCALE;
}
void HX711::set_offset(long offset) {
OFFSET = offset;
}
long HX711::get_offset() {
return OFFSET;
}
void HX711::power_down() {
digitalWrite(PD_SCK, LOW);
digitalWrite(PD_SCK, HIGH);
}
void HX711::power_up() {
digitalWrite(PD_SCK, LOW);
}
/*
>>>>>>>>>Here is the Arduino code for the example I am running.
Example using the SparkFun HX711 breakout board with a scale
By: Nathan Seidle
SparkFun Electronics
Date: November 19th, 2014
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
This example demonstrates basic scale output. See the calibration sketch to get the calibration_factor for your
specific load cell setup.
This example code uses bogde's excellent library: https://github.com/bogde/HX711
bogde's library is released under a GNU GENERAL PUBLIC LICENSE
The HX711 does one thing well: read load cells. The breakout board is compatible with any wheat-stone bridge
based load cell which should allow a user to measure everything from a few grams to tens of tons.
Arduino pin 2 -> HX711 CLK
3 -> DAT
5V -> VCC
GND -> GND
The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.
*/
#include "HX711.h"
#define calibration_factor -7000.0 //This value is obtained using the SparkFun_HX711_Calibration sketch
#define DOUT 3
#define CLK 2
HX711 scale(DOUT, CLK);
void setup() {
Serial.begin(9600);
Serial.println("HX711 scale demo");
//scale.set_gain(128);
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
Serial.println("Readings:");
}
void loop() {
Serial.print("Reading: ");
Serial.print(scale.get_units(), 1); //scale.get_units() returns a float
Serial.print(" lbs"); //You can change this to kg but you'll need to refactor the calibration_factor
Serial.println();
}
>>>>>>>>>>>>Here is the calibration code
/*
Example using the SparkFun HX711 breakout board with a scale
By: Nathan Seidle
SparkFun Electronics
Date: November 19th, 2014
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
This is the calibration sketch. Use it to determine the calibration_factor that the main example uses. It also
outputs the zero_factor useful for projects that have a permanent mass on the scale in between power cycles.
Setup your scale and start the sketch WITHOUT a weight on the scale
Once readings are displayed place the weight on the scale
Press +/- or a/z to adjust the calibration_factor until the output readings match the known weight
Use this calibration_factor on the example sketch
This example assumes pounds (lbs). If you prefer kilograms, change the Serial.print(" lbs"); line to kg. The
calibration factor will be significantly different but it will be linearly related to lbs (1 lbs = 0.453592 kg).
Your calibration factor may be very positive or very negative. It all depends on the setup of your scale system
and the direction the sensors deflect from zero state
This example code uses bogde's excellent library: https://github.com/bogde/HX711
bogde's library is released under a GNU GENERAL PUBLIC LICENSE
Arduino pin 2 -> HX711 CLK
3 -> DOUT
5V -> VCC
GND -> GND
Most any pin on the Arduino Uno will be compatible with DOUT/CLK.
The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.
*/
#include "HX711.h"
#define DOUT 3
#define CLK 2
HX711 scale(DOUT, CLK);
float calibration_factor = -65; //-7050 worked for my 440lb max scale setup
void setup() {
Serial.println("HX711 calibration sketch");
Serial.begin(9600);
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
}
void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
// previous = scale.get_units();
Serial.print("Reading: ");
// if scale
Serial.print(scale.get_units(), 1);
Serial.print(" kg"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 1;
else if(temp == '-' || temp == 'z')
calibration_factor -= 1;
}
}
A crawling value can result from thermal effects, or integration on open pins. Give your circuit some time for warm up and thermal settling (10 min.), then calibrate and check again. If the value converges to the supply voltage, after some time, check the circuit for unconnected pins or too high resistors.