Softserial affects servos?

My MEGA controls two servos at pins 10 and 11. I have tried to use SoftSerial to communicate two values from a NANO on pins 10 and 11 to the MEGA on pins 50 and 51. But each time I connect the serial wires (10 to 51 and 11 to 50) the servos start to oscillate about their commanded position about 15% either way. The oscillations seem regular not just random noise.

Why? Is it something to do with interrupts or internal timers used by the SoftSerial software interfering with the PWM to the servos? What should I do? I have Bluetooth serial on pins 18 and 19 and I2C to a sensor on pins 20 and 21.

I am sure its not just a loose wire or bad ground or noise. Both Arduinos are powered from the same 5v power supply.

That does sound like it could be an interrupt problem. I am just curious about this, why are you using soft serial and not one of the several hardware serials on the Mega?

I am limited by what serial is available on the NANO end. I also believe its an interrupt problem. I guess I will need to use the hardware serial on the NANO (pins 0 and 1) to one of the MEGA serials and disconnect when I need to program the NANO.

So now we know that Softserial and PWM can't coexist on the same board. It takes a lot of experimenting time to find out what libraries are compatible and find alternatives. Interrupts and internal timers should be specified for all libraries so we know what libraries can't coexist before wasting our time.

I am limited by what serial is available on the NANO end.

What? You don't have to use software serial at both ends you know. With three free serial ports on the Mega I can't see what the problem is.

Interrupts and internal timers should be specified for all libraries so we know what libraries can't coexist before wasting our time.

You tell em. All those people writing libraries just to trip you up.

The SoftwareSerial library is incompatible with the Servo library.

If you really do need to use the SoftwareSerial library (which seems unlikely on a Mega) you could try the ServoTimer2 library.

...R