Model Boat Mayhem

Please login or register.

Login with username, password and session length.
Pages: [1]   Go Down

Author Topic: What am i doing wrong? Reading PPM(???)Futaba Multi-Prop 4+4(8039) with Arduino;  (Read 748 times)

BogdanM

  • Shipmate
  • *
  • Offline Offline
  • Posts: 10
  • Model Boat Mayhem is Great!
  • Location: Bucharest


Dear all,
I am currently working on my OTW type VII internals and started to play around with Arduino in the process. The first thing to figure out is how to read the receiver signals and PPM stream(???) on Channel 6 coming from the multi-prop
encoder.

1. Reading normal PWM channels is working fine and i have succeeded in controlling a 12v DC motor with a Hbridge that will be used to control my pistons, no issues here.


2. The next normal step was to try to read the Channel 6 where my multi-prop encoder is mapped to the receiver, the reason for doing this is to try to replace the existing Multi-Prop Decoder (F1516) all together and stick to the Arduino for all submarine operations.


I found a very useful tutorial here on how to read a PPM stream(Its a PPM stream?) and started to write the code(here). To my surprise its not working, I only see the first pulse(1 out of 8) with the value of 21976. Its the expected stream coming from receiver Channel 6(Multi-prop 4+4) a PPM?
So channel 6 on the receiver is connected to the digital pin 8 of my Arduino UNO board. What am I doing wrong?

Please also note that when using the decoder in the normal way(no arduino), all the switches and and props are working as expected.

I am using:

1. Robbe Futaba F14 transmitter;
2. Robbe Futaba FP-R118F receiver;
3. Futaba Multiprop 4+4(8039)
4. Arduino UNO R3;

More images here.

You help is most welcome, i have no other idea how to resolve it.

Thank you. Bogdan
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 966
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine

Hi Bogdan,

I have not looked in deail at your code - the value of near 22000 (ms?) is remarkably close to the overall "frame" length - coincidence?

Try the link below to read your ppm stream

https://github.com/Nikkilae/PPM-reader

and also see Tim Senecal's code

https://www.modelboatmayhem.co.uk/forum/index.php/topic,57119.msg595279.html#msg595279

Regards

C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

BogdanM

  • Shipmate
  • *
  • Offline Offline
  • Posts: 10
  • Model Boat Mayhem is Great!
  • Location: Bucharest

Hi C-3PO,

"https://github.com/Nikkilae/PPM-reader" library throws me the following error: "Using library PPMRead in folder: C:\Users\Bogdan\Documents\Arduino\libraries\PPMRead (legacy) exit status 1'PPMReader' does not name a type", seems related to some legacy timer library.


Instead,  this one "https://github.com/DzikuVx/PPMReader" gives promising results, the example provided does not return the exact values per channels but I will figure out.

Does anyone knows how to code the radio failsafe?

Thank you one again C-3PO.

Regards,

Bogdan



Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 966
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine

I use the ppmreader by Nikkilae without errors!

I think it's probable that it may be how the library files are installed as you would have copied them from the zip file rather than being able to install via the IDE menu (does not work)

PPM-reader-master.zip/ppm-reader-master/PPMReader/

All you want from the github zip file is the ppmReader directory & it's 2 files manually copied into your library directory

