“(SKU:RB-02S088)電流檢測傳感器”的版本間的差異
來自ALSROBOT WiKi
(→?程序效果) |
(→?產(chǎn)品相關(guān)推薦) |
||
第99行: | 第99行: | ||
[[文件:erweima.png|230px|無框|右]] | [[文件:erweima.png|230px|無框|右]] | ||
===購買地址=== | ===購買地址=== | ||
? | [ | + | [https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-3667083713.10.RCxcrJ&id=521034929916 電流檢測傳感器] |
===周邊產(chǎn)品推薦=== | ===周邊產(chǎn)品推薦=== | ||
? | [http://m.gharee.com/goods-167.html Arduino 旋轉(zhuǎn)角度傳感器] | + | [http://m.gharee.com/goods-167.html Arduino 旋轉(zhuǎn)角度傳感器]<br/> |
? | <br/> | + | [http://m.gharee.com/goods-196.html 通用傳感器連接線 3P杜邦連接線]<br/> |
? | [http://m.gharee.com/goods- | + | |
? | + | ||
===相關(guān)問題解答=== | ===相關(guān)問題解答=== | ||
===相關(guān)學習資料=== | ===相關(guān)學習資料=== | ||
? | |||
[http://www.makerspace.cn/portal.php 奧松機器人技術(shù)論壇] | [http://www.makerspace.cn/portal.php 奧松機器人技術(shù)論壇] |
2015年8月28日 (五) 14:36的版本
目錄 |
產(chǎn)品概述
此產(chǎn)品由一個電流感應(yīng)器TA12-200組成構(gòu)成??梢詫⒋蟮碾娏髁哭D(zhuǎn)換為幅度小的電壓量輸出。該模塊采用沉金工藝,外觀更加美觀,同時采用防插反3Pin接口,操作更加安全,插口一邊有大寫字母A表示該模塊位模擬量傳感器,另一邊是電流表的圖標標志表示該模塊具有測試電流的功能。此產(chǎn)品可以應(yīng)用于交流電的電流檢測,最大可檢測的電流為5A。
規(guī)格參數(shù)
- 工作電壓 :+5v
- 尺寸大?。?30mm x 25mm
- 重量大?。?g
- 信號類型:模擬信號
- 孔徑:4.96mm
引腳定義
- S:信號引腳
- NC:不需要連接
- -:電源地
使用方法
引腳接線:
傳感器引腳 | 所接引腳 |
電位計模塊 S 引腳 | 穿過電流傳感器接在UNO的D13 S 引腳 |
電位計模塊 + 引腳 | 振動馬達 + 引腳 |
電位計模塊 - 引腳 | 懸空 |
電流傳感器 | 控制器 A0 引腳 |
振動馬達 + — 引腳 | 分別接在控制器Vcc和GND |
注:NC可以不接
應(yīng)用例程
示例程序
#define ELECTRICITY_SENSOR A0 // Analog input pin that sensor is attached to int mada = 13; float amplitude_current; //amplitude current float effective_value; //effective current void setup() { Serial.begin(9600); pins_init(); pinMode(mada, OUTPUT); } void loop() { digitalWrite(mada, HIGH); // turn the LED on (HIGH is the voltage level) 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)視器之后,會顯示出當前檢測到的電流值。
產(chǎn)品相關(guān)推薦
購買地址
周邊產(chǎn)品推薦
Arduino 旋轉(zhuǎn)角度傳感器
通用傳感器連接線 3P杜邦連接線