+ Post New Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 20 of 46
  1. #1
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    HX711 mV/V information needed

    I am making a HX711 based Weighing Scale using PIC16F877A.

    The datasheet

    https://cdn.sparkfun.com/datasheets/...11_english.pdf

    mentions that for input channel A that is A+ and A- then gain can be 64 or 128 and if 128 is chosen as gain then differential input can be +/-40mV.

    Does it mean that input can be -40mV to +40mV = 80 mV range?

    80 mV = 2^24 = 0 to 16777215?

    My AVDD, VDD and Excitation voltage is 5V.

    So, if I choose a Load Cell with 1000 Ohms bridge resistance and 5mV/V then for 5V I get Load Cell output = 5mV * 5 = 25mV?

    Currently I am simulating in Proteus and I am displaying just the raw ADC value of HX711 and for 1000 Ohms bridge resistance and 5mV/V Load Cell I am getting 16777215. How am I getting 2^24 for 25mV?
    Last edited by baileychic; 17th July 2019 at 22:53.

  2. #2
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    Re: HX711 mV/V information needed

    My Load Cell Capacity is 30 Kgs and Bridge resistances are 1000 Ohms +/-20 and sensitivity is 2mV/V.
    My Load Cell Excitation voltage is 5V clean DC.

    I am using HX711 with 25 Clocks.

    2mV * 5V = 10mV

    So, for 30 Kgs my Load Cell give 10mV, right?

    What will be the HX711 output for 10mV?
    What is the range of mV I can input into INA+ and INA- pins of the HX711?



  3. #3
    Super Moderator
    Points: 259,231, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,256
    Helped
    13767 / 13767
    Points
    259,231
    Level
    100

    Re: HX711 mV/V information needed

    The load cell should be supplied with ADC AVDD to achieve ratiometric operation, otherwise you generate additional error and drift.

    I presume you read the HX711 datasheet thoroughly and understand that the specified input ranges are valid for AVDD of 5V.



    •   AltAdvertisement

        
       

  4. #4
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    Re: HX711 mV/V information needed

    @FvM

    This is my circuit. See the voltmeters in the HX711 circuit. Should I connect AVDD pin to E+ pin of Load Cell?

    This is my almost finished projects test files (not c code as client doesn't allow me to post the c code and also I don't have any code issues).

    This is the Proteus simulation video.

    https://mega.nz/#!2AB0ESbA!AzwLF2k93...FpbzW9_3UOxgtc

    TARING feature (shown in video) has some issue and I will fix it later.

    - - - Updated - - -

    In hardware, I am using SparkFun's HX711 module with 5 kg Load Cell with Mecahnical setup.

    - - - Updated - - -

    This is my code for getting weight.

    Code C - [expand]
    1
    2
    
    weighingScale.wt = HX711_Read() - weighingScale.noLoadWt;
    weighingScale.weight = (double)weighingScale.wt * weighingScale.capacityInKgs / Adc_Resolution;
    Last edited by baileychic; 28th July 2019 at 09:12.



  5. #5
    Super Moderator
    Points: 77,053, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,609
    Helped
    3557 / 3557
    Points
    77,053
    Level
    67

    Re: HX711 mV/V information needed

    Hi,

    My recommendations on your circuit:
    * don't leave any unused inputs of any IC floating.
    * use analog filters referenced to clean GND
    * use high speed ceramics capacitors instead of high ESR electrolytics
    * use a capacitor on every supply pin of every IC.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

  6. #6
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    Re: HX711 mV/V information needed

    @FvM and @Klaus

    Okay, done.

    I connected AVDD pin of HX711 to E+ of Load Cell. Power supply is fine and clean and low noise.

    @Klaus

    Where to put analog filters?

    Can I use movingAverage filter in software for getting noLoadCounts?

    Should I configure all PIC's unused pins as inputs and pull them up?

    How to connect the unused output pins of MAX7219?



  7. #7
    Super Moderator
    Points: 77,053, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,609
    Helped
    3557 / 3557
    Points
    77,053
    Level
    67

    Re: HX711 mV/V information needed

    Hi,

    Where to put analog filters?
    Can I use movingAverage filter in software for getting noLoadCounts?
    You have an ADC, thus you have to take care about nyquist to avoid alias frequencies.
    Alias frequencies neither can be avoided nor suppressed with software.

    Unused inputs just must not be left floating. How you do this is not important. Microcontroller: programming as input with pullup or as output. In doubt read the datasheet.

    Outputs are not critical.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  8. #8
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    Re: HX711 mV/V information needed

    Why should I use a filter on INA+ and INA- pins of HX711 module? I am using SparkFun's HX711 module and not HX711 circuit built on the mainboard. The filter will attenuate the signal level. How should I compensate for it?



  9. #9
    Super Moderator
    Points: 77,053, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,609
    Helped
    3557 / 3557
    Points
    77,053
    Level
    67

    Re: HX711 mV/V information needed

    Hi,

    Why should I use a filter on INA+ and INA- pins of HX711 module?
    Why: I told you about alias frequencies
    INA pins: I didn't talk about INA pins.

    In post#5 I told you my recommendations. You are free to follow them or not.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  10. #10
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    Re: HX711 mV/V information needed

    Okay, I am using HX711 module? Where should I put the filter? On HX711's power pins? I know that HX711 has an internal 24-bit ADC. If I have to put the filter for ADC then how, because ADC connects to INxy pins through MUX and it is internal to the4 chip.



    •   AltAdvertisement

        
       

  11. #11
    Super Moderator
    Points: 77,053, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,609
    Helped
    3557 / 3557
    Points
    77,053
    Level
    67

    Re: HX711 mV/V information needed

    Hi,

    I didn't use HX711....
    But nyquist and alias frequency problem applies to all ADConversions.
    Decide whether you can live with alias frequencies ... and what magnitude you expect..
    Then decide if ... and what AAF you implement.

    Klaus

    Added:
    Don't get me wrong. There are different strategies to design a circuit.
    I'm no low cost designer, I'm a high precision designer.
    And I doubt ... without proper design ... you get better results with your 24 bit ADC than with a 16 bit ADC (because the lower 8 bits toggle because of noise and alias frequencies).
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

  12. #12
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    Re: HX711 mV/V information needed

    @Klaus

    Leave the filter for now. I will discuss it later after a few days when building the final hardware where the HX711 circuit will be put on the mainboard.

    For now, I am testing in Proteus and my noLoadCounts is stable.

    My new question is:

    I set the Load Cell model to 0.0 reading and its output in Proteus is 0mV. For 100% Load Cell value I am getting 10mV output.

    My equation is

    weight = (HX711_rawValue - noLoadCounts) * CapacityInKgs / AdcResolution

    So, If I set 30 Kgs as Capacity for the machine then after calibration I have to get 30 Kgs for 10mV input (100% Load Cell scale)?

    Load Cell Bridge resistance is set to 1000 Ohms and sensitivity to 2mV/V and E+ (excitation voltage) to Load Cell is supplied from AVDD.

    I am not getting 30.000 Kgs as result. I am not even getting 10.000 Kgs as a result.

    What is the issue? Code is fine.

    For my setup what will be the max input mV into INA+ and INA- pins, +/-10mV or +/-40mV?

    How to do the hardware side calculations?

    HX711's RATE and XI pins are grounded and I am using 25 Clocks for HX711 that is gain of 128. HX711's internal Osc is 11.0592 MHz.

    After getting the weight value correct In Proteus, I will test on hardware.

    I have to setup the hardware with Load Cell. Display and other non-HX711 parts of the codes I have tested on hardware and working fine. Here are there videos.

    https://mega.nz/#!6VZEgCyY!42_W2XtwO...JGiarGJzEoQvzA

    https://mega.nz/#!PcJ2jCyb!lWt1s1j1M...Fsw7c6Vp8g538g
    Last edited by baileychic; 28th July 2019 at 16:45.



  13. #13
    Super Moderator
    Points: 77,053, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,609
    Helped
    3557 / 3557
    Points
    77,053
    Level
    67

    Re: HX711 mV/V information needed

    Hi,

    I am not getting 30.000 Kgs as result. I am not even getting 10.000 Kgs as a result.
    What do you get?

    You say you use simulation....so a sraight forward debugging method is to follow the signal from sensor to display.... step by step.
    Decide/calculate what you expect .... then check against simulation values.

    Usually the hardware manufacturers provide application notes and other informations. Did you go through them?

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

  14. #14
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    Re: HX711 mV/V information needed

    I am getting 6.4 as the weight value for 10mV.

    - - - Updated - - -

    I am getting 6.4 as the weight value for 10mV (edited, sorry for 8.6mV because now AVDD is 4.3V, instead of 5V which gives 10mV)

    HX711 datasheet tells that for 128 Gain (25 Clocks) Channel A has a differential input range of +/-20mV that is equal to 40mV, right? and that is for 5V AVDD.

    It also tells that for 64 Gain Channel A has a differential input range of +/-40mV that is equal to 80mV range, right? and that is for 5V AVDD.

    My AVDD = 4.3V

    For 5V AVDD my Load Cell model gives 10mV for 100% load (1000 Ohms BR, 2mV/V)

    For 4.3V AVDD it is 8.60V which is correct and I am getting this at Load Cell output in Proteus.

    So, if I am getting 6.4 Kgs (for 4.3V AVDD) as weight for capacityInKga = 30.0 and voltage is 10mV (100%) then it is near to 7.5 Kgs which is for 5V AVDD.

    So, if I consider my Load Cell output to be 8.6mV * 4 = 34.4mV then weight will be 6.4 Kgs * 4 = 25.6 Kgs (for 4.3V AVDD)

    If it is assumed my Load cell output to be 10mV for 100% load with AVDD = 5V then 10mV * 4 = 40mV (full scale value for gain 128) and 7.5 Kgs * 4 = 30 Kgs.

    Are my calculations correct?

    If yes, then I am getting correct value.



  15. #15
    Super Moderator
    Points: 259,231, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,256
    Helped
    13767 / 13767
    Points
    259,231
    Level
    100

    Re: HX711 mV/V information needed

    My equation is

    weight = (HX711_rawValue - noLoadCounts) * CapacityInKgs / AdcResolution
    What's AdcResolution in the equation?



  16. #16
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    Re: HX711 mV/V information needed

    ADC of HX711 is 24 bit and so it is

    Code:
    #define Adc_Resolution 16777216.0
    For 8.6mV (AVDD = 4.3V) I am getting not 6.4 Kgs but (6.45 Kgs) with Load Cell load = 100%, Capacity = 30.0 Kgs, Bridge resistance = 1000 Ohms and Sensitivity 2mV/V.

    6.45 Kgs * 4 = 25.8 Kgs (8.6 mV, AVDD = 4.3V) because full scale range is 8.6mV * 4 = 34.4mV. (corrected)
    7.5 Kgs * 4 = 30 Kgs (10mV, 5V AVDD) because full scale range is 10mV * 4 = 40mV.

    30 Kgs = 5V AVDD
    x Kgs? = 4.3V AVDD

    x = 4.3V * 30 Kgs / 5V = 25.8 Kgs.

    So, my final code is this.

    Code C - [expand]
    1
    2
    3
    4
    
    weighingScale.wt = HX711_Read_Average(8) - weighingScale.noLoadCounts;
    weighingScale.capacityInKgs = (double)weighingScale.capacity / 1000.0; //capacity stored in eeprom 30000 = 30 Kgs
    weighingScale.weight = (double)weighingScale.wt * weighingScale.capacityInKgs * 4.0 / Adc_Resolution;
    weighingScale.weight = weighingScale.weight * ((double)weighingScale.capacityInKgs / weighingScale.weight);

    Lets say I got these in each step.

    Code:
    weighingScale.wt = HX711_Read_Average(8) - weighingScale.noLoadCounts;
    weighingScale.capacityInKgs = (double)weighingScale.capacity / 1000.0; //capacity stored in eeprom 30000 = 30 Kgs
    30.0 Kgs

    Code:
    weighingScale.weight = (double)weighingScale.wt * weighingScale.capacityInKgs * 4.0 / Adc_Resolution;
    25.8 Kgs

    Code:
    weighingScale.weight = weighingScale.weight * ((double)weighingScale.capacityInKgs / weighingScale.weight);
    weighingScale.weight = 25.8 * 30.0 / 25.8 = 30.0
    Last edited by baileychic; 28th July 2019 at 18:54.



  17. #17
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    Re: HX711 mV/V information needed

    I made a major mistake in the code.

    The below line results in weight value always 30.0 Kgs.

    Code:
    weighingScale.weight = weighingScale.weight * ((double)weighingScale.capacityInKgs / weighingScale.weight);
    @FvM and Klaus

    How to get the correct weight value? I need the scaling factor equation based on Sensitivity, AVDD value, and Capacity.
    I am very near to complete the project.

    From this step

    Code:
    weighingScale.weight = (double)weighingScale.wt * weighingScale.capacityInKgs * 4.0 / Adc_Resolution;
    I got 25.8 Kgs in Proteus.

    Now, how to get 30.0 Kgs from that value? It should be based on a scaling factor which is formed using Sensitivity of Load Cell and AVDD value.

    - - - Updated - - -

    Edit:

    I found the equation myself. It is,

    weight = (HX711_Read_Average(2) - weighingScale.noLoadCounts) * weighingScale.capacityInKgs * 4.0 * (AVDD_For_Full_Scale / AVDD_Actual) / ADC_Resolution

    So, if

    AVDD_For_Full_Scale / AVDD_Actual = 5.0V / 4.3V = 1.16279

    and

    (HX711_Read_Average(2) - weighingScale.noLoadCounts) * weighingScale.capacityInKgs * 4.0 / ADC_Resolution

    = 25.8

    then

    25.8 * 1.16279 = 30 Kgs

    if weight was 6.45 then

    6.45 * 1.16279 = 7.499 = approx 7.5 Kgs.

    - - - Updated - - -

    I am done with the final equation.

    Code C - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    #define AVDD_Recommended 5.0
    #define AVDD_Actual 4.3
     
    #define HX711_Full_Scale_value_mV_Per_V_For_Gain_128 40 //(+/-20 mV/V = 40 mV)
    #define Load_Cell_Full_Scale_Value_mV_Per_V_Multiplied_By_Excitation_Voltage 10 //2 mV/V * 5V = 10mV)
                    
    weighingScale.capacityInKgs = (double)weighingScale.capacity / 1000.0; //capacity stored in eeprom 30000 = 30 Kgs
    weighingScale.weight = (double)(HX711_Read_Average(8) - weighingScale.noLoadCounts) * weighingScale.capacityInKgs * (HX711_Full_Scale_value_mV_Per_V_For_Gain_128 / 
                                                                                                                                       Load_Cell_Full_Scale_Value_mV_Per_V_Multiplied_By_Excitation_Voltage) * (AVDD_Recommended / AVDD_Actual) / Adc_Resolution;

    - - - Updated - - -

    I guess it should be

    Code:
    #define HX711_Full_Scale_value_mV_Per_V_For_Gain_128 40 //(+/-20 mV/V = 40 mV)
    #define Load_Cell_Full_Scale_Value_mV_Per_V_Multiplied_By_Excitation_Voltage 10 //2 mV/V * 5V = 10mV)
    or

    Code:
    #define HX711_Full_Scale_value_mV_Per_V_For_Gain_128 34.4 //(8.6mV * 4 = 34.4mV)
    #define Load_Cell_Full_Scale_Value_mV_Per_V_Multiplied_By_Excitation_Voltage 8.6 //(2 mV/V * 4.3V = 8.6mV)
    
    34.4mV / 8.6mV = 4 (the multiplier in my case).



  18. #18
    Super Moderator
    Points: 259,231, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,256
    Helped
    13767 / 13767
    Points
    259,231
    Level
    100

    Re: HX711 mV/V information needed

    You don't understand ratiometric operation. Load cell output and ADC range are both scaled with AVDD. There's no 1.16 factor.



  19. #19
    Advanced Member level 2
    Points: 3,115, Level: 13
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    622
    Helped
    49 / 49
    Points
    3,115
    Level
    13

    Re: HX711 mV/V information needed

    Quote Originally Posted by FvM View Post
    You don't understand ratiometric operation. Load cell output and ADC range are both scaled with AVDD. There's no 1.16 factor.
    Then what is the equation?

    How should I convert my 25.8 Kgs (6.45 Kgs * 4) obtained with AVDD 4.3V and Load Cell of Bridge resistance 1000 Ohms and Sensitivity 2mV/V?

    - - - Updated - - -

    I know that AVDD drops because of the transistor Vce voltage drop and I also know that E+ of Load Cell is connected to AVDD and hence Load Cell output also depends upon AVDD.

    Now, what is wrong in my latest equation?

    https://www.sunrom.com/p/loadcell-se...-bit-adc-hx711



    •   AltAdvertisement

        
       

  20. #20
    Super Moderator
    Points: 77,053, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,609
    Helped
    3557 / 3557
    Points
    77,053
    Level
    67

    Re: HX711 mV/V information needed

    Hi,

    There are a lot of contradicting informations during the whole thread.
    Could you summarize the current specifications/requirements regarding sensor and circuit?

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



--[[ ]]--