ohahaha

20A high current AC/DC current detection module-with tutorial

 
Overview

Chip characteristics

Current - Detection: 20A Number of Channels: 1 Output: Ratio, Voltage Sensitivity: 100mV/A Linearity: ±1.5% Accuracy: ±1.5% Response Time: 5μs Current - Power Supply (Max): 13mA

Tutorial

Power supply is 5v, IO output is connected to the microcontroller adc

const int analogInPin = A0;

// 样本数量:样本越多出来的数值越平均,但是要注意缓冲区溢出
const int avgSamples = 10;

int sensorValue = 0;

float sensitivity = 100.0 / 500.0; //每500mV 100mA = 0.2
float Vref = 2500; // 没电流时模块io的输出电压: ~ 2500mV or 2.5V

void setup() {
  //初始化串口通信:
  Serial.begin(9600);
}

void loop() {
  // read the analog in value:
  for (int i = 0; i < avgSamples; i++)
  {
    sensorValue += analogRead(analogInPin);
    delay(2);// 等待2微秒,缓冲时间

  }

  sensorValue = sensorValue / avgSamples;

  // 内置ADC精度是10位 -> 2^10 = 1024 -> 5V / 1024 ~= 4.88mV
  float voltage = 4.88 * sensorValue;

  // 计算实际电流 (mA)
  float current = (voltage - Vref) * sensitivity;

  Serial.print(voltage);  //打印电压
  Serial.print("mV");
  Serial.print(current);  //打印电流
  Serial.print("mA");
  Serial.print("
");
  sensorValue = 0;  // 重置读数
}
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-23 04:22:55
  • How to adjust the frequency by controlling the D0~D7 pins in AD9851 through a single chip microcomputer
  • Tuya Sandwich Wi-Fi & BLE SoC NANO Main Control Board WBRU Unboxing Review
  • MATLAB program for MOS loss calculation
  • AMG board experience
  • MCU help
  • About GPRS module

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号