Driving ESC32v3 using Arduino

Info and Discussion about the ESC32 hardware and software

Driving ESC32v3 using Arduino

Postby snehaljain018 » Wed Sep 28, 2016 8:30 am

Hey guys,

I was trying to drive the ESC32v3 using a sinusoidal PWM input (generated by an Arduino Uno). I do that using a lookup array of 100 values (sinusoidally varying). The ESC32 arms properly with a low 900ms PWM signal. It accepts PWM input and spins around for a few seconds, after which it completely stops and the red LED starts blinking (DISARMED MODE)

This is my basic arduino sketch:
Code: Select all
#include <Servo.h>

// initialize value at the arming PWM
int value = 1296;
int j;
int sine[100] = {144,153,162,171,180,188,197,205,213,221,229,236,243,249,255,260,266,270,274,278,281,283,285,287,288,288,288,287,285,283,281,278,274,270,266,260,255,249,243,236,229,221,213,205,197,188,180,171,162,153,144,135,126,117,108,100,91,83,75,67,59,52,45,39,33,28,22,18,14,10,7,5,3,1,0,0,0,1,3,5,7,10,14,18,22,28,33,39,45,52,59,67,75,83,91,100,108,117,126,135};
int values[100] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
Servo esc;

void setup() {
  // put your setup code here, to run once:
  esc.attach(9,750,2250);
  Serial.begin(230400);
  //parseInt will set value to 0 once timeout occurs. 0 value will cause ESC to
  //disarm due to poor PWM signal (red blinking LED)
  Serial.setTimeout(200000);
  // arming the ESC
  for(int i = 0; i<5; i++){
    esc.writeMicroseconds(900);
    delay(1000);
  }
  j = 0;
  for(int i = 0; i<100; i++){
    values[i] = value + sine[i];
  }
}

void loop() {
  // put your main code here, to run repeatedly:
  if (values[j]==100){
    values[j] = 1440;
  }
  Serial.println(values[j]);
  esc.writeMicroseconds(values[j]);
  if (j>99){
    j = 0;
  }
  else{
    j = j+1;
  }
}


Can anyone please help and explain what I have been missing out?
snehaljain018
 
Posts: 3
Joined: Tue Aug 23, 2016 5:02 am

Driving ESC32v3 using Arduino

Postby Bookernub » Sun Feb 04, 2018 8:14 pm

Thanks for the information
So using an ESC qith Quax Firmware update is still recommended nevertheless?
Bookernub
 
Posts: 7
Joined: Sun Jan 28, 2018 2:36 pm
Location: Finland


Return to ESC32

Who is online

Users browsing this forum: No registered users and 3 guests

cron