Arduino和HC-12远程无线通信模块

在这个Arduino教程中,我们将学习如何使用能够在多个Arduino板之间进行长距离无线通信的HC-12无线串行通信模块,距离高达1.8km。您可以观看以下视频或阅读下面的书面教程以获取更多详细信息。

概述


在本教程中,我做了两个基本的示例,解释了如何连接HC-12模块并在两个Arduino之间进行基本通信,以及一个额外的示例,其中在第一个Arduino上使用加速计传感器,我可以无线控制第二个Arduino上步进器的位置。

HC-12无线串行通信模块

HC-12无线通信模块


首先让我们仔细看看HC-12无线串口通信模块。以下是一些说明:

  • 其无线工作频段为433.4 MHz ~ 473.0 MHz
  • 它共有100个频道,每个频道之间的步进频率为400khz
  • 发射功率从-1dBm (0.79mW)到20dBm (100mW)
  • 接收灵敏度从-117dBm (0.019pW)到-100dBm (10pW)。

这些值实际上取决于所选的串行和无线波特率,如表中所示。

HC-12无线模块接收灵敏度

HC-12模块有一个微控制器,它实际上不必由用户编程。为了配置模块,我们简单地使用AT命令,这些命令可以通过Arduino、PC或使用串口的任何其他微控制器发送。为了进入AT命令模式,我们只需要将模块的“set”引脚设置为低逻辑级。

Arduino和HC-12


现在,让我们将HC-12模块连接到Arduino,并创建第一个示例。这是电路原理图。模块的工作电压在3.2 V ~ 5.5 V之间,为了更稳定的工作,建议使用去耦电容和外部电源。然而,我使用PC USB作为本教程中所有三个例子的电源,没有任何问题。

Arduino和HC-12电路原理图

我将第一个模块连接到Arduino UNO,第二个模块连接到Arduino MEGA,当然,你可以使用任何你想要的板。

你可以从下面的链接获得这个Arduino教程所需的组件:

必威外围提钱披露:这些是附属链接。作为一名亚马逊助理,我的收入来自符合条件的购买。

示例01 - Arduino代码


下面是第一个示例的Arduino代码,这是使用串行监视器的两个模块之间的基本通信。

/* Arduino Long Range Wireless Communication using HC-12 Example 01 by Dejan Nedelkovski, www.bet188官方网站HowToMechatronics.com */ #include h>软件串行HC12(10,11);// HC-12 TX引脚,HC-12 RX引脚void setup() {Serial.begin(9600);//串口到计算机HC12.begin(9600);//串口到HC12} void loop() {while (HC12.available()){//如果HC-12有数据serialwrite (HC12.read());//发送数据到串行监视器}while (Serial.available()){//如果串行监视器有数据HC12.write(Serial.read());//发送数据到HC-12}}

两个arduino使用相同的代码。我们可以在两台单独的电脑上连接两个Arduinos也可以使用一台电脑。

HC-12个人电脑

在这种情况下,一旦我们将第一个Arduino连接到计算机,我们需要选择模型和COM端口并将代码上传到Arduino。然后我们连接第二个arduino,我们必须再次启动Arduino IDE才能选择我们的第二个Arduino的其他COM端口,然后上传相同的代码。

因此,一旦我们运行了两个Arduino ide,我们就可以启动串行监视器并测试通信是否正常工作。我们在串行监视器上输入的任何东西都会从一个Arduino发送到另一个Arduino上。

HC-12 Arduino串口通信示例

代码如何工作:因此,一旦我们在串行监视器中输入一些内容并单击Send按钮,在第一个Arduino上,使用serial .available()函数的while循环将变为真,并使用HC12.write()函数将串行监视器中的数据发送到HC-12模块。该模块将数据无线传输到第二个HC-12模块,因此在第二个Arduino上,带有HC12.available()函数的while循环将变为真,并使用serial .write()函数将数据发送到串行监视器。

我们可以使用相同的代码发送AT命令和配置模块参数。我们所要做的就是将模块的“Set”引脚连接到地面或Arduino的任何数字引脚,并将引脚设置为低逻辑电平。

