电流传感器

来自Labplus盛思维基百科
Tangliufeng讨论 | 贡献2019年4月18日 (四) 09:54的版本
跳转至: 导航搜索
blue:bit-电流传感器

概述

用于检测量环路的电流值的I2C通讯类的传感器

技术参数

  • 工作电压:VCC 3.3-5V
  • I2C数字信号输出
  • 电流范围 : -3~3A
  • 解析度: 0.01A
  • 精度: 1%
  • 模块尺寸:24x46x7.5mm

引脚定义/接口说明

VCC 电源
SDA I2C数据
SCL I2C时钟
GND
  • 拨动开关,可选择模块的I2C地址,用于避免与其他I2C设备地址冲突。注意,重新选择I2C地址后,需要重新上电才能生效!

使用教程

在程序编程中需要注意拨动开关地址和程序中的地址一致!

Arduino

#include <Wire.h>
int reading = 0;
void GetSensorValue(char address)
{
    Wire.requestFrom(address, 2); 
    if (2 <= Wire.available())
    {
       reading = Wire.read();  // receive high byte (overwrites previous reading)
       reading = reading << 8;    // shift high byte to be high 8 bits
       reading |= Wire.read(); // receive low byte as lower 8 bits
       Serial.println(reading);   // print the reading
    } 
}

void setup()
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
}

void loop()
{
   GetSensorValue(0x63);
}

掌控板

from mpython import *                   # 导入mpython
import bluebit                          # 导入bluebit 模块

meter=bluebit.DelveBit(0x60)            # 实例模块,根据实际I2C地址修改

while True:
    value = meter.common_measure()      # 测量
    print("measure: %f" %value)
    sleep_ms(200)

microbit

应用案例

FAQ

版本历史记录

Version Date 新增/删除/修复