HELLO THERE!!!
How are you,guys? I hope everyone is fine and in a good mood always. This week I wanted to share with you guys a simple experiment I did over the weekend. The objective of this week's experiment is to receive basic feedback from the linear hall sensor.
What is a Linear Hall Sensor?
Basically a linear hall sensor is a magnetic module with a digital interface. The sensor also has a built in LED in it.The sensor can detect magnetic field, thus making it useful in many projects (magnetic door lock to name a few).
HARDWARE:
1.Arduino UNO ( you can use other Arduino)
Well, that's all from me guys, this week. I hope to see you guys next week and till then, HAPPY TINKERING!!!
How are you,guys? I hope everyone is fine and in a good mood always. This week I wanted to share with you guys a simple experiment I did over the weekend. The objective of this week's experiment is to receive basic feedback from the linear hall sensor.
What is a Linear Hall Sensor?
Basically a linear hall sensor is a magnetic module with a digital interface. The sensor also has a built in LED in it.The sensor can detect magnetic field, thus making it useful in many projects (magnetic door lock to name a few).
HARDWARE:
1.Arduino UNO ( you can use other Arduino)
2.Linear Hall Sensor
SOFTWARE:
1.Arduino IDE
CIRCUIT ASSEMBLY
Referring to the sensor image below:
SENSOR ARDUINO
G ----------> GND
+ -----------> 5V
D0 -----------> Digital pin 8 (any digital pin)
CODING THE ARDUINO
int led=13; //initializing led pin in digital pin 13(built in led)
int hals=8;// initializing hall sensor in digital pin 8
void setup() {
pinMode(led, OUTPUT);// defining led as OUTPUT
Serial.begin(9600);//serial communication at 9600 bps
}
void loop() {
if (digitalRead(hals)== HIGH) // read the digital value sensor and if the sensor value is high
{
digitalWrite(led,HIGH); //turn on the led
Serial.println("HIGH");//print out "HIGH"
}
if (digitalRead(hals)== LOW)// read the digital value sensor and if the sensor value is high
{
digitalWrite(led,LOW);//turn of the led
}
}
Upload the code to arduino and test it!! Bring the magnet close to the sensor and see the response and feedback of the sensor. A demo video is shown below:
Comments
Post a Comment