HC-12 AT命令集引脚

为了测试我们是否成功进入模式,我们可以在串行监视器中输入“AT”,我们应该会得到一个响应消息“OK”。一共有12个AT命令,用于改变波特率、信道、发射功率等各种参数。例如,如果我们输入“AT+B38400”,模块的波特率将被设置为38400。

在命令:

1.AT - Test命令。

示例:发送“AT”到模块,模块返回“OK”。

2.AT+Bxxxx -修改串口波特率。

支持的波特率:1200 bps、2400 bps、4800 bps、9600bps、19200bps、38400bps、57600bps、115200bps。默认值:9600个基点。

示例:发送“AT+B38400”到模块,模块返回“OK+B19200”。

3.AT+Cxxxx -改变无线通信通道,从001到100。

默认值:通道001,工作频率为433.4MHz。每个下一个频道都有400kHz。

示例:如果要将模块设置为006通道,需要向模块发送“AT+C006”命令,模块将返回“OK+C006”。新的工作频率将是435.4兆赫。

例02.


现在我们来看第二个例子。这里我们将使用两个按钮来选择不同的通信通道,并查看存储传入数据的不同方法。

例02 - HC-12通道选择

注意:两个HC-12模块的“Set”引脚都连接到两个Arduino的引脚6和第一个Arduino的两个按钮上的引脚4和3。

第一个Arduino代码:

/* Arduino Long Range Wireless Communication using HC-12 Example 02 - Changing channels using push buttons - buttons side by Dejan Nedelkovski, www.bet188官方网站HowToMechatronics.com */ #include  #define setPin 6 #define button1 4 #define button2 3 SoftwareSerial HC12(10,11);// HC-12 TX Pin, HC-12 RX Pin byte incomingByte;String readBuffer = "";int button1State = 0;int button1Pressed = 0;int button2State = 0;int button2Pressed = 0;void setup() {Serial.begin(9600);//打开计算机的串口HC12.begin(9600);//打开串口到HC12的pinMode(setPin, OUTPUT); pinMode(button1, INPUT); pinMode(button2, INPUT); digitalWrite(setPin, HIGH); // HC-12 normal, transparent mode } void loop() { // ==== Storing the incoming data into a String variable while (HC12.available()) { // If HC-12 has data incomingByte = HC12.read(); // Store each icoming byte from HC-12 readBuffer += char(incomingByte); // Add each byte to ReadBuffer string variable } delay(100); // ==== Sending data from one HC-12 to another via the Serial Monitor while (Serial.available()) { HC12.write(Serial.read()); } // ==== If button 1 is pressed, set the channel 01 button1State = digitalRead(button1); if (button1State == HIGH & button1Pressed == LOW) { button1Pressed = HIGH; delay(20); } if (button1Pressed == HIGH) { HC12.print("AT+C001"); // Send the AT Command to the other module delay(100); //Set AT Command Mode digitalWrite(setPin, LOW); // Set HC-12 into AT Command mode delay(100); // Wait for the HC-12 to enter AT Command mode HC12.print("AT+C001"); // Send AT Command to HC-12 delay(200); while (HC12.available()) { // If HC-12 has data (the AT Command response) Serial.write(HC12.read()); // Send the data to Serial monitor } Serial.println("Channel successfully changed"); digitalWrite(setPin, HIGH); // Exit AT Command mode button1Pressed = LOW; } // ==== If button 2 is pressed, set the channel 02 button2State = digitalRead(button2); if (button2State == HIGH & button2Pressed == LOW) { button2Pressed = HIGH; delay(100); } if (button2Pressed == HIGH) { HC12.print("AT+C002"); // Send the AT Command to the other module delay(100); //Set AT Command Mode digitalWrite(setPin, LOW); // Set HC-12 into AT Command mode delay(100); // Wait for the HC-12 to enter AT Command mode HC12.print("AT+C002"); // Send AT Command to HC-12 delay(200); while (HC12.available()) { // If HC-12 has data (the AT Command response) Serial.write(HC12.read()); // Send the data to Serial monitor } Serial.println("Channel successfully changed"); digitalWrite(setPin, HIGH); button2Pressed = LOW; } checkATCommand(); readBuffer = ""; // Clear readBuffer } // ==== Custom function - Check whether we have received an AT Command via the Serial Monitor void checkATCommand () { if (readBuffer.startsWith("AT")) { // Check whether the String starts with "AT" digitalWrite(setPin, LOW); // Set HC-12 into AT Command mode delay(200); // Wait for the HC-12 to enter AT Command mode HC12.print(readBuffer); // Send AT Command to HC-12 delay(200); while (HC12.available()) { // If HC-12 has data (the AT Command response) Serial.write(HC12.read()); // Send the data to Serial monitor } digitalWrite(setPin, HIGH); // Exit AT Command mode } }

