File Exchange

image thumbnail

Basic Custom Arduino Library for HX711

version (1.73 MB) by NICHOLAS GIACOBONI
Get data from the HX711 load cell amplifier and import in MATLAB workspace.


Updated 15 Dec 2019

View Version History

View License

The HX711 add-on library develops the two wire comunication protocol between Matlab workspace and HX711 itself through ARDUINO and also a specific class provides some built in function to calibrate your loadcell. In the folder you'll also find a Matlab App which can be used to calibrate the loadcell and plot data in real time by a basic Graphical User Interface. This library has been tested with ARDUINO UNO and MEGA2560 under windows environment. Thanks to the User's Manual you can easily learn how to use this library. If you are looking for something more sophisticated download this one: If you are using Arduino DUE use the following one:

Cite As

NICHOLAS GIACOBONI (2021). Basic Custom Arduino Library for HX711 (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (27)

Mohammad reza Nejati

Quintin Bynum

Hi, I am trying to use the HX711 App that comes with this. I successfully connect and the green light shows. I am also able to Tare and get the Scale Factor. From there, whether I try to get data or calibrate, I get an error that says:
'Value' must be a double scalar within the range of 'Limits'

What value is this and how do I correct the issue?

Jue Sch

@Jakob Stockerman:
Thanks Jakob.
I had t he same problem with 2020b on Linux. LibraryHeaderFiles = {} solve the problem

Jakob Stockermann

2020b: after installing, the addon was found by 'listArduinoLibraries', but updating the server on arduino gave error "The Arduino source 'basic_HX711/basic_HX711.h' for libraries 'basicHX711/basic_HX711' cannot be found. Install the third party library source first and try again."

I found a solution: change line 34 in the basic_HX711.m to "LibraryHeaderFiles = {}".

Kirk Reinkens

I really like this. I had made it easy for students to see practical use in data collection for programming and materials testing. Unfortunately, R2020b fails to find the library correctly. Who can help with this? When new students get the latest version, I'll need to have them uninstall R202b and reinstall R2020a.

Jason Lee

Aline Peres Leal

I'm having problems with this:

error: 'sendCommand' undefined near line 52 column 21
error: called from
read_HX711 at line 52 column 19

Can you help me?

Teodor Bishkov

Hello Nicholas,

Thank you very much for your library!
I am not experienced in MatLab coding, I usually use Simulink and have no clue how the coding section of Matlab works.
My question to you is if I can transfer the realtime data to Simulink and then using combinatorial logic to decide what happens in each scenario.
I have a school project and if this works I would be very grateful.
Thank you!

Hi nicholas, i have a problem with your library; i follow your instructions to use the library in the user´s manual. After the library is added to path i put in the comman window listArduinoLibraries, and the library doesn´t appears, and i cant set up in my arduino. my matlab´s version is 2018b what can i do?


The Library it's now updated and it's been renamed "Basic Custom Arduino Library for HX711". If you want a more sophisticated library look here: Instead if you want a library that works with Arduino DUE download this one:

fatih kaya

Hello Nicholas,
Please could you let me know if it is possible to use 3 channel stacked strain rosette( with 1 pcs HX711.
Any help would be appreciated!
Thank you very much and God bless.
Faith KAYA

Danny Colantonio

Hello Nicholas,
I keep running into a problem. When I enter
>> listArduinoLibraries
{'ExampleAddon/HX711' } shows up like I expect it should.
When I try to use
>> arduinosetup
I select the library ExampleAddon/HX711 and proceed to click 'Program'
Then I receive an error stating:
The Arduino source 'HX711/HX711.h' for libraries 'ExampleAddon/HX711' cannot be found. Install the third party source first and try again.

I have tried following the User's Manual and have found no luck. Any help would be appreciated!

Luis Guillermo

Thanks! I'm testing my sensors for a new project and found very useful this library.

Arnold Hutauruk

hello Nicholas, can you help me modify your mlapp instead of using xy axis to show the continuous data acquisition i want to use semicircular gauge or rectangular gauge, its kinda hard for me since this is my first time using matlab for arduino sensors. thank you very much and God bless

elevepsi lamartin

anyone has a technique to create a block for simulink from this library ?

Stephan Pi

Hi Nicholas! I'd like to say thank for the great work! Only thing which could be improved is that you need to calibrate the strain gauge every time again.


Hi Alec, I'm glad you are using my library for a school project. Please send me an e-mail through my Matlab account and we'll solve the issue.

Alec Golightly

Hi, been working on a project for school using a HX711 load cell and the code is not being able to be found in my library. I have repeated all suggestions that have been given in this comment section and have had my instructors look at it. All students attempting to use this code and sensor are all having the same issues and any help would be greatly appreciated as soon as possible.

Stephan Pi


Hello Ozan Eren Yuceol,
yes my goal was to make the library compatible with Due
since I published the library the first time and so with other transducer, and it's still so.
Unfortunately I'm very busy at the moment but I'm going to get on it the next year,
I think in february, unless someone come up with a solution before me.


Hello Nicholas,

Do you have a plan to make the library compatible with Due?

Allan Lui

Hi Nicholas, I'm using your library to record data from strain gauges attached to the HX711 . I have put the read_HX711 function in a while loop so it continuously records the mass and I was wondering how to insert the data retrieved from the while loop into Simulink? I was just wondering if you could help me out with this? Thank you in advance.


The Arduino source 'HX711/HX711.h' for libraries 'ExampleAddon/HX711'
cannot be found. Install the 3P library source first and try again.
It's quite common to get this error using the library if the registration phase
it's not done properly. Here I'm going to summarise some tips that can help
anyone who get this error.

1) Extract the content of HX711 and pasted it in your work folder;
2) Follow the instructions in the User's Manual in order to register the custom library;
3) If you've done all of that and you get the error try with the following codes one by one in the command window:
- clear classes
- rehash toolboxcache
- listArduinoLibraries()
4) Check in the output of the last code that the HX711 library is in the list, then upload the arduino server code again.
5) If the problem is not fixed click on the "seth path" button on the top of the Matlab User Interface, look for the HX711 path
and remove it. Now do the entire procedure again.
6) If you get the error again feel free to send me an e-mail through my Matlab account.

