• +965 51122049
Class Bihor magnetic sensor (analog Hall magnetic sensor module)

Class Bihor magnetic sensor (analog Hall magnetic sensor module)

KWD1.250KWD1.250
0%Off

Class Bihor magnetic sensor (analog Hall magnetic sensor module)


 

 


Share:

This is an analog magnetic field sensor module. The strength of the field is given by an analog voltage at the signal pin. The sensor is connected to gnd and 5V of the Arduino board. The output voltage is measured by analog pin A5 on the Arduino board.

The example program measures the output voltage of the sensor en presents the measured value in the serial monitor of the Arduino.

The led on the board flashes in a speed depending on the strength of the magnetic field. With a small magnet this can be demonstrated.

Connecting to the Arduino

  • Pin - = GND, connect to GND of the Arduino
  • Pin (middle pin) +5 V, connect to Arduino +5 V
  • Pin S signal, connect to Arduino pin A5
  • Power consumption sensor, 8 mA

Example Code

/* 
KY-035 Hall analog sensor
*/
	
	
 
int
	
	 sensorPin =
	
	 A5;
	
	    // select the input pin
	
	
int
	
	 ledPin =
	
	 13
	
	;
	
	       // select the pin for the LED
	
	
int
	
	 sensorValue =
	
	 0
	
	;
	
	   // variable to store the value coming from the sensor
	
	
 
void
	
	 setup ()
	
	 {
	
	
  pinMode (
	
	ledPin,
	
	 OUTPUT)
	
	;
	
	
  Serial.begin
	
	 (
	
	9600
	
	)
	
	;
	
	
}
	
	
 
void
	
	 loop ()
	
	 {
	
	
  sensorValue =
	
	 analogRead (
	
	sensorPin)
	
	;
	
	
  digitalWrite (
	
	ledPin,
	
	 HIGH)
	
	;
	
	
  delay (
	
	sensorValue)
	
	;
	
	
  digitalWrite (
	
	ledPin,
	
	 LOW)
	
	;
	
	
  delay (
	
	sensorValue)
	
	;
	
	
  Serial.println
	
	 (
	
	sensorValue,
	
	 DEC)
	
	;
	
	
}
	
	

Add your review

Your email address will not be published. Required fields are marked *

Please login to write review!

Upload photos

Looks like there are no reviews yet.

Related Products