0
\$\begingroup\$

This is almost certainly a noob-level question. I only have one Hall effect sensor to play around with so I can't test this out for myself.

Say I have multiple Hall effect sensors wired like this, but their output pins all connect to the same pin on an Arduino. Namely:

  • all left legs tied to 5V
  • all center legs to ground
  • output pins to 5V via a pullup resistor and also to the same Arduino pin

hall effect wiring: pin 1 to +5V, pin 2 to ground, output pin to digital out and 5V via 10k pullup

(image credit to Wei-Hsiung Huang)

With the pullup, digitalRead()will normally be HIGH, going LOW when a magnet triggers the switch. What I'm unsure of is what happens in the scenario of multiple outputs tied together and one sensor being triggered. Could someone help me understand which of these occurs?

  • the other pins keep the output HIGH since they are still HIGH
  • the activated pin is like a connection to ground, so the output goes LOW

Followup: in the dream scenario where all of them go LOW upon one activating, do they need separate physical pullups, or would it work to have them all tied directly to the Arduino using pinMode(pin, INPUT_PULLUP)?


Edit: I'm not familiar with all the different types, but per Michael's comment I should have included a specific example. I was considering this sensor, the AH3390Q-P-B from Diodes Incorporated. That said, for the sake of generality, if there were specific cases where this would/would not work, it might be useful to specify for other readers.

For two other examples, Adafruit supplies the Melexis US5881 and Amazon seems to almost exclusively sell the Allegro A3144.

\$\endgroup\$
  • \$\begingroup\$ Without looking at the datasheet, the digital out is likely a common drain/common emitter type of circuit, so the out node will be pulled down to ground. This means that you can do a bunch in parallel, and if any one sensor triggers the output node will go low (known as a wired OR configuration). Only when all sensors are outputting high will the out node be high. You should still only need one pull-up resistor. This resistor can be internal or external. \$\endgroup\$ – Michael Feb 12 at 2:52
  • \$\begingroup\$ @Michael thanks for the response! Apologies, I indeed should have included a specific example as I'm sure the type matters. I updated my answer with a link to the specific example I had mind for my application and two other common ones I ran across that would probably be relevant to other hobbyists. \$\endgroup\$ – Hendy Feb 12 at 3:16
0
\$\begingroup\$

The sensors you linked are all open collector or open drain, so they pull their output low, and depend on an external resistor to pull the output high.

You can connect all the outputs together, with a single pull-up resistor, to the Arduino input. If the Arduino input has an internal pull-up resistor, you may not need an external pull-up.

The total output leakage current of the sensors may determine the need for an external pull-up resistor, or may limit the number of sensors you can connect in parallel for reliable operation.

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.