How would you read the load from a load cell. I know that you must use a HX711 amplifier to amplify the readings etc. so its possible for the board to actually get values from the load cell BUT how do you read them? I am asking this as the amplifier is ADC from what I have seen, so I would have to connect the amplifier to the digital pin. But if I do this, I can only use digitalRead and only return values whether they are high or low. Do I connect the amplifier to the analog pins and just analogRead the values? Sorry if this may come across as naive, I am currently trying to understand load cells.
The amplifier transmits digital data over digital pins, similar as it do, for example, an i2c interface.
Do you read the examples and documentation for Arduino HX711 library?
I see, is there a way to treat the load cell like a potentiometer? Like connecting it to an analog pin and reading values from it, mapping it and then writing it to a digitalpin? Or is there a way to do that with digital pins and the such
no
I do not understand. Please explain in plain word what you try to achieve?
So for example, with a force sensor resistor or potentiometer, you can connect them to the analogpin and read their analog values, and then map those values and analogWrite them to a motor or LED for example.
I have heard that load cells are similar to force sensor resistors, so I had figured they would similar.
1. Fig-1 shows the internal Wheatstone resistor bridge of a typical 20-kg Load Cell which produces only 20 mV signal when 20-kg (Full Load) is applied on it. (It is good if +5V/-5V bias supply could be provided for the Load Cell; otherwise, +5V/0V works well for most of the Load Cells.)
Figure-1:
2. The output signal is too low, which cannot be acquired by the ADC of UNO; so, we need an amplifier and an ADC. Fig-2 is a connection of Load Cell with HX7111 type High Gain Amplifier and 24-bit Serial ADC
Figure-2:
3. The HX711's ADC says ---
(1) Check if conversion is done
(2) Inject 24/25 SCK pulses to bring out 24-bit data from the ADC
4. Load Cell simulation by a potentiometer (Fig-3).
Figure-3:
I see okay, thank you this makes a bit more sense. So does this mean you can do analogRead(A0) or any analog pin, and the value returned would be from 0-1023. so if the max load is 20kg, and you place 10kg on the load cell, the value returned would be ~511. Then would you be able to analogWrite(the returned value) to an LED or motor?
So like a potentiometer, in a way. I hope this makes sense.
if not, would I have to do something like setting 20kg to an analog value = 1023, and 0kg to an analog value = 0. and then use this to write it to motor/led.
The weight for the LSBit of the 10-bit ADC of UNO is: 1100 (Vref)/1023 ~= 1 mV; whereas, the Load cell produces 1 mV signal for 1 kg. The error of the ADC is +/- 2-bit; so, there is a good chance that you cannot measure 2kg weight by the ADC of UNO. Therefore, you have to go with a high gain amplifier and a high size ADC -- the HX711.
Okay, so can you use the HX711 to read the load values from the load cells and return them as analog values in some way, to then later analogwrite them to motor or leds? I do not quite understand, sorry.
Yes!
Oh thank you! Could you elaborate on this further please. How would I be able to go about this? Would I just have to analogRead the values returned by the HX711(taking that, if it is hooked up to a 20kg load cell, that 20kg max load is analog value 1023 and 0kg min load is analog value 0) and then analogWrite these values to the motor or LED? Just like that, or is there something else.
And also I take it that I can connect the HX711 to analog pins, using the image you sent as reference.
Please do not confuse yourself. You can't use analogRead() for taking load values from scale. You must use dedicated library for reading it.
again NO!
The pins A0 A1 on the image are used as digital in that case.
Okay thank you. So I need to use the dedicated library to read it, and then then would I be able to analogWrite() those values to a motor or LED?
Yes
In order to use the data from the load cell for analogWrite() for motor or LED, there is no need for them to be analog
Okay. So simply all I would have to do is read the value from the load cell amplifier(with 20kg being max throttle or brightness, and 0kg being min throttle or brightness), and then depending on the weight(between 20 and 0), I can write the load cell value to the motor or LED and it would work similar to how you would control a motor or LED with a potentiometer
yes, if it requires some transformations of the values - it can be done programmatically, for example by map() function
Right, for the transformation, I could just
value = analogRead(load_value)/4;
and then analogWrite(motor, value); ?
again analogRead() ?
Sorry, perhaps I don't know how to explain it...
Sorry my bad, the value read using the library, and THEN mapping that value by /4, and then analogwriting it to motor or LED
yes