GithubHelp home page GithubHelp logo

bmellink / ibusbm Goto Github PK

View Code? Open in Web Editor NEW
191.0 13.0 47.0 531 KB

Arduino library for RC IBUS protocol - servo (receive) and sensors/telemetry (send) using hardware UART

License: GNU General Public License v3.0

C++ 100.00%
arduino servo ibus rc-car

ibusbm's Introduction

Arduino Flysky/Turnigy RC iBus protocol handler

Arduino library for Flysky/Turnigy RC iBUS protocol - servo (receive) and sensors/telemetry (send) using hardware UART.

The iBUS protocol is a half-duplex protocol developed by Flysky to control multiple servos and motors using a single digital line. The values received for each servo channel are between 1000 (hex eE8) and 2000 (hex 7D0) with neutral sub trim setting, which corresponds with the pulse width in microseconds for most servos.

The protocol can also connect sensors to send back telemetry information to a RC transceiver. Depending on your transmitter you can use multiple sensors. You can define up to 10 sensors using this library. The Turnigy FS-MT6 only supports voltage, temperature, motor speed and pressure, but OpenTX based receivers support a long list of sensors, which can all be used by passing the right sensor ID to the addSensor() function.

This library was written and tested for the TGY-IA6B receiver and should work for other receivers too (such as the FS-iA10 and TGY-iA10). The TGY-IA6B has 2 iBUS pins: one for the servos (only output) and one for the sensors/telemetry (which uses a half-duplex protocol to switch between output and input to poll for sensor data).

Receivers with one iBUS pin typically send servo commands over the iBUS line, but do not always poll external sensors. The TGY-iA6C for instance only sends servo data over the iBUS and is only able to send back internal telemetry data (such as Rssi and voltage) and the voltage measurement of the B-DET connection. The specs of the Flysky X6B and Flysky FS-iA8X are unclear if telemetry sensors is supported over iBUS and they are not (yet) tested with this library.

Getting Started

To install this library use the Clone or download > Download ZIP button on the repository home page and then install the library in your Arduino environment using Sketch > Include Library > Add .ZIP Library...

This library supports AVR based Arduino boards (Arduino MEGA, UNO, Nano, Micro, etc.), ESP32 based boards (ESP32, NodeMCU, etc.), STM32 boards (STM32F103, etc.), MBED (such as the Arduino NANO 33 BLE) and MegaAVR.

Prerequisites

The iBUS library requires a dedicated hardware serial (UART) port on the Arduino board. If your board only has one UART port you can still use that port for serial debug communication with your PC as long as you plan to use servo output mode only (the baud rate will be fixed at 115200 baud and you should only attach the UART TX pin to the USB-Serial converter). The ATMEGA boards typically have more than one UART port.

You have three options:

  • If you plan to only use servo output iBUS data in your sketch, you only need to connect the iBUS servo output pin from your receiver to the RX pin of the allocated UART. The TX pin of the UART will not be used by the library as there is no information sent back to the RC receiver.
  • If you plan to only provide sensor iBUS data from your sketch, you will need to connect the iBUS sensor pin to both the RX and TX pin of the allocated UART. You need to include a diode (such as 1N4148) between the Arduino TX pin and the wire between the iBUS pin and the Arduino RX pin (cathode/solid ring of diode connected at Arduino TX pin) to handle the half-duplex protocol over the single iBUS wire. See example wiring below. If you only have one sensor connected to the iBUS (i.e. only the Arduino board) you can replace the diode with a resistor of 1.2k Ohm.
  • If you plan to use both servo output and sensor data in your sketch, your should use two different UART ports on your Arduino board.

