一种电磁铁磁场分析测量

 

01测量一款电磁铁的磁场分布


电磁铁是由电流产生磁场的一种磁铁,在通电状态下可产生强劲吸附力,把它安装在设备中可对被吸附物体起到停止或移动作用。根据安培定律,导线种的电流产生导线周围的磁场。为了将磁场集中,在电磁铁中电线被卷绕成一个线圈,许多线并排排列。线圈的所有磁场通过线圈的重心,在那里形成一个强大的磁场。电磁铁磁铁能持续吸附1公斤重量的铁磁体。电磁铁模块使用简单,紧靠控制信号线的高低电平即可控制电磁铁的通断。

一种电磁铁磁场分析测量_第1张图片

▲ 直流吸盘式电磁铁模块 DC5V微型数字信号电磁铁传感器模块

  • 关键参数:

(1)尺寸:2540mm
(2)重量:24g
(3)固定孔尺寸:33
18mm
(4)接口类型:3P传感器防插反接口,舵机线序
(5)信号类型:数字信号
(6)引脚定义:G:负极 V:正极 S:信号
(7)工作温度:-20至80℃
(8)负载可达:1KG
(9)连接线:3P传感器连接线、杜邦线

 

02磁铁周围磁场


1.轴线上垂直距离磁场分布

一种电磁铁磁场分析测量_第2张图片

▲ 随着距离增加,HALL测量磁场强度变化

2.垂直于轴线磁场分布

  • 距离5mm
    一种电磁铁磁场分析测量_第3张图片

    ▲ 水平平移与HALL输出之间的关系

  • 距离2mm
    一种电磁铁磁场分析测量_第4张图片

    ▲ 水平平移与HALL输出之间的关系

  • 距离10mm
    一种电磁铁磁场分析测量_第5张图片

    ▲ 水平平移与HALL输出之间的关系

 

03测量软件


#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# TEST4.PY                     -- by Dr. ZhuoQing 2020-07-26
#
# Note:
#============================================================

from headm import *
import lscm8
from tsmodule.tsstm32       import *
gifid = 9

val1dim = []
val2dim = []
val3dim = []

distdim = linspace(0, 40, 100)

tspgiffirst(gifid)
for i in range(100):
    lscm8.lscm8mb(400)
    stm32cmd('adc')
    time.sleep(.1)
    val = stm32memo(1)
    tspgifappend(gifid)

    val1dim.append(val[0])
    val2dim.append(val[1])
    val3dim.append(val[2])
    printf(val)

tspsavenew('Measure', val1=val1dim, val2=val2dim, val3=val3dim)
#plt.plot(distdim, val1dim)
plt.plot(distdim, val2dim)
#plt.plot(distdim, val3dim)
plt.xlabel("Distance(mm)")
plt.ylabel("Value")
plt.grid(True)
plt.legend(loc='upper right')
plt.tight_layout()
plt.show()

#------------------------------------------------------------
#        END OF FILE : TEST4.PY
#============================================================
#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# LSCM8.PY          -- by Dr. ZhuoQing 2020-01-14
#
# Note:
#============================================================

from head import *
import serial

#------------------------------------------------------------
cmdportdef = 'COM2'
cmdport = serial.Serial(cmdportdef, baudrate=115200, timeout=0.1)
cmdport.setDTR(False)
#cmdport.setRTS(False)

printf("Open %s for LSCM8."%cmdportdef)

#------------------------------------------------------------
COMMAND_FRAME_HEAD        = 0x56
COMMAND_FRAME_TAIL        = 0x65

COMMAND_STATUS_WAIT        = 0x0
COMMAND_STATUS_COMMAND            = 0x1
COMMAND_STATUS_LENGTH            = 0x2
COMMAND_STATUS_DATA        = 0x3
COMMAND_STATUS_CHECK            = 0x4
COMMAND_STATUS_TAIL        = 0x5

#------------------------------------------------------------
COMMAND_HELLO_ECHO        = 0x20
COMMAND_BEEP_ON            = 0x21
COMMAND_BEEP_OFF        = 0x22
COMMAND_DIR_ON            = 0x23
COMMAND_DIR_OFF            = 0x24
COMMAND_REL_ON            = 0x25
COMMAND_REL_OFF            = 0x26
COMMAND_PUL_SET            = 0x27
COMMAND_PUL_STOP        = 0x28
COMMAND_GOTO_HEAD        = 0x29
COMMAND_GOTO_TAIL        = 0x2A
COMMAND_GET_STATE        = 0x2B
COMMAND_GET_PULSEOUT            = 0x2C
COMMAND_CLEAR_PULSEOUT            = 0x2D

#------------------------------------------------------------
def lscm8cmd(cmd, cmddata):

    checksum = cmd + len(cmddata)
    for cd in cmddata:
        checksum = checksum + cd

    checksum = (checksum & 0xff) ^ 0xff

    cmdstr = b'' + byte(COMMAND_FRAME_HEAD) + byte(cmd) + byte(len(cmddata)) +\
             cmddata + byte(checksum) + byte(COMMAND_FRAME_TAIL)

#    printf(cmdstr)
    cmdport.write(cmdstr)

def lscm8hello():
    lscm8cmd(COMMAND_HELLO_ECHO, b'')

def lscm8beepon():
    lscm8cmd(COMMAND_BEEP_ON, b'')

def lscm8beepoff():
    lscm8cmd(COMMAND_BEEP_OFF, b'')

#------------------------------------------------------------
def lscm8relon(bits):
    cmd = bits.to_bytes(1, byteorder='big')
    lscm8cmd(COMMAND_REL_ON, cmd)

#------------------------------------------------------------
# bits:0:relay0, 1:relay1
def lscm8reloff(bits):
    cmd = bits.to_bytes(1, byteorder='big')
    lscm8cmd(COMMAND_REL_OFF, cmd)

def lscm8diron(bits):
    cmd = bits.to_bytes(1, byteorder='big')
    lscm8cmd(COMMAND_DIR_ON, cmd)

def lscm8diroff(bits):
    cmd = bits.to_bytes(1, byteorder='big')
    lscm8cmd(COMMAND_DIR_OFF, cmd)

#------------------------------------------------------------
def lscm8setpulse(bits, pulse):
    cmd = bits.to_bytes(1, byteorder='big') +\
          pulse.to_bytes(4, byteorder='big')
    lscm8cmd(COMMAND_PUL_SET, cmd)

def lscm8stoppulse():
    lscm8cmd(COMMAND_PUL_STOP, b'')

def lscm8gotohead():
    lscm8cmd(COMMAND_GOTO_HEAD, b'')

def lscm8gototail():
    lscm8cmd(COMMAND_GOTO_TAIL, b'')

def lscm8clearpulseout():
    lscm8cmd(COMMAND_CLEAR_PULSEOUT, b'')

def lscm8mf(steps):
    lscm8diron(3)
    lscm8reloff(3)
    lscm8setpulse(3, steps)

def lscm8mb(steps):
    lscm8diroff(3)
    lscm8reloff(3)
    lscm8setpulse(3, steps)

#------------------------------------------------------------
if __name__ == "__main__":
    time.sleep(.5)

#    lscm8diron(3)
#    lscm8reloff(3)
#    lscm8gotohead()
 #   lscm8gototail()
#    lscm8setpulse(3, 1000)
#    lscm8diron(3)

    lscm8mb(100000)

#    lscm8mf(1900000)

    tspbeep(1500, 100)
    printf('End of the command')

#------------------------------------------------------------
#        END OF FILE : LSCM8.PY
#============================================================

你可能感兴趣的:(电子模块实验,基础电子,测量模块)