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
(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 stillHIGH
- 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.