Component for Hx711

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

User avatar
CamargoF
Posts: 36
Joined: Thu Aug 02, 2018 8:16 pm
Location: Sao Paulo, SP - Brazil
Has thanked: 6 times
Been thanked: 7 times
Contact:

Component for Hx711

Post by CamargoF »

I was not able to identify a component for the Hx711 (24-Bit Analog-to-Digital Converter for Weigh Scales) in FC8. Is there any?

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: Component for Hx711

Post by QMESAR »

Hi,
If the component does not appear under the component menu's then there is no component for the device.
You can always roll out your own component see this wiki page for help
https://www.matrixtsl.com/wiki/index.ph ... Components you can also use a C icon call and do the necessary
C code to use the device

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: Component for Hx711

Post by petesmart »

Hello,

I have done the hx711....try searching the forum, I think may have posted the code....it was used for my beehive project

If not I will dig it out and drop it on the forum tomorrow...it’s 1am in Oz....so it’s teddy time :

Edit...and here is the link viewtopic.php?f=54&t=18004&p=76393&hilit=Hx711#p76393

Btw... I never got around to turning it into a component..but the code does work..perhaps you can have a crack at turning this into a component and share it on the forum :)

Enjoy

Best

PETE
sorry about that Chief!

User avatar
CamargoF
Posts: 36
Joined: Thu Aug 02, 2018 8:16 pm
Location: Sao Paulo, SP - Brazil
Has thanked: 6 times
Been thanked: 7 times
Contact:

Re: Component for Hx711

Post by CamargoF »

Hi Mr. Smart, :D

I read your post about the hx711 macro in 2016 (FC6), that why I ask my question.
I thought it should be added to the library after two years and two FC releases.

Thank you for your reply.

Best regards,

Fernando

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Component for Hx711

Post by Benj »

Hi Pete,

Would you be happy for us to build a component based on your macro? I've had a quick look and it looks like it should be fairly straightforward.

Edit: It's now done, but I'll wait for your go ahead Pete :D

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Component for Hx711

Post by kersing »

CamargoF wrote:I read your post about the hx711 macro in 2016 (FC6), that why I ask my question.
I thought it should be added to the library after two years and two FC releases.
Matrix TSL can not simply grab the code a user supplies and include it in a commercial product. They at least need to have permission from that user (which Benj just asked for).