The error "does not name a type" suggests  the library has been installed in a nested directory  arduino/libraries/ppm-reader-master/ppmreader/*.* rather than arduino/libraries/ppmReader/*.*

See this article - https://forum.arduino.cc/index.php?topic=155921.0

But as with all things Arduino it could be one of many reasons :)

Failsafe
I have various sets of code for failsafe situations - have you defined the "cirumstances" that would trigger your failsafe?

Regards
C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

tsenecal

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 403
  • Location: Arvada, Colorado, USA

the robbe multi-prop and multi-switch devices DO NOT output ppm, they output a simple pwm stream that is time-sliced.  there should be 8 normal length pwm values, followed by a ninth "sync" signal that is "outside" "normal" ppm values...  ie 1500ms 1500ms 1500ms 1500ms 1500ms 1500ms 1500ms 1500ms 550ms  where the 550ms is not used, but indicates the end of the usable values.   also note... if the channel on your transmitter is reversed, the 550ms sync signal will be something more like 2350ms
Logged

Martin [Admin]

  • Administrator
  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 20,529
  • Location: Peterborough, UK
    • Model Boat Mayhem


The photos from post 1 .....






















Logged
"This is my firm opinion, but what do I know?!"    -   Mayhem FaceBook Group!

BogdanM

  • Shipmate
  • *
  • Offline Offline
  • Posts: 10
  • Model Boat Mayhem is Great!
  • Location: Bucharest

Dear All,I need help with this code that I put together with the help of many beautiful people.It is supposed to read Ch6(Multiprop4+4(F8039) ) from my F14 transmitter with Arduino using pin change interrupt library. As you can see in the video clip, there is slight delay/lag both for light switching and even more pronounced with the servo movement.Any idea what I am doing wrong or its just an Arduino compute limitation?


Code: [Select]

#include <EnableInterrupt.h>
#include <Servo.h>


/*


Inspiration from here:


https://subcommittee.com/forum/archive/index.php/t-32808.html


How  Futaba multiprop 4+4 looks like:


https://www.hobbydirekt.de/Manufacturer/Robbe2/Robbe/Zubehoer/MULTI-PROP-4-4-MODUL-Robbe-1-8039-8039::79395.html?language=en
 
 */
 


#define AUX_IN_PIN A4 //input pin for the correspondent multiprop channel (in my case, CH6 -> A4);


volatile uint8_t current_output = 0;
volatile uint16_t unAuxInShared;
volatile uint32_t ulAuxStart;
volatile uint8_t output_ready;
volatile int multi_output[9]; // Array that holds effective RC reading from multiprop;


int outputA_pins[8];
int outputB_pins[8];


Servo servos[4]; // only 4 servo, 1 per each prop, only one servo used in my experiment


int crnt_state_A = 1;   // 0  1  2  for three state switch
int prev_state_A = -1;


int upper_state_A = 0;  // 0 or 1, on or off
int lower_state_A = 0;


void setup() {


 //set current default values for servo settings
  crnt_state_A = 1;  //0, 1, or 2  vals for 3 position switch
  prev_state_A = 1;
  upper_state_A = 0;  // 0 or 1, on or off
  lower_state_A = 0;
 
Serial.begin(57600);


// Init array of output pins
// 1-4 Props
// 5-8 - (3 Position Switches)


// Primary function array, includes both switched and props


outputA_pins[1] = 4; //Prop 1
outputA_pins[2] = 0; //Prop 2
outputA_pins[3] = 0; //Prop 3
outputA_pins[4] = 0; //Prop 4
outputA_pins[5] = 7; // Switch 1
outputA_pins[6] = 0; // Switch 2
outputA_pins[7] = 0; // Switch 3
outputA_pins[8] = 0; // Switch 4


// Secondary function array, includes only switches


outputB_pins[1] = 0; //Prop 1 - not used, reserved for 2 switching function
outputB_pins[2] = 0; //Prop 2 - not used, reserved for 2 switching function
outputB_pins[3] = 0; //Prop 3 - not used, reserved for 2 switching function
outputB_pins[4] = 0; //Prop 4 - not used, reserved for 2 switching function
outputB_pins[5] = 8; //Switch 1
outputB_pins[6] = 0; //Switch 2
outputB_pins[7] = 0; //Switch 3
outputB_pins[8] = 0; //Switch 4


// assign output pins


for (int outputnum = 1; outputnum < 9; outputnum++) {
pinMode(outputA_pins[outputnum], OUTPUT);
pinMode(outputB_pins[outputnum], OUTPUT);
}


//set up the array of switch and servo objects, and init switch to LOW and servo to a "centered" position


for (int outputnum = 1; outputnum < 9; outputnum++) {


if (outputnum > 4) {
digitalWrite(outputA_pins[outputnum], LOW);
digitalWrite(outputB_pins[outputnum], LOW);
}
else {


multi_output[outputnum] = 1500;
servos[outputnum].attach(outputA_pins[outputnum]);
servos[outputnum].writeMicroseconds(multi_output[outputnum]);
}


}


unAuxInShared = 0;
output_ready = 0;


//attach an interrupt to the RX input pin of the multiprop 4 + 4


enableInterrupt(AUX_IN_PIN, calcAux, CHANGE);


}


