question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reading both channels in one script

See original GitHub issue

Hey! 😃 I’m working with HX711 module in my master degree in mechatronics and I’ve noticed that there is some ‘bug’ in your library.

When initialising an object HX711 like: hx = HX711(dout_pin=5, pd_sck_pin=6) u got this at first : def __init__(self, dout_pin, pd_sck_pin, gain_channel_A=128, select_channel='A'): and than

self.select_channel(select_channel)

this method makes:

if (channel == ‘A’): self._wanted_channel = ‘A’ elif (channel == ‘B’): self._wanted_channel = ‘B’`

in result, when I create 4 objects like

hx = HX711(dout_pin=5, pd_sck_pin=6) hxb= HX711(dout_pin=5, pd_sck_pin=6) hxc= HX711(dout_pin=13, pd_sck_pin=19) hxd= HX711(dout_pin=13, pd_sck_pin=19) hxd.select_channel(channel=‘B’) hxb.select_channel(channel=‘B’)

and two of them set to channel B , and try to read one after another in order ch A, ch B, ch A, ch B the frequency of reading samples is like 3Hz despite i got my hx711 module set to 80Hz mode.

Why is that? Because ! if (channel == 'A'): self._wanted_channel = 'A' elif (channel == 'B'): self._wanted_channel = 'B' this library expects that the next reading channel will be the same as currently read. And because of that, requirement of additional pulses after reading 24 bits are not satisified. 88059173_2596746330606984_7389469049261916160_n

I think that makes the module reset all the time, and wait to turn on and set again.

I think, that i case like that (reading channels in order ABAB) its enough to do fix like this:(line 383) if self._wanted_channel == ‘A’ and self._gain_channel_A == 128: if not self._set_channel_gain(2): # send only one bit which is 1 return False # return False because channel was not set properly else: self._current_channel = ‘A’ # else set current channel variable self._gain_channel_A = 128 # and gain elif self._wanted_channel == ‘A’ and self._gain_channel_A == 64: if not self._set_channel_gain(3): # send three ones return False # return False because channel was not set properly else: self._current_channel = ‘A’ # else set current channel variable self._gain_channel_A = 64 else: if not self._set_channel_gain(1): # send two ones return False # return False because channel was not set properly else: self._current_channel = ‘B’ # else set current channel variable

I hope that it will be helpfull for somebody 😉

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jacktian-webcommented, Aug 4, 2021

I am going to give up on this chip. because I am trying to detect high-frequency objects. thank you for your reply.

0reactions
Morriouscommented, Aug 3, 2021

Your red chip doesn’t have a label on it, but based on the circuit board it looks like the orientation of the HX711 is the same as in the picture supplied with this repository. That picture is here. You’ll note that an obvious matching pin is the DAT pin is connected to the 4th from the bottom right in both pictures.

Please let me know how it goes with the 80Hz, I’m curious what the actual rate ends up being when accounting for some bad returns. I don’t run this repository, but I made my own HX711 repository over here with an emphasis on sampling multiple HX711 sensors in parallel.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reading from multiple channels simultaneously in Golang
Depending on your requirements, you may need to read both of the channels for every iteration (i.e. a sort-of 'zip' function).
Read more >
Reading two audio channels in and writing one ... - MathWorks
Hi, simple case but looks weird for me: I am reading two channel audio in and doing some processing and currently it only...
Read more >
Read and write to multiple queues within one script · Issue #293
I created a unit test script that both reads and writes work queue messages to a rabbitmq service. It works perfectly fine if...
Read more >
LlListen - Second Life Wiki
Messages sent by script on positive and negative channels are truncated to 1024 bytes. Messages sent by chat on positive channels are truncated ......
Read more >
How do I draw just one channel of a waveform in Praat?
In the objects window, choose. Convert > Convert to mono. This converts your recording from stereo to mono by overlaying the two channels....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found