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.
Solved! Go to Solution.
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.
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.
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.
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.
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.
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).
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.