resitor on hall effect sensor

I want to use a hall effect sensor, i only have no idea of what resistor to use.

Also i tested pin4, it gives:
4.88V and 85mA

Must i get the supply current to it or the circuit current?
In other words, must i bring the 85 mA back to 20 or 10 mA?

complete datasheet:

Where do those 85mA come from? I hope you haven't already fried it.

It works exactly like a switch that is normally open (NPN transistor with open collector). You connect the supply voltage to Vcc and GND. It will need about 10mA according to the datasheet. As I assume it will be connected to an arduino directly, Vcc is 5V. Then you take a 'pull-up' resistor (say 10k) and connect that to Vcc and the 'output'. Then connect 'output' to any digital pin on your arduino.

Easiest solution is to connect pin 1 to Arduino +5v, pin 2 to Arduino ground and pin 3 to an Arduino input pin. Enable the internal pullup for that Arduino pin by using digitalWrite to write HIGH to it. Then you don't need an external pullup resistor.

The device is an open-collector output - this means you need a pull-up resistor on the output - you can use the built-in pullups thus:

  pinMode (pin, INPUT) ;
  digitalWrite (pin, HIGH) ;

If the pin is written as HIGH while an input a 20k or so internal pull-up resistor is enabled on that pin. Alternatively a physical resistor of 5k to 100k will probably work fine (connect from +5V to the signal pin).

Where do those 85mA come from? I hope you haven't already fried it.

From pin 4 to gnd, i din't wire up the sensor yet.

If 85mA is strange then go to this topic please:
http://arduino.cc/forum/index.php/topic,74084.0.html

Easiest solution is to connect pin 1 to Arduino +5v, pin 2 to Arduino ground and pin 3 to an Arduino input pin. Enable the internal pullup for that Arduino pin by using digitalWrite to write HIGH to it. Then you don't need an external pullup resistor.

How can i read the value if i digitalWrite to HIGH?
And the build in pullup resistor, that is build in the arduino right?

Also what happens if you don't use a pullup resistor, i readed some things about them but it's hard for me to understand.

The sensor has 3 pins... where is your pin #4 ??? On the Arduino ??????????????????

One of the quickest ways to KILL your arduino is to draw 75mA out of one pin.

You need to wire your sensor up like this. Click on the image to enlarge it.

1 Like

How can i read the value if i digitalWrite to HIGH?

That's the way it works when it is set as an input.

And the build in pullup resistor, that is build in the arduino right?

Yes. You can use it, but if you feel it is to difficult, use an external one for now.

The sensor has 3 pins... where is your pin #4 ??? On the Arduino ??????????????????

It had nothing to do with the sensor, just a test to see how much mA was coming out.

One of the quickest ways to KILL your arduino is to draw 75mA out of one pin.

Then how can i lower it? And why would it kill it, it's output, not input.

And why does the image shows a battery?

Why does it show a battery? Do you want to use lemons and zinc/copper nails? If it is plugged into the usb port, you don't need the battery of course. Then you'll get the 5V from the pc.

You have already mentioned in another post that the arduino survives an maximum of 40mA per pin. Now you force 75mA down its throat. Doesn't that ring a bell, maybe?

How to lower it? Use a resistor.

But honestly I'm not quite sure what it is you want to do exactly, and why it would require shorting out a pin by brute force. That's like sticking your hand in a food processor to find out if it is on...

And why would it kill it, it's output, not input.

Two ways of killing any electronics:-

  1. Put too much voltage into an input.
  2. Take too much current from an output.

The second is the most popular way of killing an arduino and you seem to be more than willing to conspire in its death.
Do not do things like trying to measure the current from an output with a meter and no load. It implies you have little idea of how electricity works.

Just to make sure, there is voltage coming from arduino pin 4 and the arduino 5V to the output pin of the sensor, and 5V is coming to the Vcc pin of the sensor. (and gnd connected to gnd).
(I want to use the internal pull-up resistor ).

And what is the NPN and all there rear signs around?
And the red triangle in the left bottom corner.

Also i saw on a video that the voltage was depanding on the magnet, so can i use analogRead?

Yes, those connections are correct. You supply 5v to the Hall sensor for its internal circuitry, and the output of the Hall sensor is draws current from +5v through a pullup resistor. You don't need R1 because you are planning to use the internal pullup resistor in the Arduino.

The "NPN" means that the hall sensor output is an open-collector NPN transistor.

Also i saw on a video that the voltage was depanding on the magnet, so can i use analogRead?

Not with this device you can't it is a latching switch sensor. That means when it see a magnetic field the output will go low and stay low until it sees a magnetic field of the opposite polarity. Then it will go high and stay high until it sees a field of the original polarity. Is that what you were expecting?

And the red triangle in the left bottom corner.

Signifies the emitter of the NPN transistor.

I hope your circuit is not actually like this because I don't think you can get a 5V battery.

If I had chosen the 'usual' 9V cell, I'd have had to add a voltage regulator as well. To keep it short and simple I chose not to.

And the schematic shows 2 cells... and if you take 2 almost dead 3V coin cells you get about 5V 8)

But I don't think the kind of voltage source used here is the real problem.

Ok,

You don't need R1 because you are planning to use the internal pullup resistor in the Arduino.

Are you sure that i don't fry my arduino or hallway sensor if i don't use a resistor at all (apart from the internal)?

You guys scare me :slight_smile:

Yes I am sure you don't need a pull up resistor.
You have a strange idea of what can damage your arduino. You do things that are clearly dangerous then you question what is perfectly safe.
But don't just take my word for it, if anyone says something wrong here ther are plenty of good people that will jump in and disagree.

clankill3r:
Ok,

You don't need R1 because you are planning to use the internal pullup resistor in the Arduino.

Are you sure that i don't fry my arduino or hallway sensor if i don't use a resistor at all (apart from the internal)?

You guys scare me :slight_smile:

It is quite safe to leave that resistor out, i.e. just remove it from the schematic (DON'T replace it with a wire!). When you power the circuit up, there will be no pullup resistor present on that pin, but this is OK, the Hall sensor doesn't mind this. During setup() you configure the pin as an input (or leave it configured that way, because it is the default) but digitalWrite HIGH to it, which enables the internal 20k pullup. After that, reading from the pin will give you the high or low reading from the Hall sensor.

WHOOT you guys are perfect!!!
It works!

You guys scare me

Well you can continue to be scared your whole like, and have to get permission and advice (and try and memorize the proper answer for the future) for every wire you hook-up, or you could get serious about learning fundamental DC electronics so that you can understand and answer your own questions in the future.

So your questions should not just ask how to do something, but also why so you can understand the reason the answer is correct.

Lefty

Well you can continue to be scared your whole like, and have to get permission and advice (and try and memorize the proper answer for the future) for every wire you hook-up, or you could get serious about learning fundamental DC electronics so that you can understand and answer your own questions in the future.

So your questions should not just ask how to do something, but also why so you can understand the reason the answer is correct.

Lefty

agree, and i'm slowly getting to that :slight_smile: