OneWire, DallasTemperature requesting temp causes led on ESC to blink

Hi!
I just started putting some code together for a ROV project I am doing with a Mega 2560 and ran into a problem. I have just begun adding some code to initialize and control my ESCs (Afro ESC 30A). After I have initialized the ESCs they show it by lighting up a green light.

The problem is when I request temperatures from my DS18B20 sensors some of the green lights on the ESC's blinks and there is a almost not noticeable buzzing sound. If I comment out the 4 lines everything works perfectly, no buzzing sounds and no blinking status leds on the ESCs.

Any ideas on what could be causing this or how I can proceed to troubleshoot?

Could my previous issue have anything to do with this? ds18b20 onewire - Sensors - Arduino Forum

I have attached my code.

Arduino 1.6.3
OneWire 2.3.2
DallasTemperature 3.7.6

ROV.ino (9.65 KB)

Perhaps disabling interrupts causes a delay for the Servo library.

This is the OneWire code : OneWire/OneWire.cpp at master · PaulStoffregen/OneWire · GitHub
I think the largest time that interrupts are disabled are 70us and 65us.

Pin 49 for the 1-Wire bus is okay, it is not a special pin.

There is nothing else that caught my attention.

I just had time to do a little more testing today, I started setting up communications to the sensors without using the Dallas library, I haven't managed yet to get the correct value in return because I didn't fully understand that bit of code but that's for another day to learn and fix. I wanted to try and see when it happens. If I comment out my oneWire select and writes there is no issue.

//oneWire.select(DevAddress[i]);
//oneWire.write(0xBE);

Tomorrow I will try to find some time to set up a couple of sensors with new wires to see if it got anything to do with the wiring.

I attached my current code.

ROV.ino (11.3 KB)

You where absolutely correct, I did some digging around and found other people having the same issue with one-wire and servo library.

I read this The Issue | Using NeoPixels and Servos Together | Adafruit Learning System. So I tried to use the Adafruit TiCoServo library instead but then I got another issue. According to the info I found out that I could use pins 2, 3, 5, 6, 7, 8, 11 and 12 (there are more but I only need 8) which are all on 16-bit timers (timer1, timer3, timer4 and timer5). The initializing seems to be successful but then they turn off again, so they don't seem to be getting a pulse. They all work fine using the servo library.

#include <Adafruit_TiCoServo.h>

Adafruit_TiCoServo esc[8];

const int escPin[] = {2, 3, 5, 6, 7, 8, 11, 12};

void setup(void) {
  Serial.begin(9600);
  initESC(true);
}

void loop(void) {

}

void initESC(boolean debug){
  delay(2000);
  
  const int escStopSignal = 1500;
  
  for(int i=0; i<8; i++){
    esc[i].attach(escPin[i]);
    esc[i].write(escStopSignal);
    if(debug){
      Serial.print("Sending stop signal to ESC: ");
      Serial.println(i); 
      delay(1000);
    }
  }
  
  delay(1000);
}

Don't know if I am gonna try and work this out or get a servo driver instead like this one: Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface [PCA9685] : ID 815 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits. I really don't need another component in the little space I have for them already but I'm not sure if I have the ability to find out if anything is wrong with the library.

*Edit: Noticed the first link was wrong