Jump to content

Component: Bridge Amplifier (HX711 / BL0122 / BL0132) (Force)

From Flowcode Help
Revision as of 14:23, 13 July 2026 by SteveT (talk | contribs) (Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead"")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Author Matrix TSL
Version 2.0
Category Force


Bridge Amplifier (HX711 / BL0122 / BL0132) component

The HX711 wheatstone bridge amplifier is used to get measurable data out from a resistive bridge. Common examples include load cells, strain gauges or pressure sensors.

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.


HX711 Example


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.

Macro reference

Initialise

Initialise
Sets up the I/O ready for communications with the HX711 IC and performs an initial sample to set the channel and gain. Must be called before calling other HX711 component macros. 
- VOID Return


RawSample

RawSample
Allows the HX711 to be directly read returning the raw unscaled 24-bit reading. Reading is relative to the last defined Zero point. If a timeout occurs and the HX711 is not ready then we return the last valid reading. 
- LONG Return


ScaledSample

ScaledSample
Takes a raw sample and then applies the scaling factor to return a real world value. 
- FLOAT Return


SetChannelAndGain

SetChannelAndGain
Allows the preselected input channel and gain to be overridden. 
- BOOL Channel
Range: 0-1 / 0=A 1=B 
- BYTE Gain
Channel A can be 128 or 64, Channel B can be 32 
- VOID Return


SetSampleCount

SetSampleCount
Specifies the number of samples to perform when taking a reading. The more samples the more filtered the signal will become from high frequency noise. 
- BYTE NumSamples
Default 1. Range 1-20 
- UINT Delay
Time to wait between samples in milliseconds. 
- VOID Return


SetScaling

SetScaling
Sets the scaler for the samples to provide a meanningful value. Default scaler is set to 1.0 
- FLOAT Scaler
Unity Scale = 1.0 
- VOID Return


Zero

Zero
Zeros the reading at the current sample 
- VOID Return


Property reference

Properties
Input Channel
Selects which channel to sample A or B. Gain settings are channel specific. A Gain can be 128x or 64x B Gain is fixed at 32x 
Input Gain
Gain settings are channel specific. A Gain can be 128x or 64x B Gain is fixed at 32x 
Data
Data pin - connected to HX711 Data Out pin. 
Clock
Clock pin - connected to HX711 SCK pin. 
Clock Transition Delay
Number of microseconds to wait after each clock edge. Max theoretical: 10Hz Mode = 1uS / 80 Hz Mode = 4uS 
Wait For Clock Low
Waits for the clock to go low when performing a sample signifying that a new sample is ready to be collected. 
Use Median Filter
 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Load_Cell_HX711.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Load_Cell_HX711.fcfx