Difference between revisions of "Component: Load Cell (HX711) (Force)"
(Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix TSL |- | width="20%" style="color:gray;" | Version | 2.0 |- | width="20%" style="color:gray...") |
|||
Line 16: | Line 16: | ||
==Detailed description== | ==Detailed description== | ||
+ | |||
+ | |||
''No detailed description exists yet for this component'' | ''No detailed description exists yet for this component'' | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
Line 601: | Line 605: | ||
|- | |- | ||
| colspan="2" | Initialise the comms to the Arduino board ready for commands to be sent. | | colspan="2" | Initialise the comms to the Arduino board ready for commands to be sent. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PWMEnable''' | ||
+ | |- | ||
+ | | colspan="2" | Allows pulse width modulated transistor outputs to be switched on or off. Bit 0 = Enable AB Bit 1 = A / Bit 2 = B Bit 3 = C / Bit 4 = D Bit 5 = Enable CD | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | EnableMask | ||
+ | |- | ||
+ | | colspan="2" | Range 0-63 or 0b00000 to 0b111111 | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' | ||
+ | |- | ||
+ | | colspan="2" | | ||
|- | |- | ||
|- | |- |
Revision as of 10:39, 17 November 2021
Author | Matrix TSL |
Version | 2.0 |
Category | Force |
Contents
Load Cell component
The HX711 load cell amplifier is used to get measurable data out from a load cell or strain gauge.
Detailed description
No detailed description exists yet for this component
Examples
A simple example showing how to get a meaningful reading out of the HX711 IC connected to a load cell sensor. Zeros/Tares the reading when the switch is pressed.
The scale factor was determined by performing calibration with a unity scale of 1.0 and fixed weight weights. A table of weight vs reading was constructed to provide the correct scale factor.
Here is a guide to calibrate your sensor
When 0g was present on the load cell we zero the output.
When 10g was present on the load cell we get a reading of approx 2170.
2170 / 10g = 217 per g.
When 20g was present on the load cell we get a reading of approx 4340.
4340 / 20g = 217 per g.
1 / 217 = Scale Factor of 0.004608
The readings may not be 100% linear so it's best to take several samples based on different weights across the range you want to be able to measure and from this you can work out a close fitting average.
Downloadable macro reference
![]() |
SetScaling |
Sets the scaler for the samples to provide a meanningful value. Default scaler is set to 1.0 | |
[[File:]] - | Scaler |
Unity Scale = 1.0 | |
![]() |
Return |
![]() |
ScaledSample |
Takes a raw sample and then applies the scaling factor to return a real world value. | |
[[File:]] - | Return |
![]() |
Zero |
Zeros the reading at the current sample | |
![]() |
Return |
![]() |
Initialise |
Initialise the component by loading the default calibration table | |
![]() |
Return |
![]() |
Initialise |
Initialise the sensor configuration as set by the component properties | |
![]() |
Return |
![]() |
Initialise |
Initialises the component ready for I2C communications | |
![]() |
Return |
![]() |
Initialise |
Sets up up the communication bus and initialises the accelerometer module. Returns 0 for success and > 0 for fail. | |
![]() |
Return |
![]() |
SimSetGyro |
Allows the XYZ slider values to be set via the simulation | |
[[File:]] - | X |
[[File:]] - | Y |
[[File:]] - | Z |
![]() |
Return |
![]() |
UpdateAccelerometerData |
Reads from the accelerometer and updates the local XYZ variables. Returns 1 for new data and 0 for no new data | |
![]() |
Return |
![]() |
SimSetCompass |
Allows the XYZ slider values to be set via the simulation | |
[[File:]] - | X |
[[File:]] - | Y |
[[File:]] - | Z |
![]() |
Return |
![]() |
Initialise |
Sets up up the communication bus and initialises the accelerometer module. Returns 0 for success and > 0 for fail. | |
![]() |
Return |
![]() |
IOSetOutputPin |
Sets the selected digital pin to an output and assigns the output state. | |
![]() |
Pin |
Range: 0-29 | |
[[File:]] - | State |
Range: 0-1 | |
![]() |
Return |
![]() |
UARTReceive |
Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available. | |
![]() |
Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
![]() |
Return |
![]() |
OneWireScanBus |
Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found. | |
![]() |
Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
![]() |
Return |
![]() |
SPIInitialise |
Initialsie the SPI module ready for communications | |
![]() |
Channel |
Channel Index: Range 0 - SPI Bus Count - 1 | |
![]() |
Return |
![]() |
OneWireReceiveByte |
Receives a byte from the one wire bus a bit at a time | |
![]() |
Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
![]() |
Return |
![]() |
I2CSend |
Transmit a byte using the I2C bus | |
![]() |
Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
![]() |
DataOut |
[[File:]] - | Return |
![]() |
UARTSend |
Send a byte via the UART module | |
![]() |
Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
![]() |
Data |
Data Byte to send. Range: 0-255 | |
![]() |
Return |
![]() |
OneWireGetDeviceCount |
Returns the number of devices found by the last ScanBus operation. | |
![]() |
Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
![]() |
Return |
![]() |
PWMSetPrescaler |
Sets the prescaler for the PWM output | |
![]() |
Channel |
Range: 0 - 11 | |
![]() |
Prescaler |
![]() |
Period |
![]() |
Return |
![]() |
PWMEnable |
Enable a PWM output | |
![]() |
Channel |
Range: 0-11 | |
![]() |
Return |
![]() |
Initialise |
Initialise the comms to the Arduino board ready for commands to be sent. | |
![]() |
Return |
![]() |
Initialise |
![]() |
Return |