void loop() {
 
// put your main code here;


int outputnum = 0;


//if the interrupt routine flag is set, print multiswitch values;


//if (output_ready == 1) {
 
//  for (outputnum = 1; outputnum < 9; outputnum++) {


//      Serial.print(outputnum);
//      Serial.print("/");
//      Serial.print(multi_output[outputnum]);
//      Serial.print(" ");
//      }
//Serial.println();
//delay(500);
//}


//if the interrupt routine flag is set, we have a set of servos to move


if (output_ready == 1) {
for (outputnum = 1; outputnum < 9; outputnum++) {


if (outputnum == 5) { 
 
  // I only use one switch to light two distinct led circuits, position 5
 
if ((multi_output[outputnum] >= 1020) && (multi_output[outputnum] <= 1070)) {
 
  // switch upper position  - crnt_state_A = 2


crnt_state_A = 2; 
if (crnt_state_A != prev_state_A){
  if (upper_state_A == 1){
    upper_state_A = 0;
  }else {
      upper_state_A = 1;
  }
    prev_state_A = crnt_state_A;   
    }
  }
 
if ((multi_output[outputnum] >= 1940) && (multi_output[outputnum] <= 1980)) {
 
  // switch lower position  - crnt_state_A = 0


    crnt_state_A = 0;
    if (crnt_state_A != prev_state_A){
      if (lower_state_A == 1) {
        lower_state_A = 0;
      } else {
        lower_state_A = 1;
      }
      prev_state_A = crnt_state_A;
    }
}


if ((multi_output[outputnum] >= 1480) && (multi_output[outputnum] <= 1540)) {
 
  // switch middle(neutral) position  - crnt_state_A = 1


    crnt_state_A = 1;
    prev_state_A = 1;
}


//check the on/off state and act


if (upper_state_A == 1) {
 
    digitalWrite(outputA_pins[outputnum], HIGH);
    }
else
                        {
    digitalWrite(outputA_pins[outputnum], LOW);
    }


if (lower_state_A == 1) {
 
    digitalWrite(outputB_pins[outputnum], HIGH);
    }
else
                        {
    digitalWrite(outputB_pins[outputnum], LOW);
    }


}
 
if (outputnum > 5) {
if ((multi_output[outputnum] >= 1020) && (multi_output[outputnum] <= 1070)) {
digitalWrite(outputA_pins[outputnum], HIGH);
}
if ((multi_output[outputnum] >= 1940) && (multi_output[outputnum] <= 1980)) {
digitalWrite(outputB_pins[outputnum], HIGH);
}
if ((multi_output[outputnum] >= 1480) && (multi_output[outputnum] <= 1540)) {
digitalWrite(outputA_pins[outputnum], LOW);
digitalWrite(outputB_pins[outputnum], LOW);
}
}


if (outputnum == 1) {
servos[outputnum].writeMicroseconds(multi_output[outputnum]);


// I only use one Prop to drive a servo, position 1
}
if (outputnum == 2) {
//servos[outputnum].writeMicroseconds(multi_output[outputnum]);
}
if (outputnum == 3) {
//servos[outputnum].writeMicroseconds(multi_output[outputnum]);
}
if (outputnum == 4) {
//servos[outputnum].writeMicroseconds(multi_output[outputnum]);
}


}
output_ready = 0;
}
}




void calcAux()
{
if (digitalRead(AUX_IN_PIN) == HIGH)
{
ulAuxStart = micros();
}
else
{
unAuxInShared = (uint16_t)(micros() - ulAuxStart);
current_output++;


//if the servo positioning value is outside the normal range,
//we have a "sync" signal, reset the array index


if (unAuxInShared < 1000 || unAuxInShared > 2000) {
current_output = 0;
output_ready = 1;
}


if (current_output < 9) {
multi_output[current_output] = unAuxInShared;
}
}
}


Video here: https://www.youtube.com/watch?v=H5iZuez7L78

Thank you.

Bogdan

Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 966
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine

