Measure force on M5StickC through PbHub with Weigh Module?
-
Hello!
I am trying unsuccessfully to collect data through the pbhub unit (Link) with a weigh module (Link) connected to port 4 on a M5StickCPlus unit.I can verify that the weigh module works when connected directly to the M5StickC via the Grove Port, however when attaching this to any of the grove ports on the PbHub unit I am unable to read the correct value.
Any help or tips would be helpful. TU!
-
Hello @pso
I don't have those unit / module so my conclusion could be wrong.
Looking at the Arduino code for the weigh module it seems that the clock timing / reading is quite time critical and if not perfect, the readings will be incorrect.
When connected to the PbHub the built in chip (MEGA328) would have to mimic the timing, but from the description I understand it can only handle simple GPIO, DA and AD. I don't think it can generate the necessary clock timing in the uSec range required.
Also the PbHub description mentions "Notice2: Not all M5 Units with PortB (Black) are able to be extended by PbHUB." Unfortunately it doesn't say which.
When you look into UIFlow, add a PbHUB and then select the weigh unit you'll notice that there are a couple of pin pairs to choose from, but PbHUB is not an option.
@M5Stack engineers: care to weigh in?
Thanks
Felix -
Why are you connecting it to the hub?
-
For my particular project I have a 8 digital IO that I am trying to connect and therefore would like to use the PbHub connected to the M5StickC to expand the IO (as they advertise). I also have the weight module which works fine if I connect this directly to the M5StickC grove port.
So now I must choose between using a PbHub or a Weigh module. I had thought it possible to add the weigh module to one of the ports on the PbHub however after experimenting with different pin combinations for initializing the HX711 scale i.e.
HX711 scale(33, 32); // This works when the weigh unit is connected to the grove port on the M5StickC
// Below are the other combinations I tried for passing the necessary pins to the HX711 through the Mega328 without any success.
//HX711 scale(porthub.hub_d_read_value_B(4), porthub.hub_d_read_value_A(4));
HX711 scale(porthub.hub_a_read_value(4), 32);
//HX711 scale(porthub.hub_d_read_value_A(4), 32);
//HX711 scale(porthub.hub_d_read_value_B(4), porthub.hub_d_read_value_A(4));
//HX711 scale(porthub.hub_d_read_value_A(4), porthub.hub_d_read_value_B(4));Unfortunately, I think @felmue is right. The Mega328 isn't able to forward the clock required by the HX711 chip.