感測器模組簡介
PRODUCTS DETAILS
https://www.ahest.net/hall-switch/liner-hall-sensor-ah49e.html
◆ Outline
The magnetic sensor will pass linear area /nonlinear area/ saturation area during the magnetic induction increases. When there is no magnetic field that applies in sensor (B=0), when the output voltage of sensor is only half of Vcc (Vcc/2); when “N” pole faces mark surface of sensor, and be closed to it gradualy (B→-∞),the output voltage begins to decrease, and the voltage doesn’t reduce with the increased magnetic field; When the “S” pole of magnet faces the mark surface of the sensor and is closed to sensor gradualy (B→+∞), the output voltage of sensor begins to increase, and it doesn’t increase with the increased magnetic field after it reaches saturation voltage.The magnetic and electric transfer characteristic curve of linear sensor is shown as the figure:
◆ Block Diagram
AH49E is a kind of analog signal output Hall IC, the output voltage changes with the changes of magnetic field. The sensor chip has built-in reverse voltage protection, voltage regulators, temperature compensation circuit, Hall-voltage generator, signal amplifier, and other circuit unit etc. Excellent voltage regulator and temperature compensation circuit ensure the sensor stable operates over a wide voltage range and temperature range, and the reverse voltage protection circuit avoids the water meter sensor to be damaged by reverse voltage.
電路圖
程式列表
Blockly
Python
"""
EPY Sensor
-----------------
AIN0 AO
3V3 VCC
GND GND
"""
from machine import Pin,ADC
from machine import Switch
import utime
from machine import RTC
adc_buf = None
adc0 = None
KeyA = None
rtc = None
adc0 = ADC(Pin.board.AIN0)
KeyA = Switch('keya')
rtc = RTC()
while True:
adc_buf = adc0.read()
print('Analog Value (0 to 4095):' + str(adc_buf))
if (KeyA.value()) == True:
break
utime.sleep_ms( 400 )
執行結果
磁鐵未靠近
磁鐵靠近
磁鐵靠近