Hi Bogdan,

I had a very quick read of your post - I will have a more in depth read later.

Suggestions:

1. Use a 4.8v battery to power the servo - I think I can see you are using a breadboard PSU - not sure of the spec and what current it can supply instantaneously - and certainly don't power the servo from the Arduino itself

2. Move away from the servo library(it's not great!!!) - try VarSpeedServo library instead ( think you may be having Timer 2 clash  - used for both the interrupt timer and servo library)

3. Don't update the servo position every loop - this is always likely to cause jitter as values differ very slightly each loop - put it in a function call that only triggers with a time interval  suggest 250ms (see below)

https://rcarduino.freeforums.net/thread/101/interval-timer-code-functions-intervals

There will always be a slight delay using that multi-channel setup as the commands follow each other serially on one RC channel so you have to wait for the next instance of the  value before you can take action - hence slight delay


Regards
C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

tsenecal

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 403
  • Location: Arvada, Colorado, USA

Bogdan,

there is a reason that futaba/robbe themselves always indicated that the multiprop/multiswitch outputs weren't to be used on primary control surfaces.   as C3PO states, the refresh rate for the servos running via the mutliprop output is never going to be faster than 5 times per second.  C3PO actually recommends 4 times per second.  it will never be as fast as a "normal" servo.  Go with what C3PO recommends.   basically you will need to use a "better" servo library, and "smooth" the values.   "data" coming across the rf is quite noisy.
Logged

BogdanM

  • Shipmate
  • *
  • Offline Offline
  • Posts: 10
  • Model Boat Mayhem is Great!
  • Location: Bucharest

Thank you Tim and C3PO.


So far, I tested with different power supply(4.8V radio power pack), it eliminates some of the jitter(small uncontrolled back and forward movements) but the lag/delay is still there.
Lag means, in my experiment, when I move the rotary knob constantly, the servo glitches and stays always behind my control.


Anyway, I will try what you proposed and get back here.
I saw that others suggest to interpolate values using multimap function, I am not sure how to do it but I will try it.
Here:
https://forum.arduino.cc/index.php?topic=529306.0




Thank you once more, really appreciate.


Bogdan
Logged

tsenecal

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 403
  • Location: Arvada, Colorado, USA

Bogdan,

i fear that the link you are looking at will only increase the delay...

this link might provide some insight, starting with post #13

https://forum.arduino.cc/index.php?topic=405092.0

however, i would not follow their recommendation of "switching off" the servo, the last few posts are either settting the PWM output to off, or switching the arduino pin to input instead of output.  what that is doing is basically shutting off the power to the servo, at which point the servo has no capacity to hold its position.
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 966
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine

Hi Bogdan,

My brain was not 100% in gear earlier - a common state these days :)

What brand and model servo are you using? Does it have a published "Dead Band Width"? - Not all servos are born equal - you may find just changing the servo changes the situation.

Secondly - when you read out the multi channel values from the receiver, if you debug print them and increment a proportional channel very slowly do they increment /decrement by a value of 4 or 5 us in the main?

The Arduino micros() has a precision of only 4us which could well be a source of jitter introduced not as you drive the servo but as you read the raw multi channel signal output from the RX

I have been playing with a UHF transmitter and the stream of channel data out of the trainer port on my 2.4GHz radio can be seen to increment in single ms (numbers 900 - 2100)  - the routine I was using to catch this data was interrupt driven and using micros() - I had serious jitter on my servos at the other end of the solution.

I now have a routine that keeps track of time to a precision of 0.5us. and I can see the channel values change by an increment or decrement of 1 us - and super smooth servos!!!

Regards
C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

BogdanM

  • Shipmate
  • *
  • Offline Offline
  • Posts: 10
  • Model Boat Mayhem is Great!
  • Location: Bucharest

Hi C3PO,

I tried those 3 solutions provided earlier with no luck. I would describe the servo movement more like jerky....See below another video.

The servo I'm using it's a brand new Futaba S3003 but I  also have a no name one which behaves the same.