Nicholas Giacoboni


Hello Alberto Juan Alburquerque, I'm glad you appreciate my library, you can access the app's source code by opening it with the App Designer. if you are not comfortable with the code I think I can do it for you. You can send me an e-mail through my Matlab Account so I will be able to help you with any further problem.

Nicholas Giacoboni

Hi Nicholas! I am reading everything and it looks great. Thank you again. I am trying now to use your app (HX711.mlapp). I have a 5 kg load cell and I already calibrated it. My scale factor is 446809.5067 (if your calculation methods are the same as the ones from "bodge"). I need just to set directly the scale factor... I cannot tare and calculate again the set factor every time which I use the load cell because it is mounted in an assembly. Would it be possible to do that? Your app doesn't allow to enter the scale factor and I cannot access the source code... Thank you in advance! :)

Thank you very much for uploading this. It was just what I needed. I already made the HX711 work with the Arduino IDE and the library from "bodge". I just want now to do it with MATLAB in order to plot the measurements on real time. I hope I can achieve it using your MATLAB library! :)

Zahed Fathizadeh

I have a problem with using this library.
When I want to setup my arduino the message "The Arduino source 'HX711/HX711.h' for libraries 'ExampleAddon/HX711' cannot be found. Install the 3P library source first and try again." appears.
I use the Arduino UNO
Please help me to solve this problem

MATLAB Release Compatibility
Created with R2019b
Compatible with R2017b to R2019b
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

HX711 v3.0

HX711 v3.0/+arduinoioaddons/+basicHX711