Difference between revisions of "Hall Effect Sensor"
(Created page with " [https://s3.amazonaws.com/linksprite/Arduino_kits/SensorsPack/0004824_US5881_rev008.pdf Datasheet]") |
Yajuan.dai (talk | contribs) (→Example Project) |
||
| (11 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| + | == Introduction == | ||
| + | Hall effect sensors detect whether a magnet is near. Useful for non-contact/waterproof type switches, position sensors, rotary/shaft encoders. | ||
| − | [https://s3.amazonaws.com/linksprite/Arduino_kits/SensorsPack/0004824_US5881_rev008.pdf Datasheet] | + | Runs at 3.5V up to 24V. To use connect power to pin 1 (all the way to the left), ground to pin 2 (middle) and then a 10K pull up resistor from pin 3 to power. Then listen on pin 3, when the south pole of a magnet is near the front of the sensor, pin 3 will go down to 0V. Otherwise it will stay at whatever the pullup resistor is connected to. Nothing occurs if a magnet's north pole is nearby (unipolar). |
| + | |||
| + | [[File:hall sensor.jpg | 400px]] | ||
| + | |||
| + | ===Detailed=== | ||
| + | *[http://linksprite.com/wiki/index.php5?title=%E9%9C%8D%E5%B0%94%E4%BC%A0%E6%84%9F%E5%99%A8_Hall_Effect_Sensor Hall Effect Sensor] [IT_HALLEF] [EA101106] | ||
| + | *[http://linksprite.com/wiki/index.php5?title=%E7%A3%81%E9%93%81_sensing_a_magnet sensing a magnet [IT_SEN_MAG] [WC101101] | ||
| + | |||
| + | ==Example Project== | ||
| + | |||
| + | The purpose of this project is to demo the usage of Hall Sensor. When the magnet is close to Hall sensor, the LED-L on Arduino will turn on, and the LED will turn off when the magnet is removed. | ||
| + | |||
| + | '''List of Components:''' | ||
| + | |||
| + | {| border="1" cellspacing="0" width="100%" | ||
| + | |- | ||
| + | ! style="width: 50%" scope="col" align="center" | Item | ||
| + | ! scope="col" align="center" | Quantity | ||
| + | |- | ||
| + | ! scope="row" | Arduino Duemilanove or Uno | ||
| + | | align="center" | 1 | ||
| + | |- | ||
| + | ! scope="row" | Hall Sensor | ||
| + | | align="center" | 1 | ||
| + | |- | ||
| + | ! scope="row" | USB Cable with type A Interface | ||
| + | | align="center" | 1 | ||
| + | |- | ||
| + | ! scope="row" | Mini Breadboard | ||
| + | | align="center" | 1 | ||
| + | |- | ||
| + | ! scope="row" | Jumper Wire with Male Header | ||
| + | | align="center" | 3 | ||
| + | |- | ||
| + | ! scope="row" | Resister with value 10K ohm | ||
| + | | align="center" | 1 | ||
| + | |- | ||
| + | ! scope="row" | PC | ||
| + | | align="center" | 1 | ||
| + | |} | ||
| + | |||
| + | '''Schematics:''' | ||
| + | |||
| + | [[File:Hall sensor sch.jpg | 400px]] | ||
| + | |||
| + | |||
| + | '''Hardware:''' | ||
| + | |||
| + | [[File:Hall sensor 1.jpg | 400px]] | ||
| + | |||
| + | Components needed for the project | ||
| + | |||
| + | |||
| + | [[File:Hall sensor 2.jpg | 400px]] | ||
| + | |||
| + | Wiring Picture | ||
| + | |||
| + | |||
| + | [[File:Hall sensor 3.jpg | 400px]] | ||
| + | |||
| + | When there is no magnet close to the Hall sensor, the LED-L will remain off. | ||
| + | |||
| + | |||
| + | [[File:Hall sensor 4.jpg | 400px]] | ||
| + | |||
| + | When magnet is close to the Hall sensor, the LED-L will turn off. | ||
| + | |||
| + | |||
| + | Pin 3 of hall sensor is connected to D12. D12 will detect the voltage level of D12 to judge if there is magnet close to it. The result will be displayed on LED-L which is controlled by D13. | ||
| + | |||
| + | '''Code:''' | ||
| + | |||
| + | <syntaxhighlight lang="c"> | ||
| + | |||
| + | int ledPin = 13; | ||
| + | int out = 12; | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | pinMode(ledPin, OUTPUT); | ||
| + | pinMode(out, INPUT); | ||
| + | } | ||
| + | |||
| + | void loop() | ||
| + | { | ||
| + | if ( digitalRead(out) ) | ||
| + | { | ||
| + | digitalWrite(ledPin,LOW ); | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | digitalWrite(ledPin,HIGH); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </syntaxhighlight> | ||
| + | |||
| + | ==Resources== | ||
| + | *[https://s3.amazonaws.com/linksprite/Arduino_kits/SensorsPack/0004824_US5881_rev008.pdf Datasheet] | ||
Latest revision as of 02:09, 20 August 2014
Introduction
Hall effect sensors detect whether a magnet is near. Useful for non-contact/waterproof type switches, position sensors, rotary/shaft encoders.
Runs at 3.5V up to 24V. To use connect power to pin 1 (all the way to the left), ground to pin 2 (middle) and then a 10K pull up resistor from pin 3 to power. Then listen on pin 3, when the south pole of a magnet is near the front of the sensor, pin 3 will go down to 0V. Otherwise it will stay at whatever the pullup resistor is connected to. Nothing occurs if a magnet's north pole is nearby (unipolar).
Detailed
- Hall Effect Sensor [IT_HALLEF] [EA101106]
- sensing a magnet [IT_SEN_MAG [WC101101]
Example Project
The purpose of this project is to demo the usage of Hall Sensor. When the magnet is close to Hall sensor, the LED-L on Arduino will turn on, and the LED will turn off when the magnet is removed.
List of Components:
| Item | Quantity |
|---|---|
| Arduino Duemilanove or Uno | 1 |
| Hall Sensor | 1 |
| USB Cable with type A Interface | 1 |
| Mini Breadboard | 1 |
| Jumper Wire with Male Header | 3 |
| Resister with value 10K ohm | 1 |
| PC | 1 |
Schematics:
Hardware:
Components needed for the project
Wiring Picture
When there is no magnet close to the Hall sensor, the LED-L will remain off.
When magnet is close to the Hall sensor, the LED-L will turn off.
Pin 3 of hall sensor is connected to D12. D12 will detect the voltage level of D12 to judge if there is magnet close to it. The result will be displayed on LED-L which is controlled by D13.
Code:
<syntaxhighlight lang="c">
int ledPin = 13; int out = 12;
void setup() {
pinMode(ledPin, OUTPUT); pinMode(out, INPUT);
}
void loop() {
if ( digitalRead(out) )
{
digitalWrite(ledPin,LOW );
}
else
{
digitalWrite(ledPin,HIGH);
} }
</syntaxhighlight>