For more information on the iBUS protocol, see (https://github.com/betaflight/betaflight/wiki/Single-wire-FlySky-(IBus)-telemetry). (please skip over the first part of the article how to combine the servo output and sensor data pins of the TGY receiver as it is more reliable to use two different UART ports on your Arduino if you need both servo and sensor data in your sketch).

Additional telemetry sensors

IBusBM.h defines sensor types

#define IBUSS_INTV 0 // Internal voltage (in 0.01)
#define IBUSS_TEMP 1 // Temperature (in 0.1 degrees, where 0=-40'C)
#define IBUSS_RPM  2 // RPM
#define IBUSS_EXTV 3 // External voltage (in 0.01)

If you have an OpenTx transceiver you can use additional telemetry sensors as defined in https://github.com/cleanflight/cleanflight/blob/7cd417959b3cb605aa574fc8c0f16759943527ef/src/main/telemetry/ibus_shared.h. Most sensors use 2 bytes of data. However, some sensors need 4 bytes of data. You can add the number of data bytes as second argument of the addSensor method as follows

#define IBUS_SENSOR_TYPE_GPS_LAT  0x80
IBus.addSensor(IBUS_SENSOR_TYPE_GPS_LAT, 4); 

Example wiring

Wiring with MEGA 2560

Note: If no other sensors are connected to the iBUS you have the option to replace the diode with an 1.2k Ohm resistor.

Example code for servo output only (AVR)

This example is for any AVR Arduino board. Note: this example is for AVR based boards only as the esp32 library does not support the analogwrite() function used by the servo.h library.

#include <IBusBM.h>
#include <Servo.h>

IBusBM IBus;    // IBus object
Servo myservo;  // create servo object to control a servo

void setup() {
  IBus.begin(Serial);    // iBUS object connected to serial0 RX pin
  myservo.attach(9);     // attaches the servo on pin 9 to the servo object
}

void loop() {
  int val;
  val = IBus.readChannel(0); // get latest value for servo channel 1
  myservo.writeMicroseconds(val);   // sets the servo position 
  delay(20);
}

You can support more servos by simply adding more Servo objects:

#include <IBusBM.h>
#include <Servo.h>

IBusBM IBus;    // IBus object
Servo myservo1;  // create servo object to control a servo
Servo myservo2;  // create servo object to control a servo

void setup() {
  IBus.begin(Serial);    // iBUS object connected to serial0 RX pin
  myservo1.attach(8);     // attaches the servo on pin 8 to the servo1 object
  myservo2.attach(9);     // attaches the servo on pin 9 to the servo2 object
}

void loop() {
  int val;
  val = IBus.readChannel(0); // get latest value for servo channel 1
  myservo1.writeMicroseconds(val);   // sets the servo position 
  val = IBus.readChannel(1); // get latest value for servo channel 2
  myservo2.writeMicroseconds(val);   // sets the servo position 
  delay(20);
}

Example code for servo output on ESP32

This example is for any ESP32 board and is based on the Esp32Servo library (https://github.com/madhephaestus/ESP32Servo) that can be downloaded using the Arduino library manager.

#include <IBusBM.h>
#include <ESP32Servo.h>

IBusBM IBus;    // IBus object
Servo myservo;  // create servo object to control a servo

// Possible PWM GPIO pins on the ESP32: 0(used by on-board button),2,4,5(used by on-board LED),12-19,21-23,25-27,32-33 
#define servoPin 18

void setup() {
  IBus.begin(Serial2,1);        // iBUS object connected to serial2 RX2 pin using timer 1
  myservo.attach(servoPin);     // attaches the servo on pin 18 to the servo object (using timer 0)
}

void loop() {
  int val;
  val = IBus.readChannel(0); // get latest value for servo channel 1
  myservo.writeMicroseconds(val);   // sets the servo position 
  delay(20);
}

Example code for servo output on ESP32 with disabled timer

This example is for any ESP32 board and is based on the Esp32Servo library. In some cases you may need the ESP32 timers for other functions and you want to call the internal loop() function from your own code.

#include <IBusBM.h>
#include <ESP32Servo.h>

IBusBM IBus;    // IBus object
Servo myservo;  // create servo object to control a servo

// Possible PWM GPIO pins on the ESP32: 0(used by on-board button),2,4,5(used by on-board LED),12-19,21-23,25-27,32-33 
#define servoPin 18

void setup() {
  IBus.begin(Serial2, IBUSBM_NOTIMER);  // iBUS object connected to serial2 RX2 pin using no timer
  myservo.attach(servoPin);     // attaches the servo on pin 18 to the servo object (using timer 0)
}

void loop() {
  int val;
  iBus.loop(); // call internal loop function to update the communication to the receiver 
  val = IBus.readChannel(0); // get latest value for servo channel 1
  myservo.writeMicroseconds(val);   // sets the servo position 
  delay(20);
}

Example code for combined servo output and sensor input using two UART ports

This example is for the MEGA 2560 and ESP32 boards and will display servo debug information on the screen. No actual code to control a servo control is included in this example (screen display only).

#include <IBusBM.h>

IBusBM IBusServo;
IBusBM IBusSensor;

#define TEMPBASE 400    // base value for temperature is -40'C

// sensor values
uint16_t speed=0;
uint16_t temp=TEMPBASE+200; // start at 20'C

void setup() {
  // initialize serial 0 port for debug messages on your PC
  Serial.begin(115200);

  // iBUS servo signal from receiver connected to RX of serial1 port
  IBusServo.begin(Serial1);
  // The default RX/TX pins for Serial1 on ESP32 boards are pins 9/10 and they are often not
  // exposed on the printed circuit board. You can change the pin number by replacing the line above with:
  // IBusServo.begin(Serial1, 1, 21, 22);

  // iBUS sensor signal pins from receiver connected to RX + TX of serial2 port
  // (1N4148 diode included in TX line - cathode connected to TX)
  IBusSensor.begin(Serial2);
  
  Serial.println("Start iBUS");

  // adding 2 sensors to generate some dummy data
  IBus.addSensor(iBUSS_RPM);
  IBus.addSensor(iBUSS_TEMP);
}

void loop() {
  // show first 8 servo channels
  for (int i=0; i<8 ; i++) {
    Serial.print(IBusServo.readChannel(i), HEX);
    Serial.print(" ");
  }
  Serial.print(" ServoCnt=");
  Serial.print(IBusServo.cnt_rec); // count of how many times servo values have been updated
  Serial.print(" SensorCnt=");
  Serial.println(IBusSensor.cnt_sensor); // count of how many times sensor values have been sent back

  IBus.setSensorMeasurement(1,speed);
  speed +=10;                           // increase motor speed by 10 RPM
  IBus.setSensorMeasurement(2,temp++);  // increase temperature by 0.1 'C every loop

  delay(500);
}

Class member functions and data members

The IBusBM class exposes the following functions:

- void begin(HardwareSerial &serial, int8_t timerid=0, int8_t rxPin=-1, int8_t txPin=-1);  // other architectures
- void begin(HardwareSerial &serial, TIM_TypeDef * timerid=TIM1, int8_t rxPin=-1, int8_t txPin=-1); // STM32 architecture

This initializes the library for a given serial port. rxPin and txPin can be specified for the serial ports 1 and 2 of ESP32 architectures (default to RX1=9, TX1=10, RX2=16, TX2=17). Serial port 0 and ports on AVR boards can not be overruled (pins on ESP32 are RX0=3, TX0=1). The variable timerid specifies the timer used (ESP32 and STM32 only) to drive the background processing (see below). A value of IBUSBM_NOTIMER disables the timer interrupt and you should call loop() yourself. Please note the default timer for STM32 is TIM1. If you are using TIM1 for something else (such as Servo or SoftwareSerial), please change the default.

uint8_t addSensor(uint8_t type, uint8_t len=2); 

Defines new sensor of type "type", returns sensor number (first is number 1). The optional parameter "len" is the number of bytes used for storing the sensor value (can be 2 or 4).

uint16_t readChannel(uint8_t channelNr);

Read the value of servo channel 0..9 corresponding with servo channels 1..10.

void setSensorMeasurement(uint8_t adr, int32_t value);

Set value of sensor number adr to a given value (first sensor is number 1). The background process will send the value back through the receiver.

void loop();

Call the internal polling function (at least once per 1 ms) in case you disable the timer interrup. See below. If you have multiple instances of the IbusBM class, you only need to call this function for the last instance for which you call the begin() function. Example:

void setup() {
  .... other setup code goes here ....
  // code included in setup() for initiating the instances
  IBusServo.begin(Serial1, IBUSBM_NOTIMER);   // first instance
  IBusSensor.begin(Serial2, IBUSBM_NOTIMER);  // second instance
}

void loop() {
  .... other loop() code goes here ....
  // code to call the polling function. Should be called at least once every 1 ms
  IbusSensor.loop();  // IbusSensor.loop() will call IbusServo.loop(), no separate call is needed here.
  wait(1);
}

The IBusBM class exposes the following counters. Counters are 1 byte (value 0..255) and values can be used by your code to understand if new data is available.

uint8_t cnt_rec; // count received number of servo messages from receiver
uint8_t cnt_poll; // count received number of sensor poll messages
uint8_t cnt_sensor; // count times a sensor value has been sent back

Counters can also be used to debug the hardware connections between the receiver and the Arduino board: If at least one sensor is defined, the RX pin will receive sensor poll messages. If the sensor is not able to "talk back" to the receiver the receiver will try to establish contact with the sensor every 7ms and the cnt_poll counter will increment. Only if the TX pin is correctly connected to the receiver, the cnt_sensor counter will increment and the cnt_poll value will stay the same.

Failsafe

Failsafe defines what to do if the transmitter looses the connection with the receiver. You can not use the cnt_rec counter for failsafe as the receiver will continue to send servo data over the iBUS even if the connection with the transmitter is lost. You can implement failsafe by defining a failsafe value for a given servo channel in your transmitter (this only works for receivers that support failsafe mode). You can then read the channel value using readChannel() and test for the failsafe value.

Sensor types

The following sensor types are defined in IBusBM.h:

#define iBUSS_INTV 0 // Internal voltage (in 0.01, so 500=5V)
#define iBUSS_TEMP 1 // Temperature (in 0.1 degrees Celcius, where 0=-40'C and 400=0 'C')
#define iBUSS_RPM  2 // RPM
#define iBUSS_EXTV 3 // External voltage (in 0.01, so 510=5.1V)
#define IBUS_PRESS 0x41 // Pressure (in Pa)

Depending on your transmitter you can use other sensor types too. If you have an OpenTX compatible transmitter, see the OpenTX documentation for the required sensor ID to pass to the addSensor() function.

Background processing and Interrupts

IBusBM runs in the background using interrupts to ensure your code does not interfere with the iBUS timing. Timer0 is used by the core libraries on all Arduino AVR based boards to keep track of time for commands line millis() and delay(). IBusBM defines an additional interrupt on Timer 0 (the compare interrupt - TIMER0_COMPA_vect) to trigger the main process. If you want to change or disable timer 0 you can call the internal polling function loop() from your own code.

On ESP32 boards the library uses timer 0 by default. You can overrule the timer by adding a second argument to the begin() function. It is important to change the timer used when you also use the Esp32Servo library to control servos as this library also uses timers to generate the PWM wave form: the first servo uses timer 0, the second timer 1, etc. As the ESP32 has only 4 timers, you need to disable the use of the timer for IbusBM when you want to use more than 3 Servos.

In order to disable the timer background function you can add the IBUSBM_NOTIMER to the begin() function. You then need to call the loop() function from your own code at least once every 1 ms. If you define more than one IbusBM objects, you only need to call the loop() function for the first object.

Example sketches provided

Example sketches:

  • Ibus2PWM: converts iBUS data to Servo PWM format: Reads data from first servo channel and translates this to PWM signal to send to a normal servo (AVR version)
  • Ibus2PWM_ESP32: converts iBUS data to Servo PWM format: Reads data from first servo channel and translates this to PWM signal to send to a normal servo (ESP32 version)
  • Ibus_singlemonitor: monitor/debugger for receivers with a single iBUS pin (providing both servo and sensor data such as the Flysky X6B and Flysky FS-iA8X). Prints out servo channels to the standard serial output (PC debug window) and simulates 2 sensors with random values sent back to transmitter (as long as your receiver supports this). Requires Arduino board with 2 or more hardware serial ports (such as MEGA 2560)
  • Ibus_multimonitor: monitor/debugger for receivers with a two separate iBUS pins (one for servo data and one for sensor data, such as the TGY-IA6B). Prints out servo channels to the standard serial output (PC debug window) and simulates 2 sensors with random values sent back to transmitter. Requires Arduino board with 3 or more hardware serial ports (such as MEGA 2560)
  • IBus_sensor: simulate two telemetry sensors and send values back over the iBUS to the receiver to be shown in the display of your transmitter
  • Ibus_diy_servo_STM32: example for (large) diy DC servo's, like windshield wiper motors. Change the P I D settings for servo response and tuning
  • Ibus2PWM_mbed: example translate iBUS signal to servo for MBED (Arduino Nano 33 BLE)
  • Robotcar: Example remote controlled car using the VNH3SP30 motor driver

ibusbm's People

Contributors

bmellink avatar pauluzs avatar pevsonic avatar rcodddow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ibusbm's Issues

Faster update

Dear bmellink!

You did great job with this Ibus library!
I used it in a project, where i need to watch the sensors. Sadly the sensors value update "slow", once per a sec.
Can i modify it to update more faster?

Can you help me what i need to modify in the IbusBM.cpp or in the IbusBM.h file?
It wil be great if the sensores update twice in a sec

Thank you!

Error during compilation

`#include <UnoJoy.h>
#include <iBusBM.h>

iBusBM ibus;

void setup() {
pinMode(2, INPUT);
UnoJoy.begin();
ibus.begin(Serial);
}

void loop() {
uint16_t data[14];
ibus.readData(data);
UnoJoy.X(data[0]);
UnoJoy.Y(data[1]);
UnoJoy.Z(data[2]);
UnoJoy.Zrotate(data[3]);
UnoJoy.sliderLeft(data[4]);
UnoJoy.sliderRight(data[5]);
UnoJoy.button(0, data[6] > 1500);
UnoJoy.button(1, data[7] > 1500);
UnoJoy.button(2, data[8] > 1500);
UnoJoy.button(3, data[9] > 1500);
UnoJoy.button(4, data[10] > 1500);
UnoJoy.button(5, data[11] > 1500);
UnoJoy.button(6, data[12] > 1500);
UnoJoy.button(7, data[13] > 1500);
delay(10);
}
errD:\Documents\Arduino\ArduinoNANO3\ArduinoNANO3.ino:2:10: fatal error: iBusBM.h: No such file or directory
#include <iBusBM.h>
^~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: iBusBM.h: No such file or directory`

Crash with ESP32 when wifi enabled.

When a webserver is used the ESP32 crash with default iBus config.
It runs OK if IBUSBM_NOTIMER is used with explicit call to .loop()
This problem may be linked to issue #33
Configuration: ESP32 Dev Kit board
Arduino IDE 1.8.19
ESP32 package2.0.9

Small test case:

#include <WiFi.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#include <IBusBM.h>

const char* ssid = "..........";
const char* password = "............................";
uint8_t rpmSens;
IBusBM IBus;
WebServer server(80);
uint16_t speed = 0;
void handleRoot() {
  server.send(200, "text/plain", "hello from esp32!");
}

void setup(void) {
  IBus.begin(Serial2);  //  crash ............
//  IBus.begin(Serial2, IBUSBM_NOTIMER); // OK
  rpmSens =  IBus.addSensor(IBUSS_RPM);

  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");
  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  if (MDNS.begin("esp32")) {
    Serial.println("MDNS responder started for esp32.local");
  }
  server.on("/", handleRoot);
  server.begin();
  Serial.println("HTTP server started");
}

void loop(void) {
//  IBus.loop();
  IBus.setSensorMeasurement(rpmSens, speed);
  speed += 1;
  server.handleClient();
  delay(2);//allow the cpu to switch to other tasks
}

The crash:

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13924
ho 0 tail 12 room 4
load:0x40080400,len:3600
entry 0x400805f0

assert failed: xQueueSemaphoreTake queue.c:1554 (!( ( xTaskGetSchedulerState() == ( ( BaseType_t ) 0 ) ) && ( xTicksToWait != 0 ) ))


Backtrace: 0x40083731:0x3ffbf32c |<-CORRUPTED




ELF file SHA256: 9faf0afb38fda9e7

Rebooting...

Issues with ESP32-S2

I believe there is an issue with the timers when used with the esp32-s2, the only way I could get it to work was to run it without the timer using: the default 18 RX pin

IBus.begin(Serial1, IBUSBM_NOTIMER);

IBUSBM_NOTIMER ... problem.

Hello.
I tried on ESP32 Devkit v1 IBusServo and IBusSensor, they work ok together...until I enter...IBUSBM_NOTIMER.
At that moment the telemetry disappears.
Something can be done!
This is the code.

``#include <IBusBM.h>
// ================================== IBus Servo
IBusBM IBusServo;
HardwareSerial Serial_1(1);
// ================================ IBus Telemetry
IBusBM IBusSensor;

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

IBusServo.begin(Serial_1, IBUSBM_NOTIMER);
//IBusServo.begin(Serial_1);
Serial_1.begin(115200, SERIAL_8N1, 4, 15);
delay(500);
IBusSensor.begin(Serial2);
delay(500);

IBusSensor.addSensor(0x0b);
}
void loop()
{
IBusServo.loop(); // Call the Ibus loop to check for Ibus messages from the receiver
Serial.println(IBusServo.readChannel(0));
IBusSensor.setSensorMeasurement(1, 33);
}

Support for 4 Byte Sensor Data - Baro Altitude etc

I'm in the process of designing a consolidated sensor module to work with the FS-iA6B receiver and an OpenTX transmitter. I've got it working great with a Current and External Voltage setup. Next stage is to hook up a BMP180/280/388 sensor for Baro Pressure and Temperature. The Cleanflight/Betaflight/OpenTx code supports it (Sensor Type 0x41) however there are a few changes required to your library to make it work:

  1. Pressure sensor is a 4 byte payload rather than a 2 byte payload
  2. The 4th Byte in the PROTOCOL_COMMAND_TYPE (which you have commented as always 0x02) is in fact the payload size in bytes. So for Baro Sensor this would be 0x04
  3. The PROTOCOL_COMMAND_VALUE response would need to include 0x08 for the first byte, and the two additional bytes of payload. This, I believe, is formatted with the 19 Least significant bits being Pressure (in Pascals) and the 13 most significant bits being Temperature (in 0.1 deg C, and 0=-40 deg C - Similar to IBUSS_TEMP format)

I'm just wondering if you might make the changes necessary? I'm sure I can do it but it wont be as elegant as your code, and it might be a useful addition for others - especially if it includes the other Cleanflight/Betaflight sensors (GPS payloads etc)

Many Thanks

A fatal error occurred: Serial data stream stopped: Possible serial noise or corruption. on ESP32

`#include <IBusBM.h>

// Create iBus Object
IBusBM ibus;

// Read the number of a given channel and convert to the range provided.
// If the channel is off, return the default value
int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) {
uint16_t ch = ibus.readChannel(channelInput);
if (ch < 100) return defaultValue;
return map(ch, 1000, 2000, minLimit, maxLimit);
}

// Read the channel and return a boolean value
bool readSwitch(byte channelInput, bool defaultValue) {
int intDefaultValue = (defaultValue) ? 100 : 0;
int ch = readChannel(channelInput, 0, 100, intDefaultValue);
return (ch > 50);
}

void setup() {
Serial.begin(115200);
Serial2.begin(115200);
ibus.begin(Serial2);
}`

I use it on an esp32 based board (Waveshare General Driver for Robots) using esp32 Dev Module on Arduino IDE. and i get the following errror on compilation.
A fatal error occurred: Serial data stream stopped: Possible serial noise or corruption.
Failed uploading: uploading error: exit status 2

I connected the pins as instruxted.

SofwareSerial

Is it possible to use SoftwareSerial instead of HardwareSerial? I am using the reciever FS-IA6B with an Arduino Nano, wich has only one Serial.
I tried just changing in the sources but it didn't work.

Arduino R4 Minima not supported

Hi, unfortunately I can't get my code running with Arduino R4 Minima Board.
I get the following errors message:

../src/IBusBM.h:43:14: error: reference to 'HardwareSerial' is ambiguous
void begin(HardwareSerial &serial, int8_t timerid=0, int8_t rxPin=-1, int8_t txPin=-1);

Hot restart problem initializing Serial connection

When I try to use the reset button to restart the board, or the board resets after uploading a sketch, the serial connection to the receiver fails to initialize, making the sketch get stuck in the setup method at IBus.begin(Seial1). Disconnecting the power from the board and trying again works most of the time, as does disconnecting then reconnecting the flysky receiver.

I use an Arduino Mega R3, receiver is hooked up to Serial1 for Servos and Serial2 for telemetry.

IBus_Multimonitor - Doesn't send the 2 simulated sensors to my FS-i6 TX

I recently picked up two ESP32devkitC32D microprocessors. After some headaches trying to get the sketches to upload (capacitor fixed between ground and EN fixed that), I tried the IBus_Multimonitor code. I made the change to the "IBusServo.begin(Serial1, 1, 21, 22);" line and rem'd out the original line in the code. My Sensor signal wire has the appropriate diode on pin 17 pin with the black ring on the pin side. The main part of that wire attaches to pin 16. The Servo signal wire is hooked up to pin 21.

I was able to get the Servo readings, but am not sure what I am looking at for the Cnt, Poll, and Sensor. Cnt seems to count by 11 +/-, Poll seems to increase by about 50 +/- and Sensor = 0.

While this was running, I checked the transmitter to see if there were any new sensors in the list. There was not. I then did some experimenting. I have two FS-CVT01 voltage sensors and I hooked them in series between the receiver and the harness going to the ESP32. Those sensors did show up in the TX sensor list. The output to the serial monitor changed as well. Cnt is increasing by 9+/-, Poll is at 0, and the sensor is still increasing about 50 +/-.

Does anyone have any words of advice for what I should try next? I am really looking forward to send custom telemetry back to the transmitter. Thanks in advance!

What is the structure of the packet?

I apologize if this is the wrong place to ask. I am new to using the IBus protocol on my FlySky I6X transmitter with IA6B receiver. I understand that there are 6 servo channels transmitted (the two gimbals and VRa and VRb, correct?) There are also 4 switches on the transmitter, are they included in the packet? Is there a full definition of the entire packet somewhere? I have been looking but I cannot find a definition of the full packet.

Generic STM32F103C8 Compile error

When i try to run an example i have this:

.pio\libdeps\genericSTM32F103C8\IBusBM\src\IBusBM.cpp:40:15: error: variable or field 'onTimer' declared void
40 | void onTimer(stimer_t *htim) {
| ^~~~~~~~
.pio\libdeps\genericSTM32F103C8\IBusBM\src\IBusBM.cpp:40:15: error: 'stimer_t' was not declared in this scope; did you mean 'timer_t'?
40 | void onTimer(stimer_t *htim) {
| ^~~~~~~~
| timer_t
.pio\libdeps\genericSTM32F103C8\IBusBM\src\IBusBM.cpp:40:25: error: 'htim' was not declared in this scope; did you mean 'tm'?
40 | void onTimer(stimer_t *htim) {
| ^~~~
| tm
.pio\libdeps\genericSTM32F103C8\IBusBM\src\IBusBM.cpp: In member function 'void IBusBM::begin(HardwareSerial&, int8_t, int8_t, int8_t)':
.pio\libdeps\genericSTM32F103C8\IBusBM\src\IBusBM.cpp:122:16: error: 'stimer_t' does not name a type; did you mean 'timer_t'?
122 | static stimer_t TimHandle; // Handler for stimer
| ^~~~~~~~
| timer_t
.pio\libdeps\genericSTM32F103C8\IBusBM\src\IBusBM.cpp:123:8: error: 'TimHandle' was not declared in this scope
123 | TimHandle.timer = TIMER; // Set TIMx instance.
| ^~~~~~~~~
.pio\libdeps\genericSTM32F103C8\IBusBM\src\IBusBM.cpp:124:58: error: 'getTimerClkFreq' was not declared in this scope; did you mean 'getTimerClkSrc'?
124 | TimerHandleInit(&TimHandle, 1000 - 1, ((uint32_t)(getTimerClkFreq(TIMER) / (1000000)) - 1)); // Set TIMx timer to 1ms
| ^~~~~~~~~~~~~~~
| getTimerClkSrc
.pio\libdeps\genericSTM32F103C8\IBusBM\src\IBusBM.cpp:124:8: error: 'TimerHandleInit' was not declared in this scope
124 | TimerHandleInit(&TimHandle, 1000 - 1, ((uint32_t)(getTimerClkFreq(TIMER) / (1000000)) - 1)); // Set TIMx timer to 1ms
| ^~~~~~~~~~~~~~~
.pio\libdeps\genericSTM32F103C8\IBusBM\src\IBusBM.cpp:125:36: error: 'onTimer' was not declared in this scope
125 | attachIntHandle(&TimHandle, onTimer); // Attach onTimer interupt routine
| ^~~~~~~
.pio\libdeps\genericSTM32F103C8\IBusBM\src\IBusBM.cpp:125:8: error: 'attachIntHandle' was not declared in this scope
125 | attachIntHandle(&TimHandle, onTimer); // Attach onTimer interupt routine
| ^~~~~~~~~~~~~~~
*** [.pio\build\genericSTM32F103C8\lib273\IBusBM\IBusBM.cpp.o] Error 1

Can you give some advice how to fix?

Teensy Support

Hey! I'm working on a project that uses IBusBM to receive data from my RC receiver and translate that into commands for DFPlayer. This allows me to play sounds for my RC R2-D2. I got this working pretty good with a Nano.

However, the DFPlayer also needs UART, so I am attempting to move over to a TeensyLC board, which has more than enough UART ports for the RC receiver, DFPlayer, and computer connection.

I have some sample code going, but right now I'm not getting anything but 0 when calling readChannel on IBus. After some looking around, I'm thinking it likely has to do with the fact that the Teensy LC uses an unsupported architecture.

I'd be happy to help you get this supported if possible. I don't know anything about Arduino libraries other than loading and using them, but I am a programmer and have an TeensyLC that I'd be more than happy to test with.

Any chance this is something you'd be willing to support?

Error with PWM

Dear Bmellink!

I have a problem with this library.
It works great until i want to read PWM values with PulseIn()

error

As you see in the picture i used 2 input pin connected to a Reciever channel1 and channel2.
When i read transmission's centered axis PWM values with pulseIn(), then i got something like this:

1460
1458
1466
1420
1102 <---- big bounce!!!
1466
1459

When i comment out IBus.begin(Serial3) the problem vanished! Then i got a smooth PWM values aroung 1460 without big bounces.

I thin think this bounce happens when IBUS polling sensors. Or not?

What i am doing wrong?
The rest of the program there is IBus.setSensorMeasurement. The IBUS values are OK! Just the PWM bouncing.
Timer issue? Interrupt issue?

Thank you!

Arduino uno - telemetry - cnt_sensor stays 0

I have an arduino uno and a FS-ia6b. I'm trying to send telemetry data towards my transmitter (and only telemetry data).
I'm using the code as is and the sketch Ibus_sensor.ino where i remove all the Serial.print and Serial.begin commands.

I have a wire like described (tested it with my multimeter if the resistor is working on the TX pin. I used TX on port 1 and RX on port 0 but I see no telemetry data.

If i'm using altsoftserial (on port 8,9) for debugging i see the cnt_poll increasing, but the cnt_sensor stays zero.
I tried with a 1,2K resistor and 4,7K resistor but non work.
Any clue on what I can try or what the problem could be?

Would Like to use Atom Lite

Not really an issue, more of a question.

I would like to get telemetry data from an Atom Lite.

I have connected to pins 26 and 32 respectively using the diode as required. I am using a Flysky IA6B receiver. I tried changing the code to these pins, swapping them around etc but receive no telemetry data to the receiver.

Is there anything else I should have perhaps updated to make use of the atom lite instead of an Arduino board?

This is just for telemetry, no requirement to control servos.

#include <IBusBM.h>

/*
Simulate two sensor and send information back over the iBUS to the receiver (and back to transmitter
as telemetry).

Requires Arduino board with multiple UARTs (such as ATMEGA 2560, Micro or ESP32)

  • serial0 - monitor output (debug output to PC, this is through the build-in USB)
  • serial1 - connected RX of the serial port to the ibus receiver pin
    Connect the (TX) pin also to the RX/ibus connection using an 1.2k Ohm reistor or 1N4148 diode
    (cathode=white ring of the diode at the side of TX2)

sensor types defined in IBusBM.h:

#define IBUSS_INTV 0 // Internal voltage (in 0.01)
#define IBUSS_TEMP 1 // Temperature (in 0.1 degrees, where 0=-40'C)
#define IBUSS_RPM 2 // RPM
#define IBUSS_EXTV 3 // External voltage (in 0.1V)

*/

IBusBM IBus;

void setup() {
// initialize serial port for debug
Serial.begin(115200);

// iBUS connected to serial1
IBus.begin(Serial1,1,32,26);
// The default RX/TX pins for Serial1 on ESP32 boards are pins 9/10 and they are sometimes not
// exposed on the printed circuit board. You can use Serial2 (for which the pins are often available) or
// you can change the pin number by replacing the line above with:
// IBusServo.begin(Serial1, 1);

Serial.println("Start iBUS sensor");

// adding 2 sensors
IBus.addSensor(IBUSS_RPM);
IBus.addSensor(IBUSS_TEMP);
}

#define TEMPBASE 400 // base value for 0'C

// sensor values
uint16_t speed=0;
uint16_t temp=TEMPBASE+200; // start at 20'C

void loop() {
IBus.setSensorMeasurement(1,speed);
speed += 10; // increase motor speed by 10 RPM
IBus.setSensorMeasurement(2,temp++); // increase temperature by 0.1 'C every loop
Serial.print("Speed=");
Serial.print(speed);
Serial.print(" Temp=");
Serial.println((temp-TEMPBASE)/10.);
delay(1000);
}

Library not compatible with ESP32-Cam

Hello,

I get after IBus.begin(Serial2,n,16,13); (n was greater as 2) errors.
When I initialise the IBus before the cam I get this:
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
decoded:
0x400d3fe9: timerAttachInterrupt at d:\Arduino\arduino-1.8.3\portable\packages\esp32\hardware\esp32\1.0.4\cores\esp32/esp32-hal-timer.c line 174 0x400d37ec: onTimer() at D:\Arduino\arduino-1.8.3\sketch\libraries\IBusBM\src/IBusBM.cpp line 243
and after the cam:
[E][camera.c:1049] camera_probe(): Detected camera not supported.
[E][camera.c:1249] esp_camera_init(): Camera probe failed with error 0x20004
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
decoded:
0x400d130c: index_handler(httpd_req*) at d:\Arduino\arduino-1.8.3\sketch\build\sketch/app_server.cpp line 421 0x400d130c: index_handler(httpd_req*) at d:\Arduino\arduino-1.8.3\sketch\build\sketch/app_server.cpp line 421 0x400d490f: Print::printf(char const*, ...) at d:\Arduino\arduino-1.8.3\portable\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Print.cpp line 234 0x4008f165: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 355 (discriminator 1)
the first are comming, because the cam is not initialised.

I set the SDCard to the 1bit mode, that the other pins are free.

Can You help me on this Problem?

Thank You

Hans

Sensor not working

Hi,

I'am trying to make working your sensor example but my flysky Radio doesn't display anything.

The sensor Trame is well detected withe the trame 0x04, 0x81, 0x7A, 0xFF but after i nether received the PROTOCOL_COMMAND_TYPE: // 0x90, send sensor type

My card ESP32 with serial2, Radio Flysky NB4 and FGr4S rx

switch (buffer[0] & 0x0f0) { case PROTOCOL_COMMAND_DISCOVER: // 0x80, discover sensor cnt_poll++; // echo discover command: 0x04, 0x81, 0x7A, 0xFF stream->write(0x04); stream->write(PROTOCOL_COMMAND_DISCOVER + adr); chksum = 0xFFFF - (0x04 + PROTOCOL_COMMAND_DISCOVER + adr ); break;
Any idea ?

Thanks

PB solve, My ESP32 as problem with Serial 2

EndPoints

Hi!

Is there any way to read out endpoint settings from transmitter?
How can i learn max, and min PWM values?

Thank you!

IBUS_SERVO => How to use it?

Hi!

I am wondering how I can use the IBUS_SERVO sensor? It would be great to use it for pitch, yaw and roll values, or for altitude readings as it can have precise values. But no matter what I do I can not fill the numbers after decimal point.

Send from Arduino Data on transmitter
0 0.00
123.45 123.00
12345 12345.00

Is there a way to get around this?

Regards; Luka

Wrong timer initialisation for ESP32 giving strange ibus polling frequency

Configuration: ESP32 Dev Kit
The comments in the README and in the source code say that the iBus should be polled at least once per 1 ms.
When a timer is used the library uses the following code:

      #if defined(ARDUINO_ARCH_ESP32) 
        hw_timer_t * timer = NULL;
        timer = timerBegin(timerid, F_CPU / 1000000L, true); // defaults to timer_id = 0; divider=80 (1 ms); countUp = true;
        timerAttachInterrupt(timer, &onTimer, true); // edge = true
        timerAlarmWrite(timer, 1000, true);  //1 ms
        timerAlarmEnable(timer);

The code uses F_CPU, the CPU clock, to calculate a prescaler value that will give a 1ms timer.

In fact the clock source of the timers is APB_CLK (typically 80 MHz) and not the CPU clock and the code above will only give a 1ms timer if the CPU clock is 80Mhz.
By default in Arduino IDE the cpu clock is 240Mhz, the prescaler will be 240 and the timer will fire every 3ms

With the code above, the faster is the CPU clock, the slower will be the poll frequency of the iBus. Strange .

A fixed prescaler should be used ?: 80
timer = timerBegin(timerid, 80, true); // defaults to timer_id = 0; divider=80 (1 ms); countUp = true;

ibus.readChannel fails to detect loss of signal (causes failsafe failure)

Possibly similar to issue #24, but with a twist. The Flysky controller can have "failsafe" set for it's channels. If you set that on, and then if you cut power to the transmitter to simulate a loss of radio signal, the failsafe works and values return to the set (default) failsafe parameters (set as a percentage signal on transmitter).

HOWEVER: If you disconnect the data wire from the receiver to the Arduino, nothing is sensed and the last value prior to wire disconnect continues to be returned from "ibus.readChannel" In the case of an Arduino controlling a large robot, or any similar device that could easily experience a wiring failure, this behavior results in an unsafe condition where the motors being controlled keep their last known setting after the data wire failure. This would result in an unsafe failure.

Unlike #24 2where a user suggested the code was not at fault, in this case it does appear to be. As there is NO data being sent to the Arduino because the receiver is disconnected.

How can I implement a test of signal for wire disconnect failsafe operation? Need to be able to test for loss of i-Bus signal.

Can I use:
uint8_t cnt_rec; // count received number of servo messages from receiver
To tes tfor servo messages, contrary to the docs saying you cannot for failsafe? Perhaps this count being stagnat woudl indicate a failed wire?

Works on Uno, Not on Mega

Hello and thank you! I'm using this with no problems on an Uno, reading transmitter values from pin zero, but when I upload the code to a Mega, it doesn't work. Are there any tips you have for getting data from the receiver with a Mega?

Code looks like this:

IBusBM IBus;    // IBus object

int val1;  // Channel 0 Right Stick - Left/Right (all values 1000->2000)

void setup() {
  IBus.begin(Serial);    // iBUS object connected to serial0 RX pin
  Serial.begin(115200);           // set up Serial library
}

void loop() {
  val1 = IBus.readChannel(0); // get latest value for servo channel 1
...

NodeMCU (ESP8266) compiling error

Hi, even though nodeMCU is mentioned in the documentation I am getting this compile error from the IBusBM library. Simply trying to load one of the examples to read ibus servo signals.

.../src/IBusBM.cpp:114:10: error: #error "Only support for AVR, ESP32 and STM32 architectures."
#error "Only support for AVR, ESP32 and STM32 architectures."
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

Thanks

ibus_sensor does not work on NANO

This example works fine with arduino mega.
I want to run it on nano. So I change
// initialize serial port for debug
Serial.begin(115200);
// iBUS connected to serial1
IBus.begin(Serial1);
to
// initialize serial port for debug
//Serial.begin(115200);
// iBUS connected to serial
IBus.begin(Serial);
Usb cable is not connected.
In this case it does not work. I see no sensors on the transmitter.
Is nano supported for sensor only operation?

Still receiving data after controller shuts off

Im using the Fly Sky FS-i6x with receiver. After the IBusBM library is initialized the cnt_rec value stays at zero until the controller is turned on and all switches are up and the throttle is set low. The problem is after the first servo message is received and the controller is turned off IBusBM still increments cnt_rec.

After making most private variables public it really seems that the receiver is continually pushing through the last servo message over and over. The weird thing is the checksum values seem to change.

I tried reseting IBUSBM using the begin function I a 2.5Hz loop but this just cause more problems.

Any suggestions ?

Support for Arduino Due

Unfortunately the library currently doesn't support the Arduino Due.

WARNING: library IBusBM claims to run on avr, esp32, stm32, mbed architecture(s) and may be incompatible with your current board which runs on sam architecture(s).
/Users/arnom/Documents/Arduino/libraries/IBusBM/src/IBusBM.cpp: In member function 'void IBusBM::begin(HardwareSerial&, int8_t, int8_t, int8_t)':
/Users/arnom/Documents/Arduino/libraries/IBusBM/src/IBusBM.cpp:91:36: error: no matching function for call to 'HardwareSerial::begin(int, UARTClass::UARTModes)'
     serial.begin(115200, SERIAL_8N1);
                                    ^
/Users/arnom/Documents/Arduino/libraries/IBusBM/src/IBusBM.cpp:91:36: note: candidate is:
In file included from /Users/arnom/Library/Arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino/Arduino.h:195:0,
                 from /Users/arnom/Documents/Arduino/libraries/IBusBM/src/IBusBM.cpp:25:
/Users/arnom/Library/Arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino/HardwareSerial.h:29:18: note: virtual void HardwareSerial::begin(long unsigned int)
     virtual void begin(unsigned long);
                  ^
/Users/arnom/Library/Arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino/HardwareSerial.h:29:18: note:   candidate expects 1 argument, 2 provided
exit status 1
Error compiling for board Arduino Due (Native USB Port).

Seems like there's something wrong with the Arduino abstraction for the Due. 🤔

PS: I'm aware that later on I will probably need a level translator to deal with the 3V3 vs 5V signals.

nano not work for ibus

hi i have a problem with get it work the ibusBM with the nano , i have upload the ino to the uno board as well and its work as should but when i try to do with the nano its not at all , i did wired up as should, checked many times even used diferent nano ,, brand new,, let say about 4 of them , and still no result ,same issues , any help woud be great thanks

Servo jitter

Hi. I have WeAct 3.0 STM32F411 and when use only IBusServo connected the servo and run an example everything works perfect. But when i added IBusSens the servo started to jitter ((
Can you give some advice how to solve?

cnt_poll, cnt_sensor, cnt_rec volatile..

Hello,
thank you for your fine work!

Just my two cents after wondering over my code:

static uint8_t cnt, last_cnt;
last_cnt = IBusServo.cnt_rec;
while ( last_cnt == (cnt = IBusServo.cnt_rec) ) {
//sleepy...wait for new data
}
that became a endless loop instead of waiting about 7ms...

You should declare (File IBusBM.h):
volatile uint8_t cnt_poll; // count received number of sensor poll messages
volatile uint8_t cnt_sensor; // count times a sensor value has been sent back
volatile uint8_t cnt_rec; // count received number of servo messages

Regards, wun

Generic STM32F103C8T6 Compile error

警告: IBusBM 库要求运行在 avr, esp32, stm32 架构(),可能与你现在运行在 STM32F1 架构上的开发板()不兼容。
/Users/admin/Documents/Arduino/libraries/IBusBM/src/IBusBM.cpp:38:15: error: variable or field 'onTimer' declared void
void onTimer(stimer_t *htim) {

"IBusBM.h" 对应多个库
已使用: /Users/admin/Documents/Arduino/libraries/IBusBM
exit status 1
为开发板 Generic STM32F103C series 编译时出错。

Telemetry on STM32F103C8T6 ...

Hello.
I tried from IBusBM-1.1.5, the Ibus_sensor example.
I tried it on the Arduino mega 2560 = Ok, transmits sensor data.
I tried on ESP 32 = Ok, transmits sensor data.
I tried on STM32F103C8T6 - Blue Pill = does not transmit sensor data.
Please, can someone explain what can be done to make it ok!

Problem with data reception after iBus

Hi friend,
I have such a problem, namely I want to receive data via iBus from the flysky ia6b receiver.
The problem is that I get all 0 instead of specific values.
The same code uploaded to ArduinoMega works without a problem and with stm32 it does not want.
I tried on the STM32F411 / F401 blackpill, NUCLEO-F401RE plates and all the time I have only zeros.

Ch0: 0 ---- Ch1: 0 ---- Ch2: 0 ---- Ch3: 0 ---- Ch4: 0 ---- Ch5: 0 ---- Ch6: 0 ---- Ch7: 0 ---- Ch8: 0 ---- Ch9: 0 ---- Ch10: 0 ---- Ch11: 0 ---- Ch12: 0 ---- Ch13: 0 ---- Next
Ch0: 0 ---- Ch1: 0 ---- Ch2: 0 ---- Ch3: 0 ---- Ch4: 0 ---- Ch5: 0 ---- Ch6: 0 ---- Ch7: 0 ---- Ch8: 0 ---- Ch9: 0 ---- Ch10: 0 ---- Ch11: 0 ---- Ch12: 0 ---- Ch13: 0 ---- Next
Ch0: 0 ---- Ch1: 0 ---- Ch2: 0 ---- Ch3: 0 ---- Ch4: 0 ---- Ch5: 0 ---- Ch6: 0 ---- Ch7: 0 ---- Ch8: 0 ---- Ch9: 0 ---- Ch10: 0 ---- Ch11: 0 ---- Ch12: 0 ---- Ch13: 0 ---- Next
Ch0: 0 ---- Ch1: 0 ---- Ch2: 0 ---- Ch3: 0 ---- Ch4: 0 ---- Ch5: 0 ---- Ch6: 0 ---- Ch7: 0 ---- Ch8: 0 ---- Ch9: 0 ---- Ch10: 0 ---- Ch11: 0 ---- Ch12: 0 ---- Ch13: 0 ---- Next
Ch0: 0 ---- Ch1: 0 ---- Ch2: 0 ---- Ch3: 0 ---- Ch4: 0 ---- Ch5: 0 ---- Ch6: 0 ---- Ch7: 0 ---- Ch8: 0 ---- Ch9: 0 ---- Ch10: 0 ---- Ch11: 0 ---- Ch12: 0 ---- Ch13: 0 ---- Next

Code:

#include <IBusBM.h>



IBusBM IBusServo;

//Arduino Mega
//HardwareSerial Serial2(17,16); 

//                      RX    TX
//HardwareSerial Serial2(PA3, PA2);
  
void setup() {
  Serial.begin(115200);

  IBusServo.begin(Serial2);

}

void loop() {
  ibusServo();

}
//
//
//

void ibusServo()
{
 // show first 14 servo channels
  for (int i=0; i<14 ; i++) {
    Serial.print("Ch");
    Serial.print(i);
    Serial.print(": ");
    Serial.print(IBusServo.readChannel(i));
    Serial.print(" ---- ");

  }
 Serial.println("Next");

  delay(1000);
}

Has anyone encountered such a problem ??
I tried to download only Stm32Cores on a clean installation and IbusBM also does not work ;(

https://cdn.discordapp.com/attachments/773515783241990144/981518868163993610/20220601_132505.jpg

The worst part is that exactly a year ago, maybe one and a half everything was working on the blackpill STM32F411.
And I did some dumb updates a while ago and it stopped working.
I installed clean windows10 for this arduino IDE earlier versions I only added STM32 and ibusBM. Unfortunately, no success.

Single-wire mode looks that not working...

Trying to use library with single-wire mode. Wiring with Arduino Mega2560 according https://github.com/betaflight/betaflight/wiki/Single-wire-FlySky-(IBus)-telemetry
Example singlemonitor wont work. Actually, I can receive data, but after writing to stream, receiver doesnt sent nothing (so, it not seen next command with 0x90). multimonitor have no idea how to connect to serial1... looks that it wont work, but I think that I doing something wrong.

Serial.begin(115200); IBusServo.begin(Serial1); IBusSensor.begin(Serial1);

With 2 UARTS - no problems, but wanna find any options to use one UART only... :(

+---------+
| FS-iA6B |
| |
| Ser RX. |---|<---\ +------------+
| | | | FC |
| Sensor |---[R]--*-------| Uart TX |
+----------+ +------------+

Adding RPi Pico support

Hi there, thanks for this great library. I'd love to contribute and add support for the RPi Pico RP2040. I'm somewhat new to this -- would you mind pointing out the main things that need to happen in order to get things working with this board, and I'll have a crack at it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.