女人自慰AV免费观看内涵网,日韩国产剧情在线观看网址,神马电影网特片网,最新一级电影欧美,在线观看亚洲欧美日韩,黄色视频在线播放免费观看,ABO涨奶期羡澄,第一导航fulione,美女主播操b

0
  • 聊天消息
  • 系統消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發帖/加入社區
會員中心
創作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

怎樣用語音命令控制直流電機

454398 ? 來源:工程師吳畏 ? 2019-07-31 11:36 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

電路圖

建立連接如下:

ENA L298N到Arduino 11的引腳

L298N的ENB到Arduino的10號引腳

L298N的IN1到Arduino的9號引腳

L298N的IN2到Arduino的第8針

L298N的IN3到Arduino的第7針

L298N的IN4到Arduino的第6針

將正在使用的電池電源正極連接到L298N的12V連接器,電池到L298N的GND,以及L298N的GND到GND of Arduino

最后,連接L298N兩端的兩個電機

怎樣用語音命令控制直流電機

如何運行程序

首先,在Arduino IDE的帖子末尾復制并粘貼Arduino代碼并上傳代碼。

然后從Wekinator的示例頁面下載草圖。

下載MFCC的可執行文件(mel-frequency cepstral coefficient)。我有一個64位操作系統,所以我下載了“win64”。

下載后,將其解壓縮并運行“.exe”文件。它將如下所示。現在您需要一個麥克風來為Wekinator提供輸入。如果已連接外接麥克風,請確保在聲音設置中選擇了該麥克風。

您需要另一個草圖來獲取Wekinator的輸出。該草圖在本文末尾給出。將其粘貼到新的處理窗口并運行草圖。

打開Wekinator并進行如下圖所示的設置。將輸入設置為13,將輸出設置為1.將類型設置為“所有動態時間扭曲”,使用5種手勢類型,然后單擊“下一步”。

現在按住output_1前面的“+”按鈕并說“前進”。

然后按住output_2前面的“+”按鈕并說出“向后”。

然后按住output_3前面的“+”按鈕并說出“right”。

然后按住output_4前面的“+”按鈕并說“左”。

然后按住“ outpu前面的+“按鈕t_5并說“停止”。

然后,單擊“Train”,然后單擊“Run”。確保已上載Arduino代碼并且處理草圖正在后臺運行。現在電機應根據您的聲控命令移動。嘗試用你的聲音進行測試,并在需要時重復上述步驟進行重新訓練。

它是如何工作的?

總之,這個項目有三個部分:Wekinator,Processing和Arduino。使用機器學習,Wekinator正在告訴處理它正在收聽的語音是否是預先訓練好的語音命令。然后處理讀取該消息并將其傳遞給Arduino,然后Arduino決定是否順時針/逆時針轉動電機。 Wekinator和處理之間發生的所有通信都是通過OSC(開放式聲音控制)協議。處理和Arduino之間的通信是通過串口完成的。

Arduino代碼

#include //Including the library that will help us in receiving and sending the values from processing

ValueReceiver《1》 receiver; /*Creating the receiver that will receive only one value.

Put the number of values to synchronize in the brackets */

/* The below variable will be synchronized in the processing

and it should be same on both sides. */

int output;

//Motor Pins

int EN_A = 11;

int IN1 = 9;

int IN2 = 8;

int IN3 = 7;

int IN4 = 6;

int EN_B = 10;

void setup()

{

/* Starting the serial communication because we are communicating with the

Processing through serial. The baudrate should be same as on the processing side. */

Serial.begin(19200);

//Initializing the motor pins as output

pinMode(EN_A, OUTPUT);

pinMode(IN1, OUTPUT);

pinMode(IN2, OUTPUT);

pinMode(IN3, OUTPUT);

pinMode(IN4, OUTPUT);

pinMode(EN_B, OUTPUT);

digitalWrite(EN_A, HIGH);

digitalWrite(EN_B, HIGH);

// Synchronizing the variable with the processing. The variable must be int type.

receiver.observe(output);

}

void loop()

{

// Receiving the output from the processing.

receiver.sync();

// Matching the received output to light up led‘s

if (output == 1)

{

//Forward

digitalWrite(IN1, LOW);

digitalWrite(IN2, HIGH);

digitalWrite(IN3, LOW);

digitalWrite(IN4, HIGH);

}

else if (output == 2)

{

//Backward

digitalWrite(IN1, HIGH);

digitalWrite(IN2, LOW);

digitalWrite(IN3, HIGH);

digitalWrite(IN4, HIGH);

}

else if (output == 3)

{

//Right

digitalWrite(IN1, LOW);

digitalWrite(IN2, HIGH);

digitalWrite(IN3, LOW);

digitalWrite(IN4, LOW);

}

else if (output == 4)

{

//Left

digitalWrite(IN1, LOW);

digitalWrite(IN2, LOW);

digitalWrite(IN3, HIGH);

digitalWrite(IN4, LOW);

}

else if (output == 5)

{

//Stop

digitalWrite(IN1, LOW);

digitalWrite(IN2, LOW);

digitalWrite(IN3, LOW);

digitalWrite(IN4, LOW);

}

}

處理代碼

import vsync.*; // Importing the library that will help us in sending and receiving the values from the Arduino

import processing.serial.*; // Importing the serial library

// Below libraries will connect and send, receive the values from wekinator

import oscP5.*;

import netP5.*;

// Creating the instances

OscP5 oscP5;

NetAddress dest;

ValueSender sender;

// This variable will be syncronized with the Arduino and it should be same on the Arduino side.

public int output;

void setup()

{

// Starting the serial communication, the baudrate and the com port should be same as on the Arduino side.

Serial serial = new Serial(this, “COM10”, 19200);

sender = new ValueSender(this, serial);

// Synchronizing the variable as on the Arduino side.

sender.observe(“output”);

// Starting the communication with wekinator. listen on port 12000, return messages on port 6448

oscP5 = new OscP5(this, 12000);

dest = new NetAddress(“127.0.0.1”, 6448);

}

//This is called automatically when OSC message is received

void oscEvent(OscMessage theOscMessage) {

if (theOscMessage.checkAddrPattern(“/output_1”)==true)

{

output = 1;

}

else if (theOscMessage.checkAddrPattern(“/output_2”)==true)

{

output = 2;

}

else if (theOscMessage.checkAddrPattern(“/output_3”) == true)

{

output = 3;

}

else if (theOscMessage.checkAddrPattern(“/output_4”) == true)

{

output = 4;

}

else if (theOscMessage.checkAddrPattern(“/output_5”) == true)

{

output = 5;

}

else

{

}

}

void draw()

{

// Nothing to be drawn for this example

}

聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。 舉報投訴
  • 直流電機
    +關注

    關注

    36

    文章

    1733

    瀏覽量

    71768
  • 語音控制
    +關注

    關注

    5

    文章

    497

    瀏覽量

    28786
收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關推薦
    熱點推薦

    電機:無刷直流電機的原理

    運動的原理都是依靠磁場,要么利用磁場的異性相吸,要么利用磁場的同性互斥。無刷直流電機和有刷直流電機的主要區別在于,無刷電機電流的大小和方向是通過控制器來改變的。通常,定
    的頭像 發表于 05-23 21:00 ?2083次閱讀
    <b class='flag-5'>電機</b>:無刷<b class='flag-5'>直流電機</b>的原理

    永磁直流電機實用設計及應用技術

    電氣和自動化控制及儀器儀表中。在醫用方面,永磁直流電機用處更不小,如醫用的各種儀器、 手術工具,如開腦術中的電動鋸骨刀,特別是野外手術中的各種儀器基本上都是用的永磁直流電機。在殘疾人用品方面,如機械手
    發表于 03-31 15:42

    直流電機控制方法的Matlab仿真研究

    針對無刷直流電機控制方法進行了深入研究 。根據無刷直流電機實際物理模型建立相應的數學模型,電機使用雙閉環進行控制 。根據
    發表于 03-27 12:15

    直流電機

    直流電機(direct current machine)是指能將直流電能轉換成機械能(直流電動機)或將機械能轉換成直流電能(直流發電機)的旋
    發表于 02-27 01:06

    如何使用MOS管進行直流電機控制

    在現代電子技術中,直流電機因其高效、可控和可靠的特性而被廣泛應用于各種工業和消費產品中。MOS管因其高速開關特性和低導通電阻成為控制直流電機的理想選擇。 MOS管的工作原理 MOS管是一種電壓
    的頭像 發表于 11-05 13:51 ?2336次閱讀

    無刷直流電機是什么?它有什么特點?

    無刷直流電機(Brushless DC Motor,簡稱BLDC)是一種沒有電刷和換向器的電機,它通過電子方式實現換向。這種電機在許多應用中非常受歡迎,因為它具有高效率、高可靠性、低維護成本和長壽命
    的頭像 發表于 10-23 10:48 ?2369次閱讀

    有刷直流電機是什么?有刷直流電機的工作原理是什么?

    有刷直流電機是一種常見的直流電機,它通過電刷和換向器來實現電流方向的改變,從而驅動電機旋轉。有刷直流電機具有結構簡單、成本較低、控制方便等優
    的頭像 發表于 10-22 16:03 ?2393次閱讀

    直流電機的應用原理及控制原理是什么?

    直流電機(Direct Current Motor,簡稱DC Motor)是一種將直流電能轉換為機械能的電機。它廣泛應用于各種工業和民用設備中,如電動車輛、機床、起重機、電梯、家用電器等。 一
    的頭像 發表于 10-22 14:23 ?1368次閱讀

    直流電機有哪些型號?如何分類的?

    直流電機是一種將直流電能轉換為機械能的電機,廣泛應用于各種工業、交通和家用電器等領域。直流電機的型號和分類方式多樣,可以根據不同的標準進行分類。以下是對
    的頭像 發表于 10-22 14:20 ?2612次閱讀

    直流電機主要種類有哪些?直流電機的勵磁方式有哪些?

    直流電機是一種將直流電能轉換為機械能的電機,廣泛應用于各種工業和民用領域。根據其結構和用途,直流電機可以分為以下幾種主要類型: 永磁直流電機
    的頭像 發表于 10-22 14:16 ?1769次閱讀

    直流電機是什么?具有什么特點?

    直流電機是一種利用直流電能來驅動的電機,其主要特點是具有較高的啟動轉矩、良好的調速性能和較高的效率。直流電機廣泛應用于各種工業、交通、航空、航天等領域。 一、
    的頭像 發表于 10-22 14:10 ?2172次閱讀

    直流電機是什么 直流電機介紹及其工作原理

    直流電機(Direct Current Machine)是一種能夠實現直流電能與機械能互相轉換的旋轉電機。根據應用場景的不同,直流電機既可以作為直流
    的頭像 發表于 10-18 15:09 ?3214次閱讀

    直流電機的轉速與線圈的關系

    直流電機的轉速與線圈的關系是一個復雜而深入的話題,涉及到電機的工作原理、構造、控制方式等多個方面。 直流電機的基本原理 直流電機是一種將
    的頭像 發表于 09-06 16:47 ?2721次閱讀

    直流電機調速器的工作原理和結構

    直流電機調速器是調節直流電動機速度的關鍵設備,其工作原理和結構對于理解直流電機的運行和控制至關重要。以下是對直流電機調速器工作原理和結構的詳
    的頭像 發表于 08-26 11:32 ?4352次閱讀

    直流電機的主磁極由什么組成

    直流電機是一種將直流電能轉換為機械能的設備,廣泛應用于工業、交通、航空、航天等領域。直流電機的工作原理是利用電磁感應原理,將電能轉換為機械能。直流電機主要由定子、轉子、換向器、電刷等部
    的頭像 發表于 08-26 10:28 ?1847次閱讀