FS-i6B receiver and Arduino not talking to each other

Hi there, I am very very new to coding, and would like some help. My FS-i6B receiver does not seem to be communicating with my Arduino Nano. I have tested the receiver and I know it works fine. I have power and ground plugged into B/VCC and comms into Ch4. As I still know very little about coding I have use Chat GPT to write the coding, and I do not know what is wrong. Please help.....

//✅ Hardware & Libraries Used
//    Board: Arduino Nano
//    Motor driver: L298N (for stepper)
//    Audio Module: DFPlayer Mini
//    PWM Controller: PCA9685 (Adafruit PWM Servo Driver)
//    Servos: WarningLightLifter, HeadTilt, HeadTurn, Steering
//    LEDs: LED1, LED2, LED3, LED4
//    Receiver: FS-IA6B (iBus protocol)
//    Servo easing: VarSpeedServo or ServoEasing library
//
//✅ Libraries Needed (install via Library Manager)
//    ServoEasing
//    Adafruit PWM Servo Driver (Adafruit_PWMServoDriver)
//    DFRobotDFPlayerMini
//    IBusBM (for FS-IA6B)
//    AccelStepper (for L298N stepper motor control)
//
//✅ Wiring Assumptions
//    DFPlayer: TX to Nano RX (D10), RX to Nano TX (D11) via voltage divider
//    L298N: IN1/IN2/IN3/IN4 connected to D2-D5
//    PCA9685: SDA/SCL to A4/A5
//    LEDs: On digital pins D6–D9 (can be changed)
//    FS-IA6B iBus: Connected to a UART (SoftwareSerial or Serial1 depending on Nano type)
//
//✅ Arduino Code
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
#include <ServoEasing.hpp>
#include <DFRobotDFPlayerMini.h>
#include <SoftwareSerial.h>
#include <IBusBM.h>
#include <AccelStepper.h>

// Constants
#define LED1_PIN 6
#define LED2_PIN 7
#define LED3_PIN 8
#define LED4_PIN 9
#define DFPLAYER_RX 10
#define DFPLAYER_TX 11

// Stepper Motor Pins for L298N
#define IN1 2
#define IN2 3
#define IN3 4
#define IN4 5

// Create PCA9685 Servo Driver
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

// Create easing servos
ServoEasing WarningLightLifter, HeadTilt, HeadTurn, Steering;

// DFPlayer
SoftwareSerial mp3Serial(DFPLAYER_RX, DFPLAYER_TX);
DFRobotDFPlayerMini mp3;

// IBUS receiver
IBusBM ibus;

// Stepper motor setup (AccelStepper)
AccelStepper stepper(AccelStepper::FULL4WIRE, IN1, IN3, IN2, IN4);

// States
bool warningActive = false;
unsigned long lastLEDPulse = 0;
int ledState = LOW;
int trackPlaying = -1;

// Random seed init
int randomPin = A0;

// LED array
const int leds[] = {LED1_PIN, LED2_PIN, LED3_PIN, LED4_PIN};

// Setup easing servo IDs on PCA9685
#define PWM_FREQ 50
#define SERVO_MIN 102  // ~0°
#define SERVO_MAX 512  // ~180°

void setup() {
  Serial.begin(9600);
  mp3Serial.begin(9600);
  ibus.begin(Serial);

  // Init DFPlayer
  if (!mp3.begin(mp3Serial)) {
    Serial.println("DFPlayer not found!");
    while (true);
  }
  mp3.volume(25);

  // Init PCA9685
  pwm.begin();
  pwm.setPWMFreq(PWM_FREQ);

  // Initialize easing servos with PCA9685 channels
  WarningLightLifter.attach(0, &pwm); // channel 0
  HeadTilt.attach(1, &pwm);
  HeadTurn.attach(2, &pwm);
  Steering.attach(3, &pwm);

  // Set initial positions
  WarningLightLifter.setEasingType(EASE_CUBIC_IN_OUT);
  HeadTilt.setEasingType(EASE_CUBIC_IN_OUT);
  HeadTurn.setEasingType(EASE_CUBIC_IN_OUT);
  Steering.setEasingType(EASE_CUBIC_IN_OUT);

  WarningLightLifter.write(0);
  HeadTilt.write(90);
  HeadTurn.write(90);
  Steering.write(90);

  // LEDs
  for (int i = 0; i < 4; i++) {
    pinMode(leds[i], OUTPUT);
    digitalWrite(leds[i], LOW);
  }

  // Stepper setup
  stepper.setMaxSpeed(1000);
  stepper.setAcceleration(500);
  stepper.setSpeed(200);

  randomSeed(analogRead(randomPin));
}

void loop() {
  ibus.loop();
  
  int ch1 = ibus.readChannel(0);  // example channel
  int ch2 = ibus.readChannel(1);  // control for warning lifter

  // Activate warning lifter on switch HIGH
  if (ch2 > 1800 && !warningActive) {
    warningActive = true;

    // Raise the warning lifter
    WarningLightLifter.startEaseTo(90, 50);
    delay(1000);

    // Flash LEDs and play random audio
    playRandomTrack();
    flashLEDs(500);

  } else if (ch2 < 1200 && warningActive) {
    warningActive = false;
    WarningLightLifter.startEaseTo(0, 50);
    stopLEDs();
  }

  // Other servo control (example mappings)
  //HeadTilt.startEaseTo(map(ibus.readChannel(3), 1000, 2000, 0, 180), 30);
  //HeadTurn.startEaseTo(map(ibus.readChannel(4), 1000, 2000, 0, 180), 30);
  //Steering.startEaseTo(map(ibus.readChannel(5), 1000, 2000, 0, 180), 30);

  // Update easing
  //runServoEasing();

  // Stepper run (optional)
  stepper.runSpeed();
}

// Flash LEDs when active
void flashLEDs(unsigned long interval) {
  if (millis() - lastLEDPulse >= interval) {
    lastLEDPulse = millis();
    ledState = !ledState;
    for (int i = 0; i < 4; i++) {
      digitalWrite(leds[i], ledState);
    }
  }
}

void stopLEDs() {
  for (int i = 0; i < 4; i++) {
    digitalWrite(leds[i], LOW);
  }
}

// Random MP3 track from 001-058
void playRandomTrack() {
  int track = random(1, 59);
  if (track != trackPlaying) {
    mp3.playMp3Folder(track);
    trackPlaying = track;
  }
}

There are several problems.
The first is you have not read supplied the picture of a hand drawn wiring diagram.
The second is you have not provided any debug output also wrapped in code tags.
The third is you used ChatGPT. Try starting with a sample sketch that the library used supplies.
The biggest problem though is that the code is dealing with things like MP3 players, flashing Leds, stepper motors, but your topic indicates none of that just a coms issue between NANO and FS-i6B receiver.
What you need to do is simplify the sketch so it only deals with one of those things at a time, then the next etc.
Good luck.

A sequence must be followed for binding with the Flysky.

There's a setting in the transmitter to enable iBus output (or PPM), and of course use the correct iBus output pins.

The controller and receiver are bound, I have checked and tested by plugging the servos in directly to the receiver

1 Like

Controller outputs are set to PWM and I-Bus

I thought they do one or the other, not both at once.
You would need to connect the receiver to something else to confirm the iBus output, if I had to use FlySky that would be my next step.
iBus is FlySky's version of SBUS, not guaranteed to work with everything as far as I know.

You could use the PPM output - it's going to be more "compatible" with everything.

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