"I now have a routine that keeps track of time to a precision of 0.5us. and I can see the channel values change by an increment or decrement of 1 ms - and super smooth servos!!!" - How? {:-{

Another video here: https://youtu.be/Ih1qeHO9-W0


Thank you.


Bogdan
Logged

BogdanM

  • Shipmate
  • *
  • Offline Offline
  • Posts: 10
  • Model Boat Mayhem is Great!
  • Location: Bucharest

Hi C3PO,

and the terminal output...Looks strange cause I was moving as slow as I could but data si incremented with 50, 100 and more. See first pulse.
No wonder the servo responds like that... What's happening?



1/1056 2/1056 3/1056 4/1068 5/1520 6/1520 7/1520 8/1520
1/1204 2/1060 3/1060 4/1060 5/1516 6/1520 7/1520 8/1516
1/1332 2/1060 3/1060 4/1056 5/1520 6/1520 7/1516 8/1520
1/1400 2/1060 3/1060 4/1060 5/1516 6/1520 7/1520 8/1520
1/1448 2/1056 3/1056 4/1060 5/1520 6/1516 7/1520 8/1520
1/1488 2/1060 3/1060 4/1060 5/1520 6/1520 7/1516 8/1520
1/1528 2/1060 3/1060 4/1060 5/1516 6/1516 7/1520 8/1516
1/1596 2/1060 3/1056 4/1060 5/1520 6/1516 7/1520 8/1520
1/1628 2/1060 3/1060 4/1060 5/1520 6/1520 7/1520 8/1516
1/1696 2/1060 3/1060 4/1060 5/1516 6/1520 7/1520 8/1516
1/1820 2/1056 3/1056 4/1060 5/1516 6/1520 7/1520 8/1520
1/1848 2/1060 3/1060 4/1056 5/1520 6/1520 7/1520 8/1516
1/1960 2/1060 3/1060 4/1060 5/1516 6/1520 7/1520 8/1520
1/1960 2/1060 3/1060 4/1056 5/1520 6/1520 7/1516 8/1520

Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 966
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine

Hi Bogdan,
I notice that channel 1 does increment significantly if you are adjusting the pot very slowly. I do have a set of F14 & Mutli Prop hardware - at some point I might get a chance to fire it up and take some measurements.

I think the sizeable increment might be how this hardware setup works - I would take note of Tim's comment below

Quote
there is a reason that futaba/robbe themselves always indicated that the multiprop/multiswitch outputs weren't to be used on primary control surfaces

Can you not use one of the "normal" channels for your proportional control? It might help us to help you if you detailed your control requirements and how they map to your radio channels

I also notice that for example you can see the jump of 4us ( I am guessing when no changes are being made on the RC handset) on the other channels which relates to my previous post and the precision of the micros() command

Try this code below to read the multi channel stream - if it works you can the incorporate it into your solution.

Code: [Select]
#define ppmPin 2

const int channelAmount = 8;
volatile unsigned long rawValues[channelAmount];
uint16_t pulse = 0;
volatile byte pulseCounter = 0;


void setup_timer1() {
  //WGM -> Fast PWM
  //Prescaler -> 1/8
  //Compare Output Mode - > non-inverting mode
  //Input capture interrupt enable
  TIMSK1 &= ~( _BV(TOIE1) | _BV(ICIE1) | _BV(OCIE1A) | _BV(OCIE1B));
  TCCR1B &= ~(_BV(ICNC1));
  TCCR1A |= _BV(WGM11) | _BV(WGM10) | _BV(COM1A1) | _BV(COM1B1);
  TCCR1B |= _BV(WGM12) | _BV(WGM13) | _BV(ICES1);
  TCCR1B |= _BV(CS11);
  TCCR1B &= ~( _BV(CS12) | _BV(CS10) );
  TCCR1A &= ~( _BV(COM1A0) | _BV(COM1B0));
  TIMSK1 |= (1 << ICIE1);
  OCR1A = 0xFFFF;
  OCR1B = 0x0;
}

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

void loop()
{

  for (int i = 0; i < 8; i++)   //display all channels
  {
    Serial.print((rawValues[i] / 2));
    Serial.print("  ");
  }
  Serial.println();
}


ISR(TIMER1_CAPT_vect) {

  // ICR1 - time ISR Triggered
  static unsigned int lastICR; // Input Capture Register - icr at last caputre
  uint16_t pulse;

  pulse = ICR1 - lastICR;
  lastICR = ICR1;

  if (pulse > 5000)
  { //pulse too long, means start of new frame
    pulseCounter = 0;
  }
  else if (pulse > 1000)
  {
    //pulse good, take reading, go to next channel
    if (abs((rawValues[pulseCounter] - pulse)) > 3)
    {
      rawValues[pulseCounter] = pulse;
    }
    if ( pulseCounter < 8)
    {
      pulseCounter++;
    }
  }
  else {
    //too short, nothing to see here
  }

}

Regards
C-3PO
Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

BogdanM

  • Shipmate
  • *
  • Offline Offline
  • Posts: 10
  • Model Boat Mayhem is Great!
  • Location: Bucharest

Hi C3PO,


I have moved the wire from the receiver to digital pin 2 (#define ppmPin 2) but I do not receive any data.


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


I really do not understand the interrupt code, I recall that Tim said that multiprop train of signals its not PPM but PWM. Are you sure that this code its for Futaba Multiprop?


Thank you.


Bogdan
Logged

C-3PO

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 966
  • I thought that hairy beast would be the end of me
  • Location: Outer Rim world of Tatooine

Hi Bogdan,

That's an impressive fail with my code - sorry :(

I have never actually seen the format of the signals that comes out of the beastie but i'll put them on a scope later

I will fire up my F14 with multi everything and come back to you with my findings

Regards

C-3PO

Logged
I think it's the way I have learnt most of my stuff - getting very stuck first...

BogdanM

  • Shipmate
  • *
  • Offline Offline
  • Posts: 10
  • Model Boat Mayhem is Great!
  • Location: Bucharest

C3PO and Tim, thank you so much for your patience and expertise.


F14 is the best, I will buy another one, besides the OTW submarine, i also have 2 Robbe boats.





Logged

BogdanM

  • Shipmate
  • *
  • Offline Offline
  • Posts: 10
  • Model Boat Mayhem is Great!
  • Location: Bucharest

Here are 2 videos to illustrate right now the differences in performance between servo directed connected to Arduino and through a Robbe Multi Prop Decoder(F1516), the operation of the servo is smooth and continuous with Robbe decoder.
The ultimate achivement is to replace both the Robbe decoder and Robbe duo switch (MEMO) with Arduino and have more room/space  in the WTC.


Without Robbe decoder:


https://youtu.be/Za33gqwI6eM


With Robbe decoder:


https://youtu.be/1VgjbUd9dcs


Bogdan
Logged

BogdanM

  • Shipmate
  • *
  • Offline Offline
  • Posts: 10
  • Model Boat Mayhem is Great!
  • Location: Bucharest

Hi Bogdan,

I had a very quick read of your post - I will have a more in depth read later.

Suggestions:

1. Use a 4.8v battery to power the servo - I think I can see you are using a breadboard PSU - not sure of the spec and what current it can supply instantaneously - and certainly don't power the servo from the Arduino itself

2. Move away from the servo library(it's not great!!!) - try VarSpeedServo library instead ( think you may be having Timer 2 clash  - used for both the interrupt timer and servo library)

3. Don't update the servo position every loop - this is always likely to cause jitter as values differ very slightly each loop - put it in a function call that only triggers with a time interval  suggest 250ms (see below)

https://rcarduino.freeforums.net/thread/101/interval-timer-code-functions-intervals

There will always be a slight delay using that multi-channel setup as the commands follow each other serially on one RC channel so you have to wait for the next instance of the  value before you can take action - hence slight delay


Regards
C-3PO




I looked back to your recommendation of using VarSpeedServo library instead of servo one and i have interesting and positive results.

What i did to resolve the intermittent movement of the servo was to slow down the servo, using the library, by a fifth like this:

servos[outputnum].write( map(nonISR_output[outputnum], 1000,2000, 0, 180), 51);

Servo now moves slower but continuous. I will try to improve the code by using timers and port manipulations.

Thank you so much C-3PO and Tsenecal.

Regards, Bogdan
Logged
Pages: [1]   Go Up