Kimb,
What is the general purpose of your project?
Does this code work?
What library are you using?
Paco
loadcell_kimb_sample.ino (1.08 KB)
Kimb,
What is the general purpose of your project?
Does this code work?
What library are you using?
Paco
loadcell_kimb_sample.ino (1.08 KB)
For those who want to measure more then one load cell here is 4 cell configuration code with EEprom saving and tare function. All settings and readings are done by serial monitor. Adapt code to your need if you want to use other functions like button presses. Code reworked but not tested! Let me know if there is a problem. Only use Bogde HX711 library not other xx711 library.
Edit 27-4-2016
Go to post #108 for latest WORKING version.
HX711_4_loadcells_simple_web_1.ino is not working properly in calibration mode
Edit 8-4-2016
Calibration of the loadcells in this sketch is easy.
By serial monitor type c and the value you use in grams for calibration for example c345 (345 grams) and press send.
By serial monitor type s and press send and follow the messages in the serial monitor step by step. Everytime you send s by serialmonitor a step counter is raised and each step performs a calibration step.
When finished the calibration values are stored and the Arduino rebooted.
By serial monitor type z to tare all weigth values to ZERO.
More simple as this I cant make or explain it.
Paco
HX711_4_loadcells_simple_web_1.ino (10.5 KB)
Hi, I just stumbled on this thread whilst trying to find information on this, thanks. I have tried to run your code (@backbone) but I am not getting the right readings. My setup is using three load cells connected to 3-HX711. I have followed the steps carefully but to no avail. I don't know what I am doing wrong, the setup is working ok for the individual load cells using this guide ( Load Cell Amplifier HX711 Breakout Hookup Guide - SparkFun Learn ). Could you please advise if I am doing anything wrong or how I could change the code "ValueOut" to use a known Calibration value.Thanks
I have done it this way however I can't get to calculate the average of load cells 1 and 2 for the same weight. Could some one here help please, this part (//Weight Out_1 "Kg" Average of two load cell_1_&_2)
//Weight Out_1 "Kg" Avarage of two load cell_1_&_2)
weight1 = (scale1.get_units(), 1);
weight2 = (scale2.get_units(), 1); //scale.get_units() returns a float
Serial.print(((weight1) + (weight2))/2);
Serial.print("Kg ");
Thanks.
HX711_Scale_F.ino (3.13 KB)
If you use the simple web sample from #101 do not change anything in the code but run it as described. It does not matter if there are 1 -2 -3 or 4 loadcells connected.
Just replace in the void loop
Serial.print("LC1, ");
Serial.print(ValueOut1);
Serial.print(" LC2,");
Serial.print(ValueOut2);
Serial.print(" LC3,");
Serial.print(ValueOut3);
Serial.print(" LC4,");
Serial.println(ValueOut4);
to
Serial.print("LC1, ");
Serial.print(ForceValueRaw1);
Serial.print(" LC2,");
Serial.print(ForceValueRaw1);
Serial.print(" LC3,");
Serial.print(ForceValueRaw1);
Serial.print(" LC4,");
Serial.println(ForceValueRaw1);
This will show if the load cells are working by presisng them with the sample code.
If this works please report back with a YES or a NO.
If YES we can do a next step if NO then you have to check your design.
I do not have much time to frequent the forum so if it takes to long to get an answer sorry.
Paco
Yes I am getting some readings from LC. When I put a known weight on the LC platforms the readings varies upwards. They all display the same reading though even when I put different weights on each one of them they all show the same weight including LC4 even though there's nothing connected.
When I used the simple web sample to try again:
I have upgraded to Arduino IDE 1.6.8 and tried the code in post #101 (HX711_4_loadcells_simple_web_1) and got an error which I couldn't understand:
"Arduino: 1.6.8 (Windows 10), Board: "Arduino/Genuino Uno"
...
exit status 1
'HX711 Loadcell1' previously declared here"
Then I tried with an older version of the IDE 1.0.5 and the exactly same code was compiled without errors.
Does anybody know the reason? Why does the new IDE version not compile the code correctly?
Thanks
Petri
@ Aggins does the file from #89 work for you?
Make that work first.
@ Petri I compile and tested all upto version 1.6.5 on Windows 7.
Paco
Whow me bad....as I told I did not tested the last version.
I found a bug in the calibration sequence.
Today 27-04-2016 I reworked the sketch and lowered the number of Serial s presses for convenience.
Sorry for any inconvenience caused.
New tested sketch with 4 load cells working attached.
Hi. I try a mini simulation for weight measurement using load cell 5Kg and Hx711 and I use VB.NET for the interface. It's work because I guided by this forum.
So I start to the main problem, I need to measure 200KG weight but I don't know what ADC that I should use. The load cell that I use is from USCell. Thanks
Hi all. I am revisiting this project in the hope to make a beehive scale. All I want to be able to do is send twice daily weight updates, via GSM. Ideally these values will be plotted on a graph, initially looked at using Xively.
I am using HX711 with a shear beam load cell. Currently I have modified code to run an autocalibration sketch. I place a known weight (currently 3 kg) and the sketch adjusts the calibration factor until the weight output is correct and reading 3.00 at which point the calibration factor adjustment stops. Ultimately I will have it run this code only when pin, HIGH and a switch is on to start calibration. The calibration factor will then be stored using EEPROM for future use.
I see the sketch used to connect 4 x load cells, what I don't understand is if this is to produce 1 x weight output (i.e. 4 x load cells but only 1 x weight platform??) or is it to weigh 4 x separate objects and return 4 x individual weights? For the mechanical side of my scale I would like to use 2 x shear beam load cells as these will provide the support to the weighing platform and heavy beehive but I would only like to have 1 x weight output from the collective reading from the 2 x load cells. From what i can tell a shear beam type cell is already in a wheatstone bridge? - I can simply join the appropriate wires from 2 x load cells and solder to the appropriate points on the HX711 board?? sorry for the basic question, I am trying to use this project to learn a new skill too!
Hadn't seen the great calibration sketch provided by backbone - awesome!! my sketch is super crude/simple vs yours, I presume yours is a much more robust method to calibrate? - in order to learn could someone pull apart my code vs backbones? - it seems to work the same in the sense that my calibration factor adjusts appropriately dependent on the weight output. Maybe someone here can point out when it wouldn't work? This is the first piece of code I have ever written, so just trying to learn cleaner ways to achieve things, not to mention just getting my head around the logic of code structure!!
I will probably use backbones' calibration sketch and just have it run when switch on, will replace the serial weight prompts with led prompts, ie when red led flashing in calibration mode, when red light solid On place known weight on now (will have to set this is the sketch, probably to 20kg) when green led on, calibration complete.
Thanks for the time.
Hmm.. have to work how to share code..
#include "HX711.h"
#define DOUT A1
#define CLK A0
HX711 scale(DOUT, CLK);
//int buttonPin = 2; //Calibration swithch connected to digital pin 2. Switch on runs calibration sketch
int greenLed = 13; // Onboard Green LED to indicate calibration sketch running
//int redLef = 4; // Red LED connected to digital pin 4 to indicate calibration sketch not running
//int buttonState = 0; // variable for reading the pushbutton status
//bool exitLoop = false;
float calibration_factor = -14990;
//int weightVariable;
void setup() {
// pinMode(buttonPin, INPUT);
pinMode(greenLed, OUTPUT);
// pinMode(redLed, OUTPUT);
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: ");
Serial.println(zero_factor);
Serial.print("Place known weight on now");
delay (5000);
}
bool testWeight() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
// weightVariable = scale.get_units();
Serial.println(" reading: ");
Serial.println(scale.get_units(10));
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
if (scale.get_units() == 3.000){
Serial.println("Calibration complete");
//// digitalWrite(greenLed, HIGH); // turn the LED on (HIGH is the voltage level)
//// delay(1000); // wait for a second
//// digitalWrite(greenLed, LOW); // turn the LED off by making the voltage LOW
//// delay(1000);
return true;
}
if (scale.get_units() < 3.000) {
calibration_factor += 10;
return true;
}
if (scale.get_units() > 3.000) {
calibration_factor -= 10;
return true;
}
// return false;
}
void loop() {
// buttonState = digitalRead(buttonPin);
// if (buttonState == HIGH) {
// testWeight
// }
if(testWeight())
{}
// Serial.print("Reading: ");
// Serial.print(scale.get_units(5));
// Serial.print(" kgs"); //
// Serial.print(" calibration_factor: ");
// Serial.print(calibration_factor);
// Serial.println();
}
The sketch I made is to measure 4 seperate load cells and print their individual values.
If using two load cells add the values and devide by 2, cant be more simple.
Although the calibration sequence is set up for 4 load cells if you just connect 2 and run full sequence (last two are just no weight differences) it all should work. If you think you can upgrade my code please do so.
Paco
I have been using 4 load cells with the HX711 for some time now. I'm not sure that this thread isn't over-complicating things - but feel free to correct me if I'm wrong.
What I do is wire the 4 cells up in parallel before they are connected to the HX711 inputs. I just solder them together on a piece of vero board (so its all the same coloured wires connected to each other).
Seems to work fine. The 4 cells are then positioned at the bottom corners of the load I'm weighing (yes it's a beehive!) and consequently the load is distributed across them all. Calibrate and away you go.
I use the Sparkfun Load Cell Amplifier board. They do have a Combinator board that someone mentioned in this thread, but this is for 3 wire load cells (the sort you hack out of bathroom scales) rather than the 4 wire Z bar cells.
awootton, what type of cells did you used for the hive scale?
Hi,
I’m working in one project and i want make a load cell wich send a signal everytime that the threshold quantity is reached , i don’t know if i can do this with a load cell+HX711 and an Arduino Yun, all exemples wich i saw was with an Arduino Uno,
i dont want to buy materials befor to be reassured that’s feasible , plus i want know if this kind of kit “load cell+HX711” is good , i share the links with you:
https://www.zartronic.fr/balance-3kg-carte-hx711-p-473.html?zenid=n1a8r169rfar9qkdqe5mq5o613
http://www.elecrow.com/weight-sensor-scales-kit-20kg-p-714.html
tnk u so much for ur help..
I would say that either one of them is too big or too small for your project. Or maybe both are good or useless. Can't say which is which, since you didn't mentioned what your maximum threshold limit is.
i don't know if i can do this with a load cell+HX711 and an Arduino Yun, all exemples wich i saw was with an Arduino Uno,
Yes you can, hx711 requires only a pair of general purpose digital pins.
Why use Yun since any cheap AVR-only Arduino is good enough?
Look at the product page, ArduinoYun is basically a Leonardo + small Linux computer on the same board. https://www.arduino.cc/en/Main/ArduinoBoardYun
Hi guys,
I have a strange problem.
I used 4 loadcells from a bathroom scale, connected them to HX711 and Arduino Uno.
The original scale says it can weight up to 150kg.
When I put 10kg bucket with water on it, I can calibrate it to show 10kg, but then when I step on the scale, it shows 40kg (I weight 70kg).
When I calibrate it so it shows 70kg when I step on it, then it shows the bucket weights 20kg (it should weight only 10).
Could it be I did something wrong that the readings are non-linear? How can I fix this?
thank you
can you show wiring diagram (cells, hx711 arduino and power) and code?
It was this scale:
sensors had red, black and blue wires.
Red wires were soldered to the original logic board to E+ (LR), E- (LL), S+ (UR) and S- (UL) contacts.
Blue wires from UR and LR were soldered together on the logic board, so I kept it this way.
The same for blue wires on UL and LL.
Only black wires were not soldered together but to contacts on the logic board, I connected them according to the Sparkfun sensor combination board schematics:
I will try different combination later, but if you can spot the error immediately, I'll be very grateful.
From the stackexchange thread,
This shows how the four load cells should be connected to form a full wheatstone bridge:
And this shows how that bridge needs to be interfaced to HX711 chip:
If that's correctly made with your sparkfun's combinator board it's up to you to verify.
And you didn't post your code. Use code tags and post it here, I won't care to guess which code in which page you linked here (or not) you actually used.