endail / hx711-rpi-py Goto Github PK
View Code? Open in Web Editor NEWPython bindings for Raspberry Pi HX711 C++ Library
License: MIT License
Python bindings for Raspberry Pi HX711 C++ Library
License: MIT License
As per endail/hx711#60 , changes to the C++ repo necessitate changes to the bindings in this repo.
When trying to execute the script I got an error for missing HX711 library, after installing it (and RPi.GPIO) it still fails with
python3 calibrate.py 21 20
Traceback (most recent call last):
File "/home/gambit/HX711_test/hx711_pri_py/calibrate.py", line 12, in <module>
hx = SimpleHX711(int(sys.argv[1]), int(sys.argv[2]), 1, 0)
^^^^^^^^^^^
NameError: name 'SimpleHX711' is not defined
Am I installing something different and can you provide some fix of this?
hello
m = hx.weight(10) is working.
m = hx.weight(Options(
stratType=StrategyType.Samples,
readType=ReadType.Median,
samples=10))
but this is giving an error
error
m = hx.weight(Options(
TypeError: init(): incompatible constructor arguments. The following argument types are supported:
1. HX711.Options()
2. HX711.Options(s: int)
3. HX711.Options(t: datetime.timedelta)
Invoked with: kwargs: stratType=<StrategyType.Samples: 0>, readType=<ReadType.Median: 0>, samples=10
can some one provide solution for this.
thanks
Hello
Thanks for update, now options are working perfectly fine .
i want to perform some function on reading obtained for load cell but as hx.weight return a object i can't do that, is there a way to converts raw reading obtained from hx.read to convert them to reading like obtained from hx.weight so additional operation can be done on them.
Thanks
Hi,
I'm trying to install it on a raspi4 using pip install hx711-rpi-py.
Its says its installed but python can't find it. Any ideas?
Regards
Matt
Hi,
UPDATE: I got this by doing a wget
from the PyPI instructions. When I go directly to the python repo and download a copy from there, it works.
I'm getting this when I try running calibrate.py
:
Traceback (most recent call last):
File "/home/tennis/calibrate.py", line 1, in <module>
{"payload":{"allShortcutsEnabled":false,"fileTree":{"src":{"items":[{"name":"__init__.py","path":"src/__init__.py","contentType":"file"},{"name":"bindings.cpp","path":"src/bindings.cpp","contentType":"file"},{"name":"calibrate.py","path":"src/calibrate.py","contentType":"file"},{"name":"gh-actions-rpi-cmd.sh","path":"src/gh-actions-rpi-cmd.sh","contentType":"file"},{"name":"install-deps.sh","path":"src/install-deps.sh","contentType":"file"},{"name":"test.py","path":"src/test.py","contentType":"file"}],"totalCount":6},"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":".vscode","path":".vscode","contentType":"directory"},{"name":"src","path":"src","contentType":"directory"},{"name":".bumpversion.cfg","path":".bumpversion.cfg","contentType":"file"},{"name":".gitattributes","path":".gitattributes","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"hx711.gif","path":"hx711.gif","contentType":"file"},{"name":"pyproject.toml","path":"pyproject.toml","contentType":"file"},{"name":"setup.py","path":"setup.py","contentType":"file"}],"totalCount":11}},"fileTreeProcessingTime":7.314339,"foldersToFetch":[],"reducedMotionEnabled":null,"repo":{"id":396795607,"defaultBranch":"master","name":"hx711-rpi-py","ownerLogin":"endail","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2021-08-16T12:58:17.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/52652357?v=4","public":true,"private":false,"isOrgOwned":false},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1674023666.25399","canEdit":false,"refType":"branch","currentOid":"d30b682b8814217144a3d7dc09bd183f0a55e68d"},"path":"src/calibrate.py","currentUser":null,"blob":{"rawLines":["import os","import sys","from datetime import timedelta","","from HX711 import *","","if len(sys.argv) != 3:"," print(\"Usage: calibrate.py [data pin] [clock pin]\", file=sys.stderr)"," sys.exit(os.EX_USAGE)","","try:"," hx = SimpleHX711(int(sys.argv[1]), int(sys.argv[2]), 1, 0)","except GpioException:"," print(\"Failed to connect to HX711 chip\", file=sys.stderr)"," sys.exit(os.EX_UNAVAILABLE)","except TimeoutException:"," print(\"Failed to connect to HX711 chip\", file=sys.stderr)"," sys.exit(os.EX_UNAVAILABLE)","","","print(\"\"\"","\\x1B[2J\\x1B[H","========================================","HX711 Calibration","========================================","","Find an object you know the weight of. If you can't find anything,","try searching Google for your phone's specifications to find its weight.","You can then use your phone to calibrate your scale.","\"\"\")","","unit = input(\"1. Enter the unit you want to measure the object in (eg. g, kg, lb, oz): \")","","knownWeight = float(input(\"2. Enter the weight of the object in the unit you chose (eg. \" +"," \"if you chose 'g', enter the weight of the object in grams): \"))","","samples = int(input(\"3. Enter the number of samples to take from the HX711 chip (eg. 15): \"))","","input(\"4. Remove all objects from the scale and then press enter.\")","print(\"Working...\")","","zeroValue = hx.read(Options(int(samples)))","","input(\"5. Place object on the scale and then press enter.\")","print(\"Working...\")","","raw = hx.read(Options(int(samples)))","refUnitFloat = (raw - zeroValue) / knownWeight","refUnit = round(refUnitFloat, 0)","","if refUnit == 0:"," refUnit = 1","","print("," \"\\n\\n\" +"," \"Known weight (your object) \" + str(knownWeight) + \" \" + unit + \"\\n\" +"," \"Raw value over \" + str(samples) + \" samples: \" + str(raw) + \"\\n\" +"," \"\\n\" +"," \"-> REFERENCE UNIT: \" + str(round(refUnit)) + \"\\n\" +"," \"-> ZERO VALUE: \" + str(round(zeroValue)) + \"\\n\" +"," \"\\n\" +"," \"You can provide these values to the constructor when you create the \""," \"HX711 objects or later on. For example: \\n\" +"," \"\\n\" +"," \"hx = SimpleHX711(\" + sys.argv[1] + \", \" + sys.argv[2] + \", \" + "," str(round(refUnit)) + \", \" + str(round(zeroValue)) + \")\\n\" +"," \"OR\\n\" +"," \"hx.setReferenceUnit(\" + str(round(refUnit)) + \") and \" +"," \"hx.setOffset(\" + str(round(zeroValue)) + \")\\n\"",")","","sys.exit(os.EX_OK)"],"stylingDirectives":[[{"start":0,"end":6,"cssClass":"pl-k"},{"start":7,"end":9,"cssClass":"pl-s1"}],[{"start":0,"end":6,"cssClass":"pl-k"},{"start":7,"end":10,"cssClass":"pl-s1"}],[{"start":0,"end":4,"cssClass":"pl-k"},{"start":5,"end":13,"cssClass":"pl-s1"},{"start":14,"end":20,"cssClass":"pl-k"},{"start":21,"end":30,"cssClass":"pl-s1"}],[],[{"start":0,"end":4,"cssClass":"pl-k"},{"start":5,"end":10,"cssClass":"pl-v"},{"start":11,"end":17,"cssClass":"pl-k"},{"start":18,"end":19,"cssClass":"pl-c1"}],[],[{"start":0,"end":2,"cssClass":"pl-k"},{"start":3,"end":6,"cssClass":"pl-en"},{"start":7,"end":10,"cssClass":"pl-s1"},{"start":11,"end":15,"cssClass":"pl-s1"},{"start":17,"end":19,"cssClass":"pl-c1"},{"start":20,"end":21,"cssClass":"pl-c1"}],[{"start":4,"end":9,"cssClass":"pl-en"},{"start":10,"end":54,"cssClass":"pl-s"},{"start":56,"end":60,"cssClass":"pl-s1"},{"start":60,"end":61,"cssClass":"pl-c1"},{"start":61,"end":64,"cssClass":"pl-s1"},{"start":65,"end":71,"cssClass":"pl-s1"}],[{"start":4,"end":7,"cssClass":"pl-s1"},{"start":8,"end":12,"cssClass":"pl-en"},{"start":13,"end":15,"cssClass":"pl-s1"},{"start":16,"end":24,"cssClass":"pl-v"}],[],[{"start":0,"end":3,"cssClass":"pl-k"}],[{"start":4,"end":6,"cssClass":"pl-s1"},{"start":7,"end":8,"cssClass":"pl-c1"},{"start":9,"end":20,"cssClass":"pl-v"},{"start":21,"end":24,"cssClass":"pl-en"},{"start":25,"end":28,"cssClass":"pl-s1"},{"start":29,"end":33,"cssClass":"pl-s1"},{"start":34,"end":35,"cssClass":"pl-c1"},{"start":39,"end":42,"cssClass":"pl-en"},{"start":43,"end":46,"cssClass":"pl-s1"},{"start":47,"end":51,"cssClass":"pl-s1"},{"start":52,"end":53,"cssClass":"pl-c1"},{"start":57,"end":58,"cssClass":"pl-c1"},{"start":60,"end":61,"cssClass":"pl-c1"}],[{"start":0,"end":6,"cssClass":"pl-k"},{"start":7,"end":20,"cssClass":"pl-v"}],[{"start":4,"end":9,"cssClass":"pl-en"},{"start":10,"end":43,"cssClass":"pl-s"},{"start":45,"end":49,"cssClass":"pl-s1"},{"start":49,"end":50,"cssClass":"pl-c1"},{"start":50,"end":53,"cssClass":"pl-s1"},{"start":54,"end":60,"cssClass":"pl-s1"}],[{"start":4,"end":7,"cssClass":"pl-s1"},{"start":8,"end":12,"cssClass":"pl-en"},{"start":13,"end":15,"cssClass":"pl-s1"},{"start":16,"end":30,"cssClass":"pl-v"}],[{"start":0,"end":6,"cssClass":"pl-k"},{"start":7,"end":23,"cssClass":"pl-v"}],[{"start":4,"end":9,"cssClass":"pl-en"},{"start":10,"end":43,"cssClass":"pl-s"},{"start":45,"end":49,"cssClass":"pl-s1"},{"start":49,"end":50,"cssClass":"pl-c1"},{"start":50,"end":53,"cssClass":"pl-s1"},{"start":54,"end":60,"cssClass":"pl-s1"}],[{"start":4,"end":7,"cssClass":"pl-s1"},{"start":8,"end":12,"cssClass":"pl-en"},{"start":13,"end":15,"cssClass":"pl-s1"},{"start":16,"end":30,"cssClass":"pl-v"}],[],[],[{"start":0,"end":5,"cssClass":"pl-en"},{"start":6,"end":9,"cssClass":"pl-s"}],[{"start":0,"end":13,"cssClass":"pl-s"},{"start":0,"end":4,"cssClass":"pl-cce"},{"start":7,"end":11,"cssClass":"pl-cce"}],[{"start":0,"end":40,"cssClass":"pl-s"}],[{"start":0,"end":17,"cssClass":"pl-s"}],[{"start":0,"end":40,"cssClass":"pl-s"}],[{"start":0,"end":0,"cssClass":"pl-s"}],[{"start":0,"end":66,"cssClass":"pl-s"}],[{"start":0,"end":72,"cssClass":"pl-s"}],[{"start":0,"end":52,"cssClass":"pl-s"}],[{"start":0,"end":3,"cssClass":"pl-s"}],[],[{"start":0,"end":4,"cssClass":"pl-s1"},{"start":5,"end":6,"cssClass":"pl-c1"},{"start":7,"end":12,"cssClass":"pl-en"},{"start":13,"end":88,"cssClass":"pl-s"}],[],[{"start":0,"end":11,"cssClass":"pl-s1"},{"start":12,"end":13,"cssClass":"pl-c1"},{"start":14,"end":19,"cssClass":"pl-en"},{"start":20,"end":25,"cssClass":"pl-en"},{"start":26,"end":89,"cssClass":"pl-s"},{"start":90,"end":91,"cssClass":"pl-c1"}],[{"start":20,"end":82,"cssClass":"pl-s"}],[],[{"start":0,"end":7,"cssClass":"pl-s1"},{"start":8,"end":9,"cssClass":"pl-c1"},{"start":10,"end":13,"cssClass":"pl-en"},{"start":14,"end":19,"cssClass":"pl-en"},{"start":20,"end":91,"cssClass":"pl-s"}],[],[{"start":0,"end":5,"cssClass":"pl-en"},{"start":6,"end":66,"cssClass":"pl-s"}],[{"start":0,"end":5,"cssClass":"pl-en"},{"start":6,"end":18,"cssClass":"pl-s"}],[],[{"start":0,"end":9,"cssClass":"pl-s1"},{"start":10,"end":11,"cssClass":"pl-c1"},{"start":12,"end":14,"cssClass":"pl-s1"},{"start":15,"end":19,"cssClass":"pl-en"},{"start":20,"end":27,"cssClass":"pl-v"},{"start":28,"end":31,"cssClass":"pl-en"},{"start":32,"end":39,"cssClass":"pl-s1"}],[],[{"start":0,"end":5,"cssClass":"pl-en"},{"start":6,"end":58,"cssClass":"pl-s"}],[{"start":0,"end":5,"cssClass":"pl-en"},{"start":6,"end":18,"cssClass":"pl-s"}],[],[{"start":0,"end":3,"cssClass":"pl-s1"},{"start":4,"end":5,"cssClass":"pl-c1"},{"start":6,"end":8,"cssClass":"pl-s1"},{"start":9,"end":13,"cssClass":"pl-en"},{"start":14,"end":21,"cssClass":"pl-v"},{"start":22,"end":25,"cssClass":"pl-en"},{"start":26,"end":33,"cssClass":"pl-s1"}],[{"start":0,"end":12,"cssClass":"pl-s1"},{"start":13,"end":14,"cssClass":"pl-c1"},{"start":16,"end":19,"cssClass":"pl-s1"},{"start":20,"end":21,"cssClass":"pl-c1"},{"start":22,"end":31,"cssClass":"pl-s1"},{"start":33,"end":34,"cssClass":"pl-c1"},{"start":35,"end":46,"cssClass":"pl-s1"}],[{"start":0,"end":7,"cssClass":"pl-s1"},{"start":8,"end":9,"cssClass":"pl-c1"},{"start":10,"end":15,"cssClass":"pl-en"},{"start":16,"end":28,"cssClass":"pl-s1"},{"start":30,"end":31,"cssClass":"pl-c1"}],[],[{"start":0,"end":2,"cssClass":"pl-k"},{"start":3,"end":10,"cssClass":"pl-s1"},{"start":11,"end":13,"cssClass":"pl-c1"},{"start":14,"end":15,"cssClass":"pl-c1"}],[{"start":4,"end":11,"cssClass":"pl-s1"},{"start":12,"end":13,"cssClass":"pl-c1"},{"start":14,"end":15,"cssClass":"pl-c1"}],[],[{"start":0,"end":5,"cssClass":"pl-en"}],[{"start":4,"end":10,"cssClass":"pl-s"},{"start":5,"end":7,"cssClass":"pl-cce"},{"start":7,"end":9,"cssClass":"pl-cce"},{"start":11,"end":12,"cssClass":"pl-c1"}],[{"start":4,"end":33,"cssClass":"pl-s"},{"start":34,"end":35,"cssClass":"pl-c1"},{"start":36,"end":39,"cssClass":"pl-en"},{"start":40,"end":51,"cssClass":"pl-s1"},{"start":53,"end":54,"cssClass":"pl-c1"},{"start":55,"end":58,"cssClass":"pl-s"},{"start":59,"end":60,"cssClass":"pl-c1"},{"start":61,"end":65,"cssClass":"pl-s1"},{"start":66,"end":67,"cssClass":"pl-c1"},{"start":68,"end":72,"cssClass":"pl-s"},{"start":69,"end":71,"cssClass":"pl-cce"},{"start":73,"end":74,"cssClass":"pl-c1"}],[{"start":4,"end":21,"cssClass":"pl-s"},{"start":22,"end":23,"cssClass":"pl-c1"},{"start":24,"end":27,"cssClass":"pl-en"},{"start":28,"end":35,"cssClass":"pl-s1"},{"start":37,"end":38,"cssClass":"pl-c1"},{"start":39,"end":51,"cssClass":"pl-s"},{"start":52,"end":53,"cssClass":"pl-c1"},{"start":54,"end":57,"cssClass":"pl-en"},{"start":58,"end":61,"cssClass":"pl-s1"},{"start":63,"end":64,"cssClass":"pl-c1"},{"start":65,"end":69,"cssClass":"pl-s"},{"start":66,"end":68,"cssClass":"pl-cce"},{"start":70,"end":71,"cssClass":"pl-c1"}],[{"start":4,"end":8,"cssClass":"pl-s"},{"start":5,"end":7,"cssClass":"pl-cce"},{"start":9,"end":10,"cssClass":"pl-c1"}],[{"start":4,"end":25,"cssClass":"pl-s"},{"start":26,"end":27,"cssClass":"pl-c1"},{"start":28,"end":31,"cssClass":"pl-en"},{"start":32,"end":37,"cssClass":"pl-en"},{"start":38,"end":45,"cssClass":"pl-s1"},{"start":48,"end":49,"cssClass":"pl-c1"},{"start":50,"end":54,"cssClass":"pl-s"},{"start":51,"end":53,"cssClass":"pl-cce"},{"start":55,"end":56,"cssClass":"pl-c1"}],[{"start":4,"end":21,"cssClass":"pl-s"},{"start":22,"end":23,"cssClass":"pl-c1"},{"start":24,"end":27,"cssClass":"pl-en"},{"start":28,"end":33,"cssClass":"pl-en"},{"start":34,"end":43,"cssClass":"pl-s1"},{"start":46,"end":47,"cssClass":"pl-c1"},{"start":48,"end":52,"cssClass":"pl-s"},{"start":49,"end":51,"cssClass":"pl-cce"},{"start":53,"end":54,"cssClass":"pl-c1"}],[{"start":4,"end":8,"cssClass":"pl-s"},{"start":5,"end":7,"cssClass":"pl-cce"},{"start":9,"end":10,"cssClass":"pl-c1"}],[{"start":4,"end":74,"cssClass":"pl-s"}],[{"start":4,"end":48,"cssClass":"pl-s"},{"start":45,"end":47,"cssClass":"pl-cce"},{"start":49,"end":50,"cssClass":"pl-c1"}],[{"start":4,"end":8,"cssClass":"pl-s"},{"start":5,"end":7,"cssClass":"pl-cce"},{"start":9,"end":10,"cssClass":"pl-c1"}],[{"start":4,"end":23,"cssClass":"pl-s"},{"start":24,"end":25,"cssClass":"pl-c1"},{"start":26,"end":29,"cssClass":"pl-s1"},{"start":30,"end":34,"cssClass":"pl-s1"},{"start":35,"end":36,"cssClass":"pl-c1"},{"start":38,"end":39,"cssClass":"pl-c1"},{"start":40,"end":44,"cssClass":"pl-s"},{"start":45,"end":46,"cssClass":"pl-c1"},{"start":47,"end":50,"cssClass":"pl-s1"},{"start":51,"end":55,"cssClass":"pl-s1"},{"start":56,"end":57,"cssClass":"pl-c1"},{"start":59,"end":60,"cssClass":"pl-c1"},{"start":61,"end":65,"cssClass":"pl-s"},{"start":66,"end":67,"cssClass":"pl-c1"}],[{"start":4,"end":7,"cssClass":"pl-en"},{"start":8,"end":13,"cssClass":"pl-en"},{"start":14,"end":21,"cssClass":"pl-s1"},{"start":24,"end":25,"cssClass":"pl-c1"},{"start":26,"end":30,"cssClass":"pl-s"},{"start":31,"end":32,"cssClass":"pl-c1"},{"start":33,"end":36,"cssClass":"pl-en"},{"start":37,"end":42,"cssClass":"pl-en"},{"start":43,"end":52,"cssClass":"pl-s1"},{"start":55,"end":56,"cssClass":"pl-c1"},{"start":57,"end":62,"cssClass":"pl-s"},{"start":59,"end":61,"cssClass":"pl-cce"},{"start":63,"end":64,"cssClass":"pl-c1"}],[{"start":4,"end":10,"cssClass":"pl-s"},{"start":7,"end":9,"cssClass":"pl-cce"},{"start":11,"end":12,"cssClass":"pl-c1"}],[{"start":4,"end":26,"cssClass":"pl-s"},{"start":27,"end":28,"cssClass":"pl-c1"},{"start":29,"end":32,"cssClass":"pl-en"},{"start":33,"end":38,"cssClass":"pl-en"},{"start":39,"end":46,"cssClass":"pl-s1"},{"start":49,"end":50,"cssClass":"pl-c1"},{"start":51,"end":59,"cssClass":"pl-s"},{"start":60,"end":61,"cssClass":"pl-c1"}],[{"start":4,"end":19,"cssClass":"pl-s"},{"start":20,"end":21,"cssClass":"pl-c1"},{"start":22,"end":25,"cssClass":"pl-en"},{"start":26,"end":31,"cssClass":"pl-en"},{"start":32,"end":41,"cssClass":"pl-s1"},{"start":44,"end":45,"cssClass":"pl-c1"},{"start":46,"end":51,"cssClass":"pl-s"},{"start":48,"end":50,"cssClass":"pl-cce"}],[],[],[{"start":0,"end":3,"cssClass":"pl-s1"},{"start":4,"end":8,"cssClass":"pl-en"},{"start":9,"end":11,"cssClass":"pl-s1"},{"start":12,"end":17,"cssClass":"pl-v"}]],"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/endail/hx711-rpi-py/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null,"repoAlertsPath":"/endail/hx711-rpi-py/security/dependabot","repoSecurityAndAnalysisPath":"/endail/hx711-rpi-py/settings/security_analysis","repoOwnerIsOrg":false,"currentUserCanAdminRepo":false},"displayName":"calibrate.py","displayUrl":"https://github.com/endail/hx711-rpi-py/blob/master/src/calibrate.py?raw=true","headerInfo":{"blobSize":"2.22 KB","deleteInfo":{"deleteTooltip":"You must be signed in to make or propose changes"},"editInfo":{"editTooltip":"You must be signed in to make or propose changes"},"ghDesktopPath":"https://desktop.github.com","gitLfsPath":null,"onBranch":true,"shortPath":"9faf8a5","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fendail%2Fhx711-rpi-py%2Fblob%2Fmaster%2Fsrc%2Fcalibrate.py","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"72","truncatedSloc":"56"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplateHelpUrl":"https://docs.github.com/articles/about-issue-and-pull-request-templates","issueTemplate":null,"discussionTemplate":null,"language":"Python","languageID":303,"large":false,"loggedIn":false,"newDiscussionPath":"/endail/hx711-rpi-py/discussions/new","newIssuePath":"/endail/hx711-rpi-py/issues/new","planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/endail/hx711-rpi-py/blob/master/src/calibrate.py","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","dismissStackNoticePath":"/settings/dismiss-notice/publish_stack_from_file","releasePath":"/endail/hx711-rpi-py/releases/new?marketplace=true","showPublishActionBanner":false,"showPublishStackBanner":false},"rawBlobUrl":"https://github.com/endail/hx711-rpi-py/raw/master/src/calibrate.py","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"repoOwner":"endail","repoName":"hx711-rpi-py","showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","showDependabotConfigurationBanner":false,"actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"unit","kind":"constant","ident_start":826,"ident_end":830,"extent_start":826,"extent_end":915,"fully_qualified_name":"unit","ident_utf16":{"start":{"line_number":31,"utf16_col":0},"end":{"line_number":31,"utf16_col":4}},"extent_utf16":{"start":{"line_number":31,"utf16_col":0},"end":{"line_number":31,"utf16_col":89}}},{"name":"knownWeight","kind":"constant","ident_start":917,"ident_end":928,"extent_start":917,"extent_end":1093,"fully_qualified_name":"knownWeight","ident_utf16":{"start":{"line_number":33,"utf16_col":0},"end":{"line_number":33,"utf16_col":11}},"extent_utf16":{"start":{"line_number":33,"utf16_col":0},"end":{"line_number":34,"utf16_col":84}}},{"name":"samples","kind":"constant","ident_start":1095,"ident_end":1102,"extent_start":1095,"extent_end":1188,"fully_qualified_name":"samples","ident_utf16":{"start":{"line_number":36,"utf16_col":0},"end":{"line_number":36,"utf16_col":7}},"extent_utf16":{"start":{"line_number":36,"utf16_col":0},"end":{"line_number":36,"utf16_col":93}}},{"name":"zeroValue","kind":"constant","ident_start":1279,"ident_end":1288,"extent_start":1279,"extent_end":1321,"fully_qualified_name":"zeroValue","ident_utf16":{"start":{"line_number":41,"utf16_col":0},"end":{"line_number":41,"utf16_col":9}},"extent_utf16":{"start":{"line_number":41,"utf16_col":0},"end":{"line_number":41,"utf16_col":42}}},{"name":"raw","kind":"constant","ident_start":1404,"ident_end":1407,"extent_start":1404,"extent_end":1440,"fully_qualified_name":"raw","ident_utf16":{"start":{"line_number":46,"utf16_col":0},"end":{"line_number":46,"utf16_col":3}},"extent_utf16":{"start":{"line_number":46,"utf16_col":0},"end":{"line_number":46,"utf16_col":36}}},{"name":"refUnitFloat","kind":"constant","ident_start":1441,"ident_end":1453,"extent_start":1441,"extent_end":1487,"fully_qualified_name":"refUnitFloat","ident_utf16":{"start":{"line_number":47,"utf16_col":0},"end":{"line_number":47,"utf16_col":12}},"extent_utf16":{"start":{"line_number":47,"utf16_col":0},"end":{"line_number":47,"utf16_col":46}}},{"name":"refUnit","kind":"constant","ident_start":1488,"ident_end":1495,"extent_start":1488,"extent_end":1520,"fully_qualified_name":"refUnit","ident_utf16":{"start":{"line_number":48,"utf16_col":0},"end":{"line_number":48,"utf16_col":7}},"extent_utf16":{"start":{"line_number":48,"utf16_col":0},"end":{"line_number":48,"utf16_col":32}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"csrf_tokens":{"/endail/hx711-rpi-py/branches":{"post":"BkBYObWMelRk-qPmcr3OsJX1VnOMQu0itWpenvYaWbsRIM_sj6-mSNrZ3eZ5wUamaFJIDbS2t6EwheN9NZEr8Q"},"/repos/preferences":{"post":"hP8-d82ApH333vuJZJFqJ0iE1oDCUjh9n4-2oy4tHwrE2S8q6D5AUYI3rSbRyCCN4inLc4QzlDDm-GaLDyU6KA"}}},"title":"hx711-rpi-py/src/calibrate.py at master · endail/hx711-rpi-py"}
NameError: name 'false' is not defined
System Information for Raspberry Pi
===================================
1. CPU Information:
Hardware : BCM2835
Revision : d03114
2. Memory Information:
MemTotal: 7999808 kB
MemFree: 7425812 kB
MemAvailable: 7779084 kB
3. Disk Usage:
Filesystem Size Used Avail Use% Mounted on
/dev/root 117G 2.5G 110G 3% /
4. Operating System Details:
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
5. Kernel Details:
Linux armadillo 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
6. Current CPU Temperature:
temp=45.7'C
7. Throttling Status:
throttled=0x0
8. Network Information:
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
inet 192.168.0.166 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::2126:8bee:e620:e96a prefixlen 64 scopeid 0x20<link>
9. Python Version:
Python 3.9.2
Hello,
I'am currently using the library with python on a Raspberry pi 4 b, raspbian 11 bullseye.
Although I followed precisely the install steps, I am getting a syntax error with the following message:
Traceback (most recent call last):
File "/home/pi/App/main.py", line 16, in
communication = Communication()
File "/home/pi/App/Communication.py", line 85, in init
self.scale1 = SimpleHX711(self.hx711_data1,self.hx711_sck1_pin, 95014, 150000)
NameError: name 'SimpleHX711' is not defined
I've tried everything I've could but did not find any solution. The cpp binaries are built and working well.
Dear Mr. Robertson,
I was unlucky today when following your instructions. All your examples and calibration.py use ' from HX711 import * '.
HX711 is nowhere to be found by Python 3.9.2 on my RPi4B with bullseye lite 32bit.
Following your instruction 'pip3 install --upgrade hx711-rpi-py' I found in 'pip3 list': hx711-rpi-py 1.65.0 .
However 'import hx711-rpi-py ' or 'from hx711-rpi-py import * ' is invalid syntax because of the dash.
Module importlib could not help this either. Please enlighten me, what to import to get your python scripts running.
Yours,
[email protected]
P.S.: I did successfully the 'make and install' of http://abyz.me.uk/lg/lg.zip and https://github.com/endail/hx711 , as 'apt-get install -y liblgpio-dev' was not available.
Hi.
I'm trying to run a stepper motor and a load cell simultaneously from my Raspberry Pi 3B+.
I have a HX711 running at 80Hz, and by itself it is working perfectly using the code from endail! Thank you! The HX711 is hooked up to:
GND on HX711 --> GND on Raspberry
DT on HX711 --> GPIO 5 on Raspberry
SCK on HX711 --> GPIO 6 on Raspberry
VCC on HX711 --> 5V on Raspberry
For the loadcell I am using channel A.
I have created an instance hx = SimpleHX711(5,6,4,1918), with 4 and 1918 coming from the calibration script.
I also have a A4988 stepper driver connected into GPIO 20 (Direction pin) and GPIO 21 (Step pin). I have also tried to run it using RPiMotorLib, but that gives exactly the same issue.
As I want to be able to run the motor independently of the load readings, I have launched two threads, one dedicated to the load cell and another to the stepper motor.
If I start the motor first, it runs smoothly until I start the load acquisition, then it starts to jerk.
If start the weight acquisition first, the motor has a jerky motion from the moment I start it. It runs smoothly again when I stop the load acquisition.
Is the hx711 shutting down all GPIO outputs when doing the reading? Or am I missing some obvious point here?
Maybe this is not an issue at all, and I would need separate controllers for each of the features. I cannot get my head around it.
I am grateful for any help on this.
I have the same weight on the load cell. Even I am not doing anything , just watching the screen, as you see in the attached image, number jump suddenly almost double . What can be reason here
Thank you so much for the help
//my code is
from HX711 import SimpleHX711, Rate
with SimpleHX711(5, 6, 1489, -367471, Rate.HZ_80) as hx:
while True:
print(hx.weight(1))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.