# simultaneously read 16 hall sensor and maximum current allowed by Arduino

My question is about maximum current allowed by Arduino.

I know it's 200mA in Arduino and 40mA in every pin (lower in arduino mini). Just wondering if simultaneously read 16 hall sensor (than can be all activated at the same time) is too much. My calculation is 200 / 16 = 12.5 mA máximum current I can drive to a pin from a sensor, but it's enough to read the sensor? Specs from 3144 hall sensor says it outputs 25mA when activated. Can I put a resistante between output's sensor and Arduino pin?

I'm planning to use Arduino mini and sensor hall 3144.

Sorry for my english, and thanks in advance!

p.s: The original idea was read all 64 sensors with one Arduino, but breaking it into several arduinos is easiest as my electronics knowledge is seriously limited :)

• Which Arduino? Which hall effect sensor? – Nick Gammon Feb 27 '18 at 11:06
• Arduino mini and 3144 hall sensor. I've edited the post, thanks for the appointment! – user675319 Feb 27 '18 at 11:11
• I know that i can reduce input current on each pin using resistors, but what is the minimum current to activate an Arduino digital pin? – user675319 Feb 27 '18 at 11:32
• I've seen people multiplex a grid of hall-effect sensors. – Gerben Feb 27 '18 at 15:45

Since this sensor doesn't need to be driven directly from a pin, the maximum current for one pin is not important here. The hall sensor uses two of it's pins as supply voltage. The output pin is an Open-Collector pin. So it will be connected to GND trough a transistor depending on the magnetic field. If you use an external pullup resistor (as connection between OUTPUT and positive supply voltage), you get somewhat like a voltage divider. Since the hall sensor seems to behave as a switch, there will only be two possible states. When the magnetic field is low, the transistor doesn't let the current flow. The pullup resistor can pull the pin to the positive supply voltage (5V -> 1 as digital value). If the magnetic field is high enough, the transistor will open the connection to GND. Now a maximum of 25mA of current can flow throw it to GND. The voltage of the pin is now determined by the voltage divider the transistor and the pullup resistor build. You can calculate the virtual "resistance" of the transistor in this state with Ohm's law

R = U/I

(R is resistance, U is voltage and I is current) With 5V supply voltage and 25mA current you get a resistance of 200 Ohm. Since you just want to use the sensor as a switch, you only have to ensure, that the pin cannot be pulled to a significantly greater value than 0V. So grab a resistor, that is significantly higher than 200 Ohm and use it as pullup resistor. Keep in mind, that you always must use the pullup resistor with the supply voltage, that runs the Arduino. A higher voltage can fry the Arduinos components.

Then you connect this pin to a digital pin of the Arduino, which you configure as INPUT. In this state the pin has a high impedance, so that the current, that flows into it, is really small (it CAN source 25mA, but it does not have to. The current depends on your external circuit). So this isn't something you have to bother about.

This leaves us with the supply current, that the sensor needs to work. In the datasheet it says, that at a supply voltage of 8V the supply current is at maximum 9mA. For 16 sensors this gives us a total of 144mA, which is still comfortable inside the 200mA the Arduino can provide. So you should be able to drive all of them safely.

That said, if you want to add more components, that draw current, it might be better so source the current you need not over the Arduino but directly from your power source (if this is possible for you). Depending on the current you may need, it can also be good, to get an external voltage regulator (if your supply doesn't directly give you 5V), that can provide enough current.

• So I only need to use a resistor to control the voltage from sensor to arduino , thank you Chrisl. It's complicated to calculate resistance value? I've read that typical are 10k ohm, but I guess it depends on voltage provided by external battery... – user675319 Feb 27 '18 at 13:07
• I'm a little confused with the resistor... If I have 9V as external supply, then I have to reduce this to 5V before carry this current to Arduino pin? – user675319 Feb 27 '18 at 14:12
• I edited my answer to make it clearer, what I meant. If you don't understand, what I wrote, you should read a tutorial or similar about switches and pullup/pulldown resistors. Maybe you can start here: [ learn.sparkfun.com/tutorials/pull-up-resistors ] – chrisl Feb 27 '18 at 14:39

As Gerben mentioned in a comment, you could set up a matrix of the sensors.

Since the 3144 effectively is a switch to ground (when the magnet comes close it pulls the data line low) you would wire them up like a keypad matrix. I recently did an answer about a keypad matrix. If you wanted 64 sensors you would only need 16 Arduino pins (8 for the rows and 8 for the columns).

The keypad matrix I described already drives the rows low, so that is the right polarity for the sensors. You would just need a pull-up for the columns, say 10k. The sensor then just has to sink 5/10000 amps (0.5 mA) which is well within spec.

The supply voltage to the sensors can be provided independently of the Arduino (however 5V would be reasonable). Since the sensors apparently usually consume 4.4 mA, then 64 would consume 282 mA, which is probably quite reasonable to supply from the Arduino 5V pin.

The diodes mentioned in the keypad matrix answer are probably a sensible precaution if you are likely to have more than one sensor activated at once.

• Hi Nick, it's a new approach for me that looks pretty good... I'll read your keypad matrix answer, thanks for your time! – user675319 Feb 28 '18 at 10:04
• Just one question about sensor matrix, it can manage several sensors activated at the same time? – user675319 Feb 28 '18 at 10:08
• (Answered by me: Yes, it can. You already specified at the end of the answer, that's the point for diodes) – user675319 Feb 28 '18 at 10:17