@Matrix: When FC6 was released there was talk about a component repository/store. With the FC8 update feature in place, can this idea be revisited? (I'm hoping it can be a simple extension of the update system)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Component for Hx711

Post by Benj »

Hi Jac,
@Matrix: When FC6 was released there was talk about a component repository/store. With the FC8 update feature in place, can this idea be revisited? (I'm hoping it can be a simple extension of the update system)
We have some management on board with this idea, others are not so keen. We have lots on atm so I don't see it happening this year but hopefully it will come not too far down the road. The update system certainly does open the door to this type of thing. It's all the other back end stuff to allow users to post components and potentially monetize them that would need attention. We have even talked about no component packs and each component being an individual purchase but at the moment your guess is as good as mine :wink: .

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: Component for Hx711

Post by petesmart »

Go for it Ben....happy for you to use the code on a commercial basis, with no strings attached...

Best

Pete

P.s. @fernando...I don’t work for Matrix, therefore it’s not automatic that Matrix would create a component out of it.. just so you know the forum members create and share code and components freely in the spirit of mutual support..we encourage new members to engage with us in creating projects and sharing...the wisdom of the crowd and sharing is a wonderful thing.

Btw thanks to Ben at Matrix for taking the initiative and creating the component of the back of my code..and Jack I support you idea of a code repository... maybe us forum folk could run it if Matrix create a space...I’m happy to pitch in as I can see the value...it will also address some of the concerns that I have seen recently

what do you all think?
sorry about that Chief!

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: Component for Hx711

Post by QMESAR »

Hi All,
I am quite happy to help post some components as we go along if there is place we we can place them and they are central and always in one place
as at the moment the stuff is a bit all over the forum
I support your idea Jac

@Fernando,
As pete said we are small community with a relative small development team(MATRIX) that does wonderful things for us and we on the forum try to help and support as much as we can to the benefit of all FC users ,with that said we also have to have some patcience with things we want and need
it not a quick ask in the forum and the next day you have your request although many times Ben and Leigh are just amazing and produce as today with the Hx sensor.
Ben you are a star as always :D Thanks pete for your initial work on the code for the sensor.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Component for Hx711

Post by jgu1 »

Hi all!

really a useful component. Unfortunately I am not able to make one. Look forward if it will be added to componentlist. :D

Br Jorgen

User avatar
CamargoF
Posts: 36
Joined: Thu Aug 02, 2018 8:16 pm
Location: Sao Paulo, SP - Brazil
Has thanked: 6 times
Been thanked: 7 times
Contact:

Re: Component for Hx711

Post by CamargoF »

I strongly recommend Matrix to create a open-source component community to make available components from community.
It is the cheapest way to increase the number of developer and to improve the IDE tools.

I suggested you work as Apple do:
(1) Evaluated the component before release it to the community.
(2) In this evaluation Matrix will be "training" programmers to make components.
(3) The released component will have all necessary information to be used, demanding minimal support from Matrix.
(4) Matrix will guarantee the software quality to do not compromise FC.

I will try to help.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Component for Hx711

Post by Benj »

Thanks to all on this, some great comments and suggestions there :D

I've now pushed the Hx711 component to the Flowcode v8 update system.

Any problems then please let me know.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Component for Hx711

Post by jgu1 »

Hi!

Thank´s to Ben for the component. I already order a handful of hx711 from Ebay ( have some loadcell )

Is it to much to ask for a smal example with a display I can investergate while I am wating for the device. I am unsure how to set it up


Thank´s in advance

Br jorgen
Attachments
Hx.PNG
(14.66 KiB) Downloaded 4905 times

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: Component for Hx711

Post by petesmart »

Hey Jorgen,

Look here...this is the code and macros the component was based on.
This should get you started

Best

Pete
sorry about that Chief!

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Component for Hx711

Post by jgu1 »

Hi Pete!

Thank you very much Pete. I can see this examble it is bitbanging, and did not tell mush of these settings in Ben´s component, :wink: please.

Br jorgen
Attachments
Hx.PNG
(14.66 KiB) Downloaded 4859 times

User avatar
CamargoF
Posts: 36
Joined: Thu Aug 02, 2018 8:16 pm
Location: Sao Paulo, SP - Brazil
Has thanked: 6 times
Been thanked: 7 times
Contact:

Re: Component for Hx711

Post by CamargoF »

I did my own implementation and it is working.
I have two prototypes: with 1 Hx711 and with 4 Hx711.

I would like to know if you could create a video explaining how to create the component, complementing the wiki?

It will be nice if you could explain how can I simulate the Hx711 operation.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Component for Hx711

Post by jgu1 »

Hi carmagof!

Would you share your testprogram. I domt know how to set it up. Please

Br jorgen

User avatar
CamargoF
Posts: 36
Joined: Thu Aug 02, 2018 8:16 pm
Location: Sao Paulo, SP - Brazil
Has thanked: 6 times
Been thanked: 7 times
Contact:

Re: Component for Hx711

Post by CamargoF »

That is the point.
I was not able to simulate the Hx711 on Flowcode.

The only way I had to test was upload the firmware to Arduino.
On the test I sent all Hx711 reading through the serial USB and use the Arduino serial monitor tool to read the measurements.

That is the reason I asked for the tutorial explaining how to create the component and the simulation interface.

If you want I can share my code with the functions:
  • Initialize(): initialize all interface variables and execute Reset() and first reading to set the input port and gain.
  • Reset(): force the initialization of the Hx711 and check if it is connected.
  • Read(): read the Hx711 returning a positive value (0x00000000~0x00FFFFFF) or 0x01000000 if disconnected.
  • Get(): compute the average of 4 readings and convert it to the unit you want (in my case grams).
Please, confirm if you need it since I will need some time to translate the messages and variable names to English, since the code had been written in Portuguese. :D

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Component for Hx711

Post by jgu1 »

Hi again.

Ok, thought you have managed to get it run. I misunderstod. :wink:

Br .jorgen

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Component for Hx711

Post by jgu1 »

Hi All!

I just received my HX711 today. Of course testing, but it will not work, I only see 5898 in the display.


I have to admit that I guess in terms of most setting. I can not find anything about this topic anywhere. Will anyone please try to see if I've done it wrong. Please. :D

Thank´s in advance.

Jorgen
Attachments
LoadcellHX711.fcfx
(8.9 KiB) Downloaded 256 times

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Component for Hx711

Post by jgu1 »

Hi Ben!

You have created the component. I I ask you kindly will you then please tell me the basic for the settings in the HX711 component. The I can start and make my experience. Please.

Scale = ?
Calibrate = ?
Average count= ?
Average_loop_delay = ?
Auto Zero = ?

Or maybe a small exable.

Br Jorgen

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Component for Hx711

Post by Benj »

Hello Jorgen,

I have been playing in the office with one of these modules and think we can make the component easier to use. I'm not 100% on the parameters myself mainly because it's not my code ;)

For now here is a guessed explanation of the parameters.

Scale = Scaling factor, start with 1.0 to give you unity scale and then when you come to calibrate your sensor you can plug in a value here to fit.
Calibrate = Not sure on this one, maybe try 1.0 and 0.0?
Average Count = Number of samples to take in a single operation to try and filter out high frequency noise and spikes
Average Loop Delay = Number of milliseconds to wait in between samples
Auto Zero = 0 for normal operation, 1 to redefine the 0 point as the current reading, imaging a Zero button on digital scales

Regarding scale we are using one of these modules to get a weight from a force plate. The scale factor we have to apply is to divide by 217 to get the weight in grams (after zeroing). This would equate to a scale factor of 1 / 217 = 0.004608

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Component for Hx711

Post by jgu1 »

Hi Ben!

Thank`s for reply. Sorry I though it was your component. :D

Yes, anyway I would be happy If you Will create a new component for Hx711. I already tryed all kind of value in the settings, But nothing it not work. So yes, a working and easy to use Hx711 component which also can be calibrated and tarer is very velcome. :roll: I use a hunghleigh 5kg loadcell.

Br Jorgen

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Component for Hx711

Post by Benj »

Hello,

I've re-done the HX711 component now so hopefully it is easier to use and understand. The new component should be available now via the update system. Please note that the API for the component has changed fairly significantly so any existing programs will become broken.

I've also added simulation functionality using a slider and added an example here.
https://www.matrixtsl.com/wiki/index.ph ... _(Sensors)

Let me know how you get on.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Component for Hx711

Post by jgu1 »

Hey man, Thank you Ben. :D I am not home now, in the evening and then I make a test and you will be the first who hear the result. :lol:

Thank´s.

Br jorgen.

Post Reply