“(SKU:RB-02S088)電流檢測(cè)傳感器”的版本間的差異

來(lái)自ALSROBOT WiKi
跳轉(zhuǎn)至: 導(dǎo)航搜索
(以“ ==產(chǎn)品概述== ==規(guī)格參數(shù)== ==使用方法== ==應(yīng)用例程== ==產(chǎn)品相關(guān)推薦== 購(gòu)買地址:[http://www.alsrobo...”為內(nèi)容創(chuàng)建頁(yè)面)
 
第1行: 第1行:
 
[[文件:.jpg|500px|縮略圖|右]]
 
[[文件:.jpg|500px|縮略圖|右]]
 
==產(chǎn)品概述==
 
==產(chǎn)品概述==
?
 
+
此產(chǎn)品由一個(gè)電流感應(yīng)器TA12-200組成構(gòu)成??梢詫⒋蟮碾娏髁哭D(zhuǎn)換為幅度小的電壓量輸出。該模塊采用沉金工藝,外觀更加美觀,同時(shí)采用防插反3Pin接口,操作更加安全,插口一邊有大寫字母A表示該模塊位模擬量傳感器,另一邊是電流表的圖標(biāo)標(biāo)志表示該模塊具有測(cè)試電流的功能。此產(chǎn)品可以應(yīng)用于交流電的電流檢測(cè),最大可檢測(cè)的電流為5A。
 
==規(guī)格參數(shù)==
 
==規(guī)格參數(shù)==
?
 
+
# 工作電壓 :+5v
 +
# 尺寸大?。?30mm x 25mm
 +
# 重量大小:8g
 +
# 信號(hào)類型:模擬信號(hào)
 +
===引腳定義===
 +
* S:信號(hào)引腳
 +
* NC:不需要連接
 +
* -:電源地
 
==使用方法==
 
==使用方法==
 +
[[文件:RB-02S08801.jpg|700px|縮略圖|居中]]
 +
[[文件:RB-02S08802.jpg|700px|縮略圖|居中]]
 +
S引腳接到控制器的A0口。NC和 - 分別接到電源的+5V和GND。注:NC可以不接
 +
==應(yīng)用例程==
 +
===示例程序===
 +
<pre style='color:blue'>#define ELECTRICITY_SENSOR A0 // Analog input pin that sensor is attached to
  
?
==應(yīng)用例程==
+
float amplitude_current;              //amplitude current
 +
float effective_value;      //effective current
  
 +
void setup()
 +
{
 +
Serial.begin(9600);
 +
pins_init();
 +
}
 +
void loop()
 +
{
 +
int sensor_max;
 +
sensor_max = getMaxValue();
 +
Serial.print("sensor_max = ");
 +
Serial.println(sensor_max);
 +
//the VCC on the RobotBase interface of the sensor is 5v
 +
amplitude_current=(float)sensor_max/1024*5/800*2000000;
 +
effective_value=amplitude_current/1.414;//minimum_current=1/1024*5/800*2000000/1.414=8.6(mA)
 +
//Only for sinusoidal alternating current
 +
Serial.println("The amplitude of the current is(in mA)");
 +
Serial.println(amplitude_current,1);//Only one number after the decimal point
 +
Serial.println("The effective value of the current is(in mA)");
 +
Serial.println(effective_value,1);
 +
}
 +
void pins_init()
 +
{
 +
pinMode(ELECTRICITY_SENSOR, INPUT);
 +
}
 +
/*Function: Sample for 1000ms and get the maximum value from the SIG pin*/
 +
int getMaxValue()
 +
{
 +
int sensorValue;            //value read from the sensor
 +
int sensorMax = 0;
 +
uint32_t start_time = millis();
 +
while((millis()-start_time) < 1000)//sample for 1000ms
 +
{
 +
sensorValue = analogRead(ELECTRICITY_SENSOR);
 +
if (sensorValue > sensorMax)
 +
{
 +
/*record the maximum sensor value*/
 +
sensorMax = sensorValue;
 +
}
 +
}
 +
return sensorMax;
 +
}</pre>
 +
===程序效果===
 +
打開串口監(jiān)視器之后,會(huì)輸出當(dāng)前檢測(cè)到的模擬值。
 
==產(chǎn)品相關(guān)推薦==
 
==產(chǎn)品相關(guān)推薦==
?
購(gòu)買地址:[http://m.gharee.com/goods-175.html RB-65PG舵機(jī)]
+
購(gòu)買地址:[]

2015年7月31日 (五) 10:51的版本

目錄

產(chǎn)品概述

此產(chǎn)品由一個(gè)電流感應(yīng)器TA12-200組成構(gòu)成??梢詫⒋蟮碾娏髁哭D(zhuǎn)換為幅度小的電壓量輸出。該模塊采用沉金工藝,外觀更加美觀,同時(shí)采用防插反3Pin接口,操作更加安全,插口一邊有大寫字母A表示該模塊位模擬量傳感器,另一邊是電流表的圖標(biāo)標(biāo)志表示該模塊具有測(cè)試電流的功能。此產(chǎn)品可以應(yīng)用于交流電的電流檢測(cè),最大可檢測(cè)的電流為5A。

規(guī)格參數(shù)

  1. 工作電壓 :+5v
  2. 尺寸大小: 30mm x 25mm
  3. 重量大?。?g
  4. 信號(hào)類型:模擬信號(hào)

引腳定義

  • S:信號(hào)引腳
  • NC:不需要連接
  • -:電源地

使用方法

RB-02S08801.jpg
RB-02S08802.jpg

S引腳接到控制器的A0口。NC和 - 分別接到電源的+5V和GND。注:NC可以不接

應(yīng)用例程

示例程序

#define ELECTRICITY_SENSOR A0 // Analog input pin that sensor is attached to

float amplitude_current;               //amplitude current
float effective_value;       //effective current 

void setup() 
{
	Serial.begin(9600); 
	pins_init();
}
void loop() 
{
	int sensor_max;
	sensor_max = getMaxValue();
	Serial.print("sensor_max = ");
	Serial.println(sensor_max);
	//the VCC on the RobotBase interface of the sensor is 5v
	amplitude_current=(float)sensor_max/1024*5/800*2000000;
	effective_value=amplitude_current/1.414;//minimum_current=1/1024*5/800*2000000/1.414=8.6(mA) 
						//Only for sinusoidal alternating current
	Serial.println("The amplitude of the current is(in mA)");
	Serial.println(amplitude_current,1);//Only one number after the decimal point
	Serial.println("The effective value of the current is(in mA)");
	Serial.println(effective_value,1);
}
void pins_init()
{
	pinMode(ELECTRICITY_SENSOR, INPUT);
}
/*Function: Sample for 1000ms and get the maximum value from the SIG pin*/
int getMaxValue()
{
	int sensorValue;             //value read from the sensor
	int sensorMax = 0;
	uint32_t start_time = millis();
	while((millis()-start_time) < 1000)//sample for 1000ms
	{
		sensorValue = analogRead(ELECTRICITY_SENSOR);
		if (sensorValue > sensorMax) 
		{
			/*record the maximum sensor value*/
			sensorMax = sensorValue;
		}
	}
	return sensorMax;
}

程序效果

打開串口監(jiān)視器之后,會(huì)輸出當(dāng)前檢測(cè)到的模擬值。

產(chǎn)品相關(guān)推薦

購(gòu)買地址:[]