LabVIEW Interface for Arduino Discussions

Showing results for 
Search instead for 
Did you mean: 

Weight measurement using load cell and hx711

Go to solution

I am working on a project where I need to caluclate weight in my basket, I am using loadcell for that puspose and HX711 amplifier. I need help regarding vi or sensor package for load cell in LabVIEW.

0 Kudos
Message 1 of 14

Given the fact this is posted in the LIFA forum, I assume an Arduino will be used as data collection board, in which case a simple read analog pin, followed by some math to convert voltage to weight should be enough. Do a simple calibration with known weights (0, 100g, 200g etc.) to find out the math formula, or it might be already provided to you by the manufacturer, input that in LabVIEW and that's that.

0 Kudos
Message 2 of 14

Thank you sir, I've got the sensor values in arduino with help of header file, in which SCK( clock input for the HX711) was given by an inbuilt funtion. So, I want to know the logic of giving input to SCK in LabVIEW. I was half way successfull with Arduino. Could please help me with the logic for SCK input of HX711.

0 Kudos
Message 3 of 14
Accepted by topic author GnanaShekhar
02-05-2017 09:06 AM

I see, should've started out with that. Well, according to the datasheet:


When output data is not ready for retrieval, digital output pin DOUT is high. Serial clock input PD_SCK should be low. When DOUT goes to low, it indicates data is ready for retrieval. By applying 25~27 positive clock pulses at the PD_SCK pin, data is shifted out from the DOUT output pin. Each PD_SCK pulse shifts out one bit, starting with the MSB bit first, until all 24 bits are shifted out. The 25th pulse at PD_SCK input will pull DOUT pin back to high.


This sounds like you should just create a VI that sends a stream of pulses, and captures the state of data (1 or 0) on each pulse. However, according to datasheet, the high time of pulses can not exceed 50us for proper operation, which is nearly imposibly precise of an operation to perform in any programming language that runs on a host OS designed for human use like Windows. So your options would be:


-The analogic electronics path: ditch the ADC and use an OPAMP circuit to boost the signal to something readable by the analog pin.

-The Arduino enthusiast path: modify the LIFA base code to include a function that sends the stream of pulses and reads the data sent by the ADC.

-The microcontroller savvy path: program a cheap microcontroller to do the signal generating and reading for you, and send it over via DAC (read from analog pin), I2C, Serial, USB or any other method you're familiar with.


In either of the last 2 cases, your logic would be the same, send pulse, read data, store a 1 or 0, repeat 24 times, then send the 25th pulse to clear, convert from binary to decimal, and output a number.

Message 4 of 14

Thank you sir, 

I've seen datasheet but it was difficult, thanks alot for clarifying. I will choose "The Arduino enthusiast path". Can we connect Arduino to the myRIO and get the data?, since Arduino is working fine.


We have myRIOs in our college, so I thought of connecting sensor to it and get the analog values, but  I was not successful. But thank you very much for clearing the logic.

0 Kudos
Message 5 of 14
Accepted by topic author GnanaShekhar
02-05-2017 09:05 AM

Actually, if you have a myRIO why do you need an Arduino at all? As a real-time, true-parallel device, the myRIO is more than capable of handling the precise timing required for the application. Yes you can connect them with the Arduino via a number of ways (LabVIEW as a middleman, serial, etc.) but that would be somewhat redundant.


Your best bet would be just use the myRIO for everything, those are very powerful and more than capable of performing this task in its entirety.

Message 6 of 14

Yes sir,

I will use myRIO alone, I will program myRIO and get the analog value of the loadcell and calibrate to Grams or other. Thanks alot for explaining the logic for SCK(clock input).

0 Kudos
Message 7 of 14


Let me call your attention that from 20th, July 2016 NI High Throughput Add-on for myRIO is available so you can do streaming with Digital In and Out a fast rates. As synch between In and Out is not fix you might do a loopback from the clock-out to a digital In to see where to sample the input.

0 Kudos
Message 8 of 14

I'm making a project using myrio and hx711, Can you please help to create the program?

0 Kudos
Message 9 of 14

@YudySuryanto wrote:

I'm making a project using myrio and hx711, Can you please help to create the program?

Two pieces of advice my friend:

One, make your own thread, apart from this one. This is a pretty old post whose problem was solved. It would be one thing to ask for a very specific detail about the solution, but not something so general as this


Two, this is not the right place to ask people to write your code for you. These forums are meant for users to help each other with accurate, specific issues with the Software, coding, structure and such. Thus, make a new thread including what is your Hardware in as much detail as you can cover, what is the scope and purpose of your project, what have you done so far, what is your level of expertise with LabVIEW, and what are the specific issues you are dealing with. People here will happily look at your code and say "this is what's causing the issue" or "you can do this better in this way, here's an example" or "read this whitepaper or watch this webinar", but you need to provide what you have done before getting any help.

0 Kudos
Message 10 of 14