查看(SKU:RB-02S088)電流檢測傳感器的源代碼
←
(SKU:RB-02S088)電流檢測傳感器
跳轉(zhuǎn)至:
導航
、
搜索
因為以下原因,你沒有權(quán)限編輯本頁:
您剛才請求的操作只有這個用戶組中的用戶才能使用:
用戶
您可以查看并復制此頁面的源代碼:
[[文件:dianliuchuanganqi002.jpg|500px|縮略圖|右]] ==產(chǎn)品概述== 此產(chǎn)品由一個電流感應器TA12-200組成構(gòu)成??梢詫⒋蟮碾娏髁哭D(zhuǎn)換為幅度小的電壓量輸出。該模塊采用沉金工藝,外觀更加美觀,同時采用防插反3Pin接口,操作更加安全,插口一邊有大寫字母A表示該模塊位模擬量傳感器,另一邊是電流表的圖標標志表示該模塊具有測試電流的功能。此產(chǎn)品可以應用于交流電的電流檢測,最大可檢測的電流為5A。 ==規(guī)格參數(shù)== # 工作電壓 :+5v # 最大檢測電流:5A # 檢測類型:交流電 # 尺寸大小:30mm x 25mm # 重量大?。?g # 信號類型:模擬信號 # 孔徑:4.96mm ==接口定義== * S:信號引腳 * NC:不需要連接 * -:電源地 ==使用方法== ===工作原理=== 電流傳感器是根據(jù)電磁感應原理設計的,本傳感器使用一個線圈,導線穿過線圈,當導線中產(chǎn)生交流電時,由于電磁感應的原因,模塊的線圈中會產(chǎn)生電流,從而使 Arduino 的模擬接口感測到,通過 Arduino 控制器自帶的 10 位 AD 轉(zhuǎn)換來讀取信號。 ===實驗硬件=== * 振動馬達 * 1個 * [http://gharee.com/goods-167.html 電位計模塊] * 1個 * 電流傳感器 * 1個 * [http://gharee.com/goods-546.html Carduino UNO 控制器] * 1個 * [http://gharee.com/goods-147.html 傳感器擴展板 V5.0] * 1個 * [http://gharee.com/goods-94.html 杜邦線] * 若干 ===接線示意圖=== [[文件:dianliuchuanganqi01.jpg|700px|縮略圖|居中|實物連接圖]] [[文件:02S08801.png|700px|縮略圖|居中|連接圖]] 引腳接線: {|border="1" cellspacing="0" align="center" cellpadding="5" width="400px" |- |align="center"|傳感器引腳 |align="center"|所接引腳 |- |align="center"|電位計模塊 + 引腳 |align="center"|穿過電流傳感器接在UNO的D13 S 引腳 |- |align="center"|電位計模塊 S 引腳 |align="center"|振動馬達 + 引腳 |- |align="center"|電位計模塊 - 引腳 |align="center"|懸空 |- |align="center"|電流傳感器 |align="center"|控制器 A0 引腳 |- |align="center"|振動馬達 + — 引腳 |align="center"|分別接在控制器Vcc和GND |} <br> 注:NC可以不接 ===例子程序=== <pre style='color:blue'> #define ELECTRICITY_SENSOR A0 int mada = 13; float amplitude_current; float effective_value; void setup() { Serial.begin(9600); pins_init(); pinMode(mada, OUTPUT); } void loop() { digitalWrite(mada, HIGH); 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) 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> ===程序效果=== 程序正常編譯上傳以后,打開 Arduino IDE 自帶的串口監(jiān)視器之后,會顯示出當前檢測到的電流值。 [[文件:02S08804.png|700px|有框|居中]] ==產(chǎn)品相關(guān)推薦== [[文件:erweima.png|230px|無框|右]] ===購買地址=== [https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-3667083713.10.RCxcrJ&id=521034929916 電流檢測傳感器] ===周邊產(chǎn)品推薦=== [http://gharee.com/goods-167.html Arduino 旋轉(zhuǎn)角度傳感器]<br/> [http://gharee.com/goods-196.html 通用傳感器連接線 3P杜邦連接線]<br/> ===相關(guān)問題解答=== ===相關(guān)學習資料=== [http://www.makerspace.cn/portal.php 奧松機器人技術(shù)論壇]
返回
(SKU:RB-02S088)電流檢測傳感器
。
來自“
http://gharee.com/wiki/index.php/(SKU:RB-02S088)電流檢測傳感器
”
導航菜單
個人工具
登錄
名字空間
頁面
討論
變換
查看
閱讀
查看源代碼
查看歷史
操作
搜索
導航
首頁
社區(qū)專頁
新聞動態(tài)
最近更改
隨機頁面
工具箱
鏈入頁面
相關(guān)更改
特殊頁面
頁面信息
隱私政策
關(guān)于ALSROBOT WiKi
免責聲明