I am currently working on a IOT Project in which I am trying to interface Loadcell and Sparkfun’s Qwiic Scale NAU7802 so that I can read Weight and Show it on Seven Segment Display.
For this I connected Following Pins :-
|ESP32 Pin|Qwiic Scale Pin|
|-------------|---------------|
|36 (GPIO 22) | SCL|
|33 (GPIO 21) | SDA|
|2 (3V3) | 3V3|
|38 (GND) | GND|
First I Calibrated my Loadcell with 5 KgWeight. After that I tried Fetching Weight From Qwiic Scale And Showing it on Seven Segment Display simultaneously using threading.
After Calibrating I placed same 5 kg weight on Loadcell to check readings, But I am getiing variable readings. I tried this loop of calibration and checking the output many many times but my output is still variable. Readings are very Fluctuating, around 50grams for 5kg.
Output I got >>
4.985
5.015
4.965
4.99
5.025
5.04
5.025
5.025
5.025
4.995
5.025
5.01
4.99
5.01
5.01
5.05
4.99
5.03
4.985
5.015
5.015
5.015
4.995
4.96
5.01
5.01
4.995
4.995
4.995
4.995
4.995
5.015
4.985
5.0
5.0
5.025
5.04
4.985
5.01
5.025
5.025
5.045
5.03
5.005
5.005
5.005
5.005
5.025
5.005
5.005
4.975
5.025
5.045
5.005
Code I used >>
scale = QwiicScale() # Created Qwiic Scale Object
s = SevenSegment(scale) # Created Seven Segment Object
# Calibration code
OF = scale.getZeroOffsetFromQwiic() # Get Offset From Loadcell without putting any weight
# Place Known Weight
KnownWeight = float(input('Enter Known Weight : ')) # Take input known Weight
cal = scale.getCalibrationFactorFromQwiic(KnownWeight) # Calculate Calibration Factor
#Created Thread for showing weight on Seven Segment Display
SevenSegmentThread = Thread(target=s.ShowOnSevenSegment)
SevenSegmentThread.start() #ran that thread here
# Loop continuously running to get weight and setting it to Seven Segment
while KeyboardInterrupt:
Weight = float(scale.getWeightFromQwiicScale())
print(Weight)
Weight = str(int(Weight*1000))
s.SetWeight(''.join(reversed(Weight)))
Any Suggestion or help is much appreciated …
Thanks in Advance…