0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

能2公里无线遥控的2.4GHz遥控器

伊娃老师来了 来源:伊娃老师来了 作者:伊娃老师来了 2023-03-04 11:11 次阅读

cfe89e06-b841-11ed-a826-dac502259ad0.png

工具:

焊枪+焊锡

焊接夹具

螺丝刀

胶水

d038f2fc-b841-11ed-a826-dac502259ad0.png

d09823c6-b841-11ed-a826-dac502259ad0.png

遥控器(发射器):

1 xNRF24L01+PA+LNA2.4G发射接收通信模块

1 x24L01无线模块转接板

1 xArduinoNano板

1 x100nF100纳法电容

2 x双轴按键传感器

2 x2档摇臂开关

1 x7.4v460Mah锂电池

1 x330R电阻

1 x10K电位器

2 x15P2.54mm单排排针插座

1 x54mmX20mmPCB

1 x7-9V的电池或者1x6节五号电池盒跟电池

若干:PCB板、电线、螺丝

// 8 Channel Transmitter (No Trim) | 8 Kanal Verici (Trim Yok)// Input pin A5
  #include   #include   #include   const uint64_t pipeOut = 000322;         // NOTE: The same as in the receiver 000322 | Alıcı kodundaki adres ile aynı olmalı  RF24 radio(9, 10);                       // select CE,CSN pin | CE ve CSN pinlerin seçimi
  struct Signal {  byte throttle;  byte pitch;  byte roll;  byte yaw;  byte aux1;  byte aux2;  byte aux3;  byte aux4;
};  Signal data;  void ResetData(){  data.throttle = 0;  data.pitch = 127;  data.roll = 127;  data.yaw = 127;  data.aux1 = 0;                       // Signal lost position | Sinyal kesildiğindeki pozisyon  data.aux2 = 0;  data.aux3 = 0;  data.aux4 = 0;}  void setup(){                                       //Configure the NRF24 module  | NRF24 modül konfigürasyonu  radio.begin();  radio.openWritingPipe(pipeOut);  radio.setAutoAck(false);  radio.setDataRate(RF24_250KBPS);    // The lowest data rate value for more stable communication  | Daha kararlı iletişim için en düşük veri hızı.  radio.setPALevel(RF24_PA_MAX);      // Output power is set for maximum |  Çıkış gücü maksimum için ayarlanıyor.  radio.stopListening();              // Start the radio comunication for Transmitter | Verici için sinyal iletişimini başlatır.  ResetData();
}                                      // Joystick center and its borders | Joystick merkez ve sınırları  int Border_Map(int val, int lower, int middle, int upper, bool reverse){  val = constrain(val, lower, upper);  if ( val < middle )  val = map(val, lower, middle, 0, 128);  else  val = map(val, middle, upper, 128, 255);  return ( reverse ? 255 - val : val );}  void loop(){                                     // Control Stick Calibration for channels  |  Her bir kanal için kumanda Kol Kalibrasyonları
  data.roll = Border_Map( analogRead(A3), 0, 512, 1023, true );        // "true" or "false" for signal direction | "true" veya "false" sinyal yönünü belirler  data.pitch = Border_Map( analogRead(A2), 0, 512, 1023, true );  data.throttle = Border_Map( analogRead(A1),570, 800, 1023, false );  // For Single side ESC | Tek yönlü ESC için  // data.throttle = Border_Map( analogRead(A1),0, 512, 1023, false ); // For Bidirectional ESC | Çift yönlü ESC için  data.yaw = Border_Map( analogRead(A0), 0, 512, 1023, true );  data.aux1 = Border_Map( analogRead(A4), 0, 512, 1023, true );        // "true" or "false" for change signal direction | "true" veya "false" sinyal yönünü değiştirir.  data.aux2 = Border_Map( analogRead(A5), 0, 512, 1023, true );        // "true" or "false" for change signal direction | "true" veya "false" sinyal yönünü değiştirir.  data.aux3 = digitalRead(7);  data.aux4 = digitalRead(8);
  radio.write(&data, sizeof(Signal));} 

d0c043ec-b841-11ed-a826-dac502259ad0.png

