0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ドローン用ESCについて

Posted at

概要

これは、プログラミングとほとんど無関係なので、消されるかも知れませんが、そのときは別のところに上げます
datasheetは"30A BLDC ESC - Optimus Digital"と検索すると、pdfがダウンロードできます

BEC

ESCには、モーター用電源から制御基板用の電源を作るBEC回路があります。
この基板だと、PWM入力の電源供給は必要ありません

突っかかったところ

サーボのようにPWM信号を送るだけでは動かない。
まず、始めにゼロとなるPWM信号の幅の信号を送る必要がある。つまり
ESC側の電源を入れる際に幅1ms,50HzのPWM信号を入れる。
入れると**プププ  ピー **となるので、これを確認したら、幅1ms(出力0)~2ms(出力max)でPWMを入れると動き出す。
はじめのゼロ入力操作をしていないと、1s周期でピッと鳴るだけ動かない。

サンプルプログラムを載せます。’j’をシリアルで送ると0、'k'と送ると中間(1.5ms)になります。

# include <MsTimer2.h>
volatile boolean flag = false;

void PWM(){
  flag =true;
}

void setup() {

  pinMode(9,OUTPUT); 
  digitalWrite(9,LOW);
  Serial.begin(250000);
  MsTimer2::set(20, PWM);
  MsTimer2::start();
  
 
}
volatile int k = 0;
void loop() {
 if(flag == true){
  flag = false;
  unsigned long time1 = micros();
  digitalWrite(9,HIGH);
  unsigned long time2 = micros();
  while(time2-time1<k){
    time2 = micros();
  }
  digitalWrite(9,LOW);
 }
 if(Serial.available()>0){
  int a = Serial.read();
  if(a == 'j'){
    k=1000;
  }else if(a=='k'){
    k=1500;
  }
  Serial.println(k);
  
 }
}
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?