FDL-3 nerf blaster

Hello Everyone,

I'm trying to build a nerf FDL-3 semi auto for my son, but I can't get the code to work with my ESC's. My ESC is a Favourite BLHeli_S Little Bee spring Dshot. The ESC Project FDL were using is a Spedix GS30 30A 2-4s BLHeli_32 Dshot ESC, could the problem be that they both have different protocols? When I power up the electronics the ESC's startup but they don't give the "armed beep". This is the original sketch projectfdl were using:

#include <Servo.h>
int escPin = A3;
int speedPin = A2;
int limiterPin = A1;
int triggerPin = A0;

Servo flywheelESC;

int currentSpeed = 1000;
int spindownRate = 10; //units per 10ms
unsigned long lastSpindownCheck = 0;
unsigned long elapsedTime = 0;

void setup() {
  pinMode(triggerPin, INPUT_PULLUP);
  pinMode(speedPin, INPUT);
  flywheelESC.attach(escPin); 
  flywheelESC.writeMicroseconds(1000);
}

// the loop function runs over and over again forever
void loop() {
 if(triggerDown()){

    int readSpeed = analogRead(speedPin);
    int limSpeed = analogRead(limiterPin);
    int maxSpeed = map(limSpeed, 0, 1023, 1285, 2000);
    int txSpeed = map(readSpeed, 0, 1023, 1285, maxSpeed);
  
    flywheelESC.writeMicroseconds(txSpeed);//1750);
    currentSpeed = txSpeed;
    elapsedTime = 0;
    lastSpindownCheck = millis();
  }
  else{
    //flywheelESC.writeMicroseconds(1000);
    spinDown();
  }

  //delay(2);
}

void spinDown(){

    int flipSpindown = (16 - spindownRate) * 2;
  
    if(currentSpeed > 1000){
      if(spindownRate == 0){
        currentSpeed = 1000;
      }
      else{
        elapsedTime = lastSpindownCheck == 0 ? 0 : elapsedTime + millis() - lastSpindownCheck;
        lastSpindownCheck = millis();
        int spindown = elapsedTime / 10 * flipSpindown;
        elapsedTime %= 10;
        
        currentSpeed -= spindown;
      }
    }
    
    flywheelESC.writeMicroseconds(currentSpeed);
}

boolean triggerDown(){
  return digitalRead(triggerPin) == LOW;
}

Ive been doing a lot of reading and I don't understand why the esc is connected to A3, I found a Dshot sketch and there the ESC is connected to D0 to D7. I'm not good with coding so forgive my ignorance. Hope someone could help me figure this out so I can learn and understand more about creating Arduino sketches. This is the Dshot sketch I found:

#include <DShot.h>

/*
redefine DSHOT_PORT if you want to change the default PORT
Defaults
UNO: PORTD, available pins 0-7 (D0-D7)
Leonardo: PORTB, available pins 4-7 (D8-D11)
e.g.
#define DSHOT_PORT PORTD
*/
DShot esc1(DShot::Mode::DSHOT300);

uint16_t throttle = 0;
uint16_t target = 0;

void setup() {
  Serial.begin(115200);

  // Notice, all pins must be connected to same PORT
  esc1.attach(7);  
  esc1.setThrottle(throttle);
}

void loop() {
  if (Serial.available()>0){
    target = Serial.parseInt();
    if (target>2047)
      target = 2047;
    Serial.print(target, HEX);
    Serial.print("\t");
  }
  if (throttle<48){
    throttle = 48;
  }
  if (target<=48){
    esc1.setThrottle(target);
  }else{
    if (target>throttle){
      throttle ++;
      esc1.setThrottle(throttle);
    }else if (target<throttle){
      throttle --;
      esc1.setThrottle(throttle);
    }
  }
  delay(10);
}

Please take a dive in the topics here. Latest Using Arduino/Project Guidance topics - Arduino Forum

How to post code instead of text.
How to present the circuitry.
What do work?

One uses the built-in Servo library:

int escPin = A3;
  flywheelESC.attach(escPin);

and the other uses some 'Dshot' library which does things differently. If your ESC does not have a servo-like control interface you may need to find and use the 'Dshot' library.

Thank you both for your reply, @Railroader I will take a look at the project guidance topics. I have corrected my 1st post, hope I did it correct. Due to covid I now have the concentration of a pea and a short term memory which is very bad. Reading long posts is very difficult at the moment so if I post anything in the wrong way please let me know and I will try to correct it.
@johnwasser I will try to find what protocols my ESC uses, I already found that the BLHelli_32 can work with multiple protocols.

This is the link to the GitHub page Project fdl:GitHub - projectfdl/FDL-3-Blaster
The pcb's used for this part is the TRG and PWR. When I connect the battery the ESC's startup but they don't give the "armed beep" therefore when you push the trigger the brushless motors won't turn.

You posted the code in the very best way! Next time, post all updates in the last posting. This makes reading the post easier to understand for new helpers stepping in.

Okey. I got burned down once, or more, and know how it works.
Taking small steps, one questions at the time works the best.
Keep up the spirit!

Thanks for your positive feedback, nextime I will correct in my later posts. I understand that will make it easier to read for others joining in on the conversation.
Small steps is the way to go indeed....

Please select the key information and copy it in a post. Many helpers don't download large files and don't plow through project descriptions like this.

Posting schematics made from pen and pencil looks like needed.


8ZewbCSWK53FMgyDO734xiPy0.png)

The first upload is the Trigger board which is connected from J2 to the Power board on I believe is called J4. The Arduino Pro mini is connected to J1 and the ESC's are connected to J1 and J2 of the Power board. My problem is that my ESC's give the startup beep but don't give the arming beep after the startup beep, the esc don't receive a signal from the Arduino. Because I have different ESC's than what the designer used I'm thinking that the problem lies there. I tried to contact Jesse from Project fdl but unfortunately no response.

Okay, after a lot of reading and fiddling I managed to get it to work. It was the ESC's that were not programmed correctly.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.