// 8 Channel Transmitter & Trims | 8 Kanal Verici ve Trimler
  #include   #include   #include   #include 
  const uint64_t pipeOut = 000322;        // NOTE: The same as in the receiver 000322 | Alıcı kodundaki adres ile aynı olmalı  RF24 radio(9, 10);                      // Select CE,CSN pin | CE ve CSN pinlerin seçimi
 #define trimbut_1 1                      // Trim button 1 / Pin D1 #define trimbut_2 2                      // Trim button 2 / Pin D2 #define trimbut_3 3                      // Trim button 3 / Pin D3 #define trimbut_4 4                      // Trim button 4 / Pin D4 #define trimbut_5 5                      // Trim button 5 / Pin D5 #define trimbut_6 6                      // Trim button 6 / Pin D6
 int tvalue1 = EEPROM.read(1) * 4;        // Reading trim values from Eprom  |  Trim değerlerinin Epromdan okunması int tvalue2 = EEPROM.read(3) * 4; int tvalue3 = EEPROM.read(5) * 4;
  struct Signal {  byte throttle;  byte pitch;  byte roll;  byte yaw;  byte aux1;  byte aux2;  byte aux3;  byte aux4;};
  Signal data;  void ResetData(){  data.throttle = 512;                      // Signal lost position | Sinyal kesildiğindeki pozisyon  data.pitch = 127;  data.roll = 127;  data.yaw = 127;  data.aux1 = 0;  data.aux2 = 0;  data.aux3 = 0;  data.aux4 = 0;}  void setup(){                                         // Configure the NRF24 module  | NRF24 modül konfigürasyonu  radio.begin();  radio.openWritingPipe(pipeOut);  radio.setAutoAck(false);  radio.setDataRate(RF24_250KBPS);       // The lowest data rate value for more stable communication  | Daha kararlı iletişim için en düşük veri hızı.  radio.setPALevel(RF24_PA_MAX);         // Output power is set for maximum |  Çıkış gücü maksimum için ayarlanıyor.  radio.stopListening();                 // Start the radio comunication for Transmitter | Verici için sinyal iletişimini başlatır.  ResetData();
  pinMode(trimbut_1, INPUT_PULLUP);  pinMode(trimbut_2, INPUT_PULLUP);  pinMode(trimbut_3, INPUT_PULLUP);  pinMode(trimbut_4, INPUT_PULLUP);  pinMode(trimbut_5, INPUT_PULLUP);  pinMode(trimbut_6, INPUT_PULLUP);
  tvalue1= EEPROM.read(1) * 4;  tvalue2= EEPROM.read(3) * 4;  tvalue3= EEPROM.read(5) * 4;}
// Joystick center and its borders | Joystick merkez ve sınırları  int Border_Map(int val, int lower, int middle, int upper, bool reverse){  val = constrain(val, lower, upper);  if ( val < middle )  val = map(val, lower, middle, 0, 128);  else  val = map(val, middle, upper, 128, 255);  return ( reverse ? 255 - val : val );}  void loop(){
// Trims and Limiting trim values  |  Trimler ve Trim değerlerini sınırlandırma
  if(digitalRead(trimbut_1)==LOW and tvalue1 < 630) {    tvalue1=tvalue1+15;    EEPROM.write(1,tvalue1/4);    delay (130);  }  if(digitalRead(trimbut_2)==LOW and tvalue1 > 280){    tvalue1=tvalue1-15;    EEPROM.write(1,tvalue1/4);    delay (130);  }
  if(digitalRead(trimbut_3)==LOW and tvalue2 < 630) {    tvalue2=tvalue2+15;    EEPROM.write(3,tvalue2/4);    delay (130);  }  if(digitalRead(trimbut_4)==LOW and tvalue2 > 280){    tvalue2=tvalue2-15;    EEPROM.write(3,tvalue2/4);    delay (130);  }
    if(digitalRead(trimbut_5)==LOW and tvalue3 < 630) {     tvalue3=tvalue3+15;     EEPROM.write(5,tvalue3/4);     delay (130);  }  if(digitalRead(trimbut_6)==LOW and tvalue3 > 280){    tvalue3=tvalue3-15;    EEPROM.write(5,tvalue3/4);    delay (130);  }
// Control Stick Calibration for channels  |  Her bir kanal için kumanda Kol Kalibrasyonları
  data.roll = Border_Map( analogRead(A3), 0, tvalue1, 1023, true );       // "true" or "false" for signal direction | "true" veya "false" sinyal yönünü belirler  data.pitch = Border_Map( analogRead(A2), 0, tvalue2, 1023, true );  data.throttle = Border_Map( analogRead(A1),570, 800, 1023, false );    // For Single side ESC | Tek yönlü ESC için  // data.throttle = Border_Map( analogRead(A1),0, 512, 1023, false );   // For Bidirectional ESC | Çift yönlü ESC için  data.yaw = Border_Map( analogRead(A0), 0, tvalue3, 1023, true );  data.aux1 = Border_Map( analogRead(A4), 0, 512, 1023, true );  data.aux2 = Border_Map( analogRead(A5), 0, 512, 1023, true );  data.aux3 = digitalRead(7);  data.aux4 = digitalRead(8);  radio.write(&data, sizeof(Signal));} 

控制电机(接收器):

1xNRF24L01+PA+LNA2.4G发射接收通信模块

1x24L01无线模块转接板

1xArduinoNano板

1x100nF100纳法电容

2x15P2.54mm单排排针插座

3x8P单排排针

1x54mmX20mmPCB板

1x7-9V的锂电池

1x无刷电机+电子调速器(测试用,也可换舵机)

6x轻触开关

若干:PCB板、电线

d111e3a0-b841-11ed-a826-dac502259ad0.png

//  8 Channel Receiver | 8 Kanal Alıcı
#include #include #include #include 
int ch_width_1 = 0;int ch_width_2 = 0;int ch_width_3 = 0;int ch_width_4 = 0;int ch_width_5 = 0;int ch_width_6 = 0;int ch_width_7 = 0;int ch_width_8 = 0;
Servo ch1;Servo ch2;Servo ch3;Servo ch4;Servo ch5;Servo ch6;Servo ch7;Servo ch8;
struct Signal {
byte throttle;byte pitch;byte roll;byte yaw;byte aux1;byte aux2;byte aux3;byte aux4;};
Signal data;
const uint64_t pipeIn = 000322;RF24 radio(9, 10);
void ResetData(){
data.throttle = 0;data.roll = 127;data.pitch = 127;data.yaw = 127;data.aux1 = 0;                                              // Define the inicial value of each data input. | Veri girişlerinin başlangıç değerleridata.aux2 = 0;data.aux3 = 0;data.aux4 = 0;}
void setup(){                                                           // Set the pins for each PWM signal | Her bir PWM sinyal için pinler belirleniyor.  ch1.attach(0);  ch2.attach(2);  ch3.attach(3);  ch4.attach(4);  ch5.attach(5);  ch6.attach(6);  ch7.attach(7);  ch8.attach(8);
  ResetData();                                             // Configure the NRF24 module  | NRF24 Modül konfigürasyonu  radio.begin();  radio.openReadingPipe(1,pipeIn);  radio.setAutoAck(false);  radio.setDataRate(RF24_250KBPS);                          // The lowest data rate value for more stable communication  | Daha kararlı iletişim için en düşük veri hızı.  radio.setPALevel(RF24_PA_MAX);                            // Output power is set for maximum |  Çıkış gücü maksimum için ayarlanıyor.  radio.startListening();                                   // Start the radio comunication for receiver | Alıcı için sinyal iletişimini başlatır.
}
unsigned long lastRecvTime = 0;
void recvData(){while ( radio.available() ) {radio.read(&data, sizeof(Signal));lastRecvTime = millis();                                    // Receive the data | Data alınıyor}}
void loop(){recvData();unsigned long now = millis();if ( now - lastRecvTime > 1000 ) {ResetData();                                                // Signal lost.. Reset data | Sinyal kayıpsa data resetleniyor}
ch_width_1 = map(data.roll, 0, 255, 1000, 2000);ch_width_2 = map(data.pitch, 0, 255, 1000, 2000);ch_width_3 = map(data.throttle, 0, 255, 1000, 2000);ch_width_4 = map(data.yaw, 0, 255, 1000, 2000);ch_width_5 = map(data.aux1, 0, 255, 1000, 2000);ch_width_6 = map(data.aux2, 0, 255, 1000, 2000);ch_width_7 = map(data.aux3, 0, 1, 1000, 2000);ch_width_8 = map(data.aux4, 0, 1, 1000, 2000);

ch1.writeMicroseconds(ch_width_1);                          // Write the PWM signal | PWM sinyaller çıkışlara gönderiliyorch2.writeMicroseconds(ch_width_2);ch3.writeMicroseconds(ch_width_3);ch4.writeMicroseconds(ch_width_4);ch5.writeMicroseconds(ch_width_5);ch6.writeMicroseconds(ch_width_6);ch7.writeMicroseconds(ch_width_7);ch8.writeMicroseconds(ch_width_8);

} 

d13ffcae-b841-11ed-a826-dac502259ad0.png

d177f618-b841-11ed-a826-dac502259ad0.png

9V稳压器:

1 x7809三级稳压管

1 x1uF微法电容

1 x10uF微法电容

2 x100nf纳法电容

若干:PCB板、电线

d1abe108-b841-11ed-a826-dac502259ad0.png

5V稳压器:

1 x7805三级稳压管

1 x1uF微法电容

1 x10uF微法电容

2 x100nf纳法电容

若干:PCB板、电线

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • 遥控器
    +关注

    关注

    18

    文章

    837

    浏览量

    66156
  • DIY
    DIY
    +关注

    关注

    176

    文章

    888

    浏览量

    348651
  • nRF24L01
    +关注

    关注

    17

    文章

    330

    浏览量

    69481
  • 2.4GHz
    +关注

    关注

    0

    文章

    45

    浏览量

    17893
  • Arduino
    +关注

    关注

    188

    文章

    6470

    浏览量

    187137
收藏 人收藏

    评论

    相关推荐

    nRFready™2.4GHz 射频智能遥控器参考设计

    外围设备,这种无线和协议的组合提供带宽,延迟和共存性能,无缝支持所有nRFready™射频智能遥控器的先进功能,即使在最具挑战性的2.4GHz的操作环境(例如,附近有其它的Wi - Fi和蓝牙
    发表于 03-24 10:09

    nRFready™2.4GHz 射频智能遥控器参考设计

    外围设备,这种无线和协议的组合提供带宽,延迟和共存性能,无缝支持所有nRFready™射频智能遥控器的先进功能,即使在最具挑战性的2.4GHz的操作环境(例如,附近有其它的Wi - Fi和蓝牙
    发表于 03-24 12:53

    2.4GHz 无线VISTA遥控器实验开发系统

    attach://167141.pdfattach://167141.pdf为了便于用户开发应用先进的Nordic Flash SOC无线芯片,迅通科技提供2.4GHz 无线VISTA遥控器
    发表于 11-04 09:31

    基于STM32的开源微型四轴飞行之传感航模遥控器

    航模遥控器常见的无线遥控按照使用技术不同,主要有红外遥控2.4G遥控。红外
    发表于 04-10 17:22

    2.4GHz无线射频芯片A7105应用

    2.4GHz无线射频芯片A7105应用...本文进行了室内照明系统的无线遥控研究,采用2.4GHz无线
    发表于 02-29 16:55

    遥控器设置方法_万遥控器代码

    电视是每个家庭必不可少的家用电器,所以我们在使用遥控器的时间也会比较多。但如果遥控器换了怎么办,很多人都会想到配一个万遥控器,那么万
    发表于 09-14 18:08 18.8w次阅读
    万<b class='flag-5'>能</b><b class='flag-5'>遥控器</b>设置方法_万<b class='flag-5'>能</b><b class='flag-5'>遥控器</b>代码

    一文弄懂无线遥控器

    相信大家对于无线遥控器都有着自己的认知,认为无线遥控器就是我们家用的电视啊、空调啊的遥控器吗?是的,这些当然是
    发表于 11-14 09:18 9147次阅读

    2.4G遥控器解决方案

    日常生活当中我们常用的遥控器就是无线红外遥控器,这种遥控器成本低,实用性也强,不好的地方就是不能随便转换角度遥控,也不能遮挡。但
    的头像 发表于 12-01 16:45 4652次阅读

    2.4G遥控器方案开发,无需指向也可以进行遥控

    相比于传统的红外线式遥控器无线2.4g遥控器摆脱了指向性的问题,我们可以在屋内任何位置以及任何角度来使用遥控器操作设备而不用担心设备无法接
    的头像 发表于 12-08 13:03 2312次阅读
    <b class='flag-5'>2.4</b>G<b class='flag-5'>遥控器</b>方案开发,无需指向也可以进行<b class='flag-5'>遥控</b>

    无线遥控器的工作原理

    我们运用无线遥控器的时候,我们最好让无线遥控器和我们安装的接收直接距离不必太远,大约10米以内,并且我们要把要
    的头像 发表于 06-01 16:24 1530次阅读

    宇凡微2.4G遥控器方案开发,灵活控制无需指向

    日常生活当中我们常用的遥控器就是无线红外遥控器,这种遥控器成本低,实用性也强,不好的地方就是不能随便转换角度遥控,也不能遮挡。但
    的头像 发表于 08-01 11:28 893次阅读

    一种使用2.4GHz频段的无线遥控器方案开发

    2.4G遥控器是一种使用2.4GHz频段的无线遥控器,常用于遥控玩具、航模和家电等电子设备上。
    的头像 发表于 01-11 17:22 1406次阅读

    2.4G无线遥控器方案开发,稳定性强,可用于多种应用

    2.4G遥控器是一种使用2.4GHz频段的无线遥控器,常用于遥控玩具、航模和家电等电子设备上。相
    的头像 发表于 01-18 15:44 2464次阅读

    应用在机顶盒遥控器中的2.4GHz无线芯片

    机顶盒遥控器是用于控制机顶盒,进而控制电视机的遥控器。以机顶盒遥控器为例,其遥控器按钮由前后两部分组成,前一部分按钮是用来代替电视机遥控器
    的头像 发表于 02-29 09:48 888次阅读
    应用在机顶盒<b class='flag-5'>遥控器</b>中的<b class='flag-5'>2.4GHz</b><b class='flag-5'>无线</b>芯片

    2.4GHz ISM射频前端芯片GC1103在无线遥控玩具中的应用

    2.4GHz ISM射频前端芯片GC1103在无线遥控玩具中的应用
    的头像 发表于 05-23 09:54 606次阅读
    <b class='flag-5'>2.4GHz</b> ISM射频前端芯片GC1103在<b class='flag-5'>无线</b><b class='flag-5'>遥控</b>玩具中的应用