第二个Arduino代码:

/* Arduino Long Range Wireless Communication using HC-12 Example 02 - Changing channels using push buttons by Dejan Nedelkovski, www.bet188官方网站HowToMechatronics.com */ #include  #define setPin 6 SoftwareSerial HC12(10,11);// HC-12 TX Pin, HC-12 RX Pin byte incomingByte;String readBuffer = "";void setup() {Serial.begin(9600);//打开计算机的串口HC12.begin(9600);//打开串口到HC12的pinMode(setPin, OUTPUT);digitalWrite (setPin、高);// HC-12正常模式}void loop(){// ====将传入的数据存储到一个字符串变量中,而(HC12.available()){//如果HC-12有数据incomingByte = HC12.read();//存储每个icoming字节从HC-12 readBuffer += char(incomingByte);//将每个字节添加到ReadBuffer字符串变量 // ==== Sending data from one HC-12 to another via the Serial Monitor while (Serial.available()) { HC12.write(Serial.read()); } // === If button 1 is pressed, set channel 01 if (readBuffer == "AT+C001") { digitalWrite(setPin, LOW); // Set HC-12 into AT Command mode delay(100); // Wait for the HC-12 to enter AT Command mode HC12.print(readBuffer); // Send AT Command to HC-12 ("AT+C001") delay(200); while (HC12.available()) { // If HC-12 has data (the AT Command response) Serial.write(HC12.read()); // Send the data to Serial monitor } Serial.println("Channel successfully changed"); digitalWrite(setPin, HIGH); // Exit AT Command mode readBuffer = ""; } // === If button 2 is pressed, set channel 02 if (readBuffer == "AT+C002") { digitalWrite(setPin, LOW); // Set HC-12 into AT Command mode delay(100); // Wait for the HC-12 to enter AT Command mode HC12.print(readBuffer); // Send AT Command to HC-12 delay(200); while (HC12.available()) { // If HC-12 has data (the AT Command response) Serial.write(HC12.read()); // Send the data to Serial monitor } Serial.println("Channel successfully changed"); digitalWrite(setPin, HIGH); // Exit AT Command mode readBuffer = ""; } checkATCommand(); readBuffer = ""; // Clear readBuffer } // ==== Custom function - Check whether we have received an AT Command via the Serial Monitor void checkATCommand () { if (readBuffer.startsWith("AT")) { // Check whether the String starts with "AT" digitalWrite(setPin, LOW); // Set HC-12 into AT Command mode delay(100); // Wait for the HC-12 to enter AT Command mode HC12.print(readBuffer); // Send AT Command to HC-12 delay(200); while (HC12.available()) { // If HC-12 has data (the AT Command response) Serial.write(HC12.read()); // Send the data to Serial monitor } digitalWrite(setPin, HIGH); // Exit AT Command mode } }

代码的描述:

因此,首先我们需要定义引脚,并将“set”引脚设置为高逻辑电平,以便模块在正常、透明模式下工作。在第一个while循环中,我们将传入的数据存储到一个字符串变量中,以便更好地处理它。

// ====当(HC12.available())时将传入的数据存储到一个字符串变量中{//如果HC-12有数据incomingByte = HC12.read();//存储每个icoming字节从HC-12 readBuffer += char(incomingByte);//添加每个字节到ReadBuffer字符串变量}

传入的数据一次始终出现一个字节,例如,如果我们从第二个arduino发送字符串“test123”,则循环将执行7次迭代。每次迭代,使用HC12.read()函数,我们将读取每个传入的字节或字符,并将其添加到名为“readbuffer”的字符串变量。

接下来让我们看看我们如何使用第一个按钮更改通信通道。因此,如果我们按下第一个按钮,请使用HC12.print()函数,我们将将字符串“AT + C001”发送给HC-12模块或第二个Arduino。

if (button1Pressed == HIGH) {HC12.print("AT+C001");//发送AT命令到另一个模块delay(100);//设置在命令模式digitalWrite(setPin, LOW);//设置HC-12为AT命令模式延迟(100);//等待HC-12进入AT命令模式HC12.print("AT+C001");// Send AT Command to HC-12 delay(200);while (HC12.available()){//如果HC-12有数据(AT命令响应)serialwrite (HC12.read());//发送数据到串行监视器}串行。println(“频道成功改变”);digitalWrite (setPin、高);//在命令模式下退出button1Pressed = LOW; }

当此字符串将在第二个Arduino接收时,我们将在命令模式下将HC-12模块设置为,然后将相同的字符串“AT + C001”写入它,该字符串将将模块设置为通信通道编号第一。

//第二个Arduino // ===如果按钮1被按下,设置通道01 If (readBuffer == " At +C001") {digitalWrite(setPin, LOW);//设置HC-12为AT命令模式延迟(100);//等待HC-12进入命令模式HC12.print(readBuffer);// Send AT Command to HC-12 ("AT+C001") delay(200);while (HC12.available()){//如果HC-12有数据(AT命令响应)serialwrite (HC12.read());//发送数据到串行监视器}串行。println(“频道成功改变”);digitalWrite (setPin、高);//在命令模式下退出readBuffer = "";}

我们使用下一个while循环打印来自HC-12模块的响应消息,以确定通道是否已成功更改。

while (HC12.available()){//如果HC-12有数据(AT命令响应)serialwrite (HC12.read());//发送数据到串行监视器}

回到第一个Arduino,我们执行同样的过程,将at命令发送到第一个HC-12模块。以同样的方式,我们使用按下第二个按钮,我们设置通信信道号码2。所以使用这种方法,我们可以选择,在任何时候,我们将与哪个HC-12模块通信。

最后,自定义函数checkATCommand()通过检查字符串是否以“At”开头来检查接收到的消息是否为At命令。如果是,模块进入AT命令模式并执行命令。

// ====自定义函数-检查我们是否通过串行监视器接收到一个AT命令void checkATCommand () {if (readBuffer.startsWith("AT")){//检查字符串是否以"AT"开头digitalWrite(setPin, LOW);//设置HC-12为AT命令模式延迟(200);//等待HC-12进入命令模式HC12.print(readBuffer);// Send AT Command to HC-12 delay(200);while (HC12.available()){//如果HC-12有数据(AT命令响应)serialwrite (HC12.read());//发送数据到串行监视器}digitalWrite(setPin, HIGH);//退出命令模式}}

HC-12无线通信:使用加速计控制步进电机

现在让我们看一下第三个例子。这里我们在第二个Arduino上控制步进电机的位置,使用第一个Arduino上的加速度计模块。

HC-12无线通信使用加速计控制步进电机-示例03

该电路还包含一个微动开关,用于寻找步进电机在0度的初始位置。

HC-12无线通信用加速计控制步进电机的电路原理图

你可以从下面的链接中获得这个例子所需要的组件:

必威外围提钱披露:这些是附属链接。作为一名亚马逊助理,我的收入来自符合条件的购买。

注意,我已经有关于如何连接和使用两者的详细教程加速度计步进电机,因此对于此示例,我只会解释代码的HC-12部分。

第一个Arduino -发射器代码:

/ * Arduino Long ression使用加速度计的步进电机控制 - 发射器,Accelerometer由Dejan Nedelkovski,www.www.mfxpo.com * / #include  #include  softwareserial bet188官方网站hc12(10,11);// HC-12 TX引脚,HC-12 RX引脚浮角角;int lastAngle = 0;int count = 0;int anglensum = 0;// ---加速度计寄存器地址#define power_register 0x2d #define x_axis_register_datax0 0x32 // datax0内部寄存器的hexadecima地址。#define x_axis_register_datax1 0x33 // Datax1内部寄存器的HexadeCima地址。#define y_axis_register_datay0 0x34 #define y_axis_register_datay1 0x35 #define z_axis_register_dataz0 0x36 #dataz0 0x36 #define z_axis_register_dataz1 0x37 int adxaddress = 0x53;//设备地址,其中还包括用于选择模式的第8位,在这种情况下读取。int x0,x1,x_out; int Y0, Y1, Y_out; int Z1, Z0, Z_out; float Xa, Ya, Za; void setup() { HC12.begin(9600); // Open serial port to HC12 Wire.begin(); // Initiate the Wire library Serial.begin(9600); delay(100); Wire.beginTransmission(ADXAddress); Wire.write(Power_Register); // Power_CTL Register // Enable measurement Wire.write(8); // Bit D3 High for measuring enable (0000 1000) Wire.endTransmission(); } void loop() { // X-axis Wire.beginTransmission(ADXAddress); // Begin transmission to the Sensor //Ask the particular registers for data Wire.write(X_Axis_Register_DATAX0); Wire.write(X_Axis_Register_DATAX1); Wire.endTransmission(); // Ends the transmission and transmits the data from the two registers Wire.requestFrom(ADXAddress, 2); // Request the transmitted two bytes from the two registers if (Wire.available() <= 2) { // X0 = Wire.read(); // Reads the data from the register X1 = Wire.read(); /* Converting the raw data of the X-Axis into X-Axis Acceleration - The output data is Two's complement - X0 as the least significant byte - X1 as the most significant byte */ X1 = X1 << 8; X_out = X0 + X1; Xa = X_out / 256.0; // Xa = output value from -1 to +1, Gravity acceleration acting on the X-Axis } //Serial.print("Xa= "); //Serial.println(X_out); // Y-Axis Wire.beginTransmission(ADXAddress); Wire.write(Y_Axis_Register_DATAY0); Wire.write(Y_Axis_Register_DATAY1); Wire.endTransmission(); Wire.requestFrom(ADXAddress, 2); if (Wire.available() <= 2) { Y0 = Wire.read(); Y1 = Wire.read(); Y1 = Y1 << 8; Y_out = Y0 + Y1; Ya = Y_out / 256.0; } // Combine X and Y values for getting the angle value from 0 to 180 degrees if (Y_out > 0) { angle = map(Y_out, 0, 256, 90, 0); } else if (Y_out < 0) { angle = map(Y_out, 256, 0, 90, 0); angle = 90 - angle; } if (X_out < 0 & Y_out < 0) { angle = 180; } if (X_out < 0 & Y_out >0) { angle = 0; } // float to int int angleInt = int(angle); // Makes 100 accelerometer readings and sends the average for smoother result angleSum = angleSum + angleInt; count++; if (count >= 100) { angleInt = angleSum / 100; angleSum = 0; count = 0; // Some more smoothing of acceleromter reading - sends the new angle only if it differes from the previous one by +-2 if (angleInt > lastAngle + 2 || angleInt < lastAngle - 2) { Serial.println(angleInt); String angleString = String(angleInt); //sends the angle value with start marker "s" and end marker "e" HC12.print("s" + angleString + "e"); delay(10); lastAngle = angleInt; angleSum = 0; count = 0; } } }

第二Arduino -接收器代码:

/* Arduino远程无线通信使用的c -12示例03 -步进电机控制使用加速度计-接收机,步进电机由Dejan Nedelkovski, www.HowToMechatronics.com */ #include 软件串行HC12(10,11);// HC-12 TX引脚,HC-12 RX引脚char incomingByte;String readBuffer = "";//定义引脚数const int dirPin = 4;const int stepPin = 3;const int button = 2;int currentAngle = 0;int lastAngle = 0;int rotate = 0;void setup() {Serial.begin(9600); // Open serial port to computer HC12.begin(9600); // Open serial port to HC12 // Sets the two pins as Outputs pinMode(dirPin, OUTPUT); pinMode(stepPin, OUTPUT); // Microswitch input, with internal pull-up resistor activated pinMode(button, INPUT_PULLUP); delay(10); digitalWrite(dirPin, HIGH); boolean startingPosition = true; while (startingPosition) { digitalWrite(stepPin, HIGH); delayMicroseconds(200); digitalWrite(stepPin, LOW); delayMicroseconds(200); if (digitalRead(button) == LOW) { startingPosition = false; } } delay(100); } void loop() { readBuffer = ""; boolean start = false; // Reads the incoming angle while (HC12.available()) { // If HC-12 has data incomingByte = HC12.read(); // Store each icoming byte from HC-12 delay(5); // Reads the data between the start "s" and end marker "e" if (start == true) { if (incomingByte != 'e') { readBuffer += char(incomingByte); // Add each byte to ReadBuffer string variable } else { start = false; } } // Checks whether the received message statrs with the start marker "s" else if ( incomingByte == 's') { start = true; // If true start reading the message } } // Converts the string into integer currentAngle = readBuffer.toInt(); // Makes sure it uses angles between 0 and 180 if (currentAngle > 0 && currentAngle < 180) { // Convert angle value to steps (depending on the selected step resolution) // A cycle = 200 steps, 180deg = 100 steps ; Resolution: Sixteenth step x16 currentAngle = map(currentAngle, 0, 180, 0, 1600); //Serial.println(currentAngle); // Prints the angle on the serial monitor digitalWrite(dirPin, LOW); // Enables the motor to move in a particular direction // Rotates the motor the amount of steps that differs from the previous positon if (currentAngle != lastAngle) { if (currentAngle > lastAngle) { rotate = currentAngle - lastAngle; for (int x = 0; x < rotate; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(400); digitalWrite(stepPin, LOW); delayMicroseconds(400); } } // rotate the other way if (currentAngle < lastAngle) { rotate = lastAngle - currentAngle; digitalWrite(dirPin, HIGH); //Changes the rotations direction for (int x = 0; x < rotate; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(400); digitalWrite(stepPin, LOW); delayMicroseconds(400); } } } lastAngle = currentAngle; // Remembers the current/ last positon } }

代码的描述:

首先我们在setup部分定义引脚并初始化模块。然后我们读取加速度计的X轴和Y轴的值,并将它们映射为0到180度的值。来自加速度计的值有时会不稳定或抖动,因此为了平滑结果,我使用了100个读数的平均值。

//生成100个加速度计读数,并发送平滑结果的平均值。数+ +;if (count >= 100) {angleInt = angleSum / 100;angleSum = 0;数= 0;//一些更平滑的加速计读取-发送新的角度,只有当它与前一个不同+-2 if (angleInt > lastAngle + 2 || angleInt < lastAngle -2) {serialprintln (angleInt);String angleString = String(angleInt);//通过启动标记“s”和结束标记“e”hc12.print(“s”+ Anglestring +“E”)发送角度值;延迟(10);lastAngle = angleInt; angleSum = 0; count = 0; } }

对于甚至进一步平滑,只有当它与先前2个不同时,才会发送角度的新值。

注意,当向HC-12模块发送角度时,我还在前面发送字符“s”,在后面发送字符“e”,这将在第二个Arduino接收数据时帮助我。

在第二个Arduino中,我们等待开始标记s的到来,然后读取角度值,直到结束标记e的到来。这样我们就可以确定我们只会收到角度的值。

//当(HC12.available())时读取传入角度{//如果HC-12有数据incomingByte = HC12.read();//存储每个icoming字节从HC-12 delay(5);//读取起始标记“s”和结束标记“e”之间的数据if (start == true) {if (incomingByte != 'e') {readBuffer += char(incomingByte);//将每个字节添加到ReadBuffer字符串变量}} //检查接收到的消息是否带有起始标记"s" else if (incomingByte == 's') {start = true;//如果真实开始阅读消息}}

然后我们将该值转换为整数,并将该值从0映射到1600步长,这对应于A4988步长驱动器中选定的16步长分辨率。然后我们将步进电机旋转到当前的角度。

这就是Arduino教程的内容。请在下面的评论部分提出任何问题。

14的反应

  1. Zeeshan

    先生您好,您能告诉我最大可以达到的范围吗?我可以从这个模块做一个遥控器来控制飞机吗

    回复
  2. 马克

    我认为这是一个了不起的项目,我想使用类似于远程控制电磁阀的东西。不过,我有两个问题:

    1.你提到了“去耦电容器”,但没有提到它的价值和方向。你能更详细地解释一下吗?

    2.其他人是否干扰了抓住了接受Arduino的控制的信号?基本上,篡改了担心吗?

    谢谢你的帮助。

    回复
    • 德扬Nedelkovski

      去耦电容提供稳定性并将电源平滑到模块。至于您可以使用0.1到10uf的任何值。负终端进入地面和持续的VCC。
      至于篡改,我没有太多信息,但我不相信这个便宜的模块可以提供高安全性。

      回复
  3. 斯宾塞

    你好,德扬,我在哪里可以买到HC-12模块?
    我已经扫描了网络…没有发现…!!
    他们阻止了吗?(这可能是一个安全风险…就像在南非…433 mHz跳码被…劫持…我知道我是一个受害者)..
    (联系我..我会告诉你我是怎么打败骗子!)..
    谢谢..!!

    回复
  4. 吉尔

    你能把arduino上的信息直接无线发送到笔记本电脑或个人电脑上吗?

    回复
    • 德扬

      是的,有可能,但你还是需要两个arduino。一个发送数据,另一个是接受数据,并通过串口将其交给PC机。

      回复
    • Dk

      是的,即使使用一个arduino也可以实现但你必须使用hc05 bt模块(它不会给出像hc12那样高的范围)

      回复
  5. 阿一

    亲爱的德扬,
    很好的教程,谢谢。我有一个问题,是否有可能控制两个直流电机和一个LED只有一个链接?我的意思是,我是否可以用这种方法远程控制两个直流电机的运动,并打开或关闭一个LED ?

    回复
    • 德扬

      嘿,谢谢!好吧,你应该能够做到这一点。您只需要向接收器发送适当的指示符和/或值。当然,代码或编程也取决于DC电动机的控制方法。

      回复
  6. 帕特里克

    哇,真是个不错的教程。
    不过我有一个问题,有没有办法可以控制我手机的板子?我的意思是我能通过Arduino hc-12来控制手机的直流电机吗?

    回复
  7. 安东尼

    你好,
    不错的教程!
    我试图做同样的项目,但我有一个问题的范围。
    连接损失10米。我们远远超过1.8公里的数据表。我试图改变参数,但它确实改变了任何东西。
    你的系统有什么范围?10米、100米、500米?
    你有什么建议可以帮助我吗?
    谢谢您的回答
    安东尼

    回复
    • 德扬

      嘿,谢谢!
      尝试使用外部5V电源,Arduino 5V可能不够你的模块。还要确保你使用了去耦电容器。

      回复

发表评论

您的电子邮件地址将不会被公布。

推荐

2019年最佳入门级示波器为初学者和爱好者

最好的示波器为初学者和爱好者

推荐

2019年初学者的8个最佳Arduino Starter Kits

8个最好的ARDUINO初学者工具包

推荐

最好的3D打印机为初学者和爱好者- 3D打印

最好的3D打印机为初学者和业余爱好者