My trouble happens when I turn the power off.

and come back the next day.
Board is a Feather ESP32 and the sketch is the example Servo.
Sketch has been modified to only control servo number 8 (7 in the sketch).

My humble noobie opinion is that I might have to find better and isolated power sources.
For the advanced project, the SDA and SCL pins require 2 connections each. Would having 2 different SDA & SCL devices require a higher current draw ?

The sketch works fine when I start wiring the breadboard from scratch. I have an O-Scope attached instead of the servo as I wanted to see what the output looked like. It is a fluctuating (pulsing?) square wave.
The servo sketch is the basis for a more advanced project so I start with it working then add more devices and wires.
The additional devices are:

  1. BNO055 Absolute Orientation Sensor
  2. Adafruit's 9DOF (9 Degrees of Freedom) breakout board
    I add the devices and wires slowly until the circuit is complete, and it is still working, and I can see the square wave on the scope.
    So, I turn everything off and finish for the day.

The next day when I power it back up, I get a flat line on the scope.
I start removing the advanced project devices, 1 by 1, until it starts working. It takes my trying different things to get it to work properly. These are the different things I try until I get back to just the servo project.

  1. remove and re-insert the 5V USB connection from the PC. (Reboot it ?
    Advanced project devices and connections
  2. remove the SCL connection from the BNO055
  3. remove the SDA connection from the BNO055
  4. Reroute the 3,3v to the PCA9685

Eventually I get it to work again but the method is not always the same.
Maybe I will try and clean up the power and see what happens.

This is a complicated thing to describe or draw but I thought of another question somewhat related. Do the devices all come online at the same time so that their power requirements might result in a surge ?
I hope that doesn't sound stupid .
And thanks if this makes any sense to you.

  This is an example for our Adafruit 16-channel PWM & Servo driver
  Servo test - this will drive 8 servos, one after the other on the
  first 8 pins of the PCA9685

  Pick one up today in the adafruit shop!
  These drivers use I2C to communicate, 2 pins are required to  

  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);
// you can also call it with a different address and I2C interface
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40, Wire);

// Depending on your servo make, the pulse width min and max may vary, you 
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
#define SERVOMIN  150 // This is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  600 // This is the 'maximum' pulse length count (out of 4096)
#define USMIN  600 // This is the rounded 'minimum' microsecond length based on the minimum pulse of 150
#define USMAX  2400 // This is the rounded 'maximum' microsecond length based on the maximum pulse of 600
#define SERVO_FREQ 50 // Analog servos run at ~50 Hz updates

// our servo # counter
uint8_t servonum = 7; <<--------------------------I changed this

void setup() {
  Serial.println("8 channel Servo test!");

   * In theory the internal oscillator (clock) is 25MHz but it really isn't
   * that precise. You can 'calibrate' this by tweaking this number until
   * you get the PWM update frequency you're expecting!
   * The int.osc. for the PCA9685 chip is a range between about 23-27MHz and
   * is used for calculating things like writeMicroseconds()
   * Analog servos run at ~50 Hz updates, It is importaint to use an
   * oscilloscope in setting the int.osc frequency for the I2C PCA9685 chip.
   * 1) Attach the oscilloscope to one of the PWM signal pins and ground on
   *    the I2C PCA9685 chip you are setting the value for.
   * 2) Adjust setOscillatorFrequency() until the PWM update frequency is the
   *    expected value (50Hz for most ESCs)
   * Setting the value here is specific to each individual I2C PCA9685 chip and
   * affects the calculations for the PWM update frequency. 
   * Failure to correctly set the int.osc value will cause unexpected PWM results
  pwm.setPWMFreq(SERVO_FREQ);  // Analog servos run at ~50 Hz updates


// You can use this function if you'd like to set the pulse length in seconds
// e.g. setServoPulse(0, 0.001) is a ~1 millisecond pulse width. It's not precise!
void setServoPulse(uint8_t n, double pulse) {
  double pulselength;
  pulselength = 1000000;   // 1,000,000 us per second
  pulselength /= SERVO_FREQ;   // Analog servos run at ~60 Hz updates
  Serial.print(pulselength); Serial.println(" us per period"); 
  pulselength /= 4096;  // 12 bits of resolution
  Serial.print(pulselength); Serial.println(" us per bit"); 
  pulse *= 1000000;  // convert input seconds to us
  pulse /= pulselength;
  pwm.setPWM(n, 0, pulse);

void loop() {
  // Drive each servo one at a time using setPWM()
  for (uint16_t pulselen = SERVOMIN; pulselen < SERVOMAX; pulselen++) {
    pwm.setPWM(servonum, 0, pulselen);

  for (uint16_t pulselen = SERVOMAX; pulselen > SERVOMIN; pulselen--) {
    pwm.setPWM(servonum, 0, pulselen);


  // Drive each servo one at a time using writeMicroseconds(), it's not precise due to calculation rounding!
  // The writeMicroseconds() function is used to mimic the Arduino Servo library writeMicroseconds() behavior. 
  for (uint16_t microsec = USMIN; microsec < USMAX; microsec++) {
    pwm.writeMicroseconds(servonum, microsec);

  for (uint16_t microsec = USMAX; microsec > USMIN; microsec--) {
    pwm.writeMicroseconds(servonum, microsec);


/*   <<-------  and I disabled the following 2 statements so that the servonum remains at 7.
  /* servonum++;
  if (servonum > 7) servonum = 0; // Testing the first 8 servo channels */

please explain how this problem suddenly occurs after almost all the development work has been done. When did it first occur? What was the last change before it started?


Yuck, a Fritzing thing. Oh well. Looking at your Fritzing thing, I do not see where an ESP32 is involved with...?

The ESP32 is NOT 5V tolerant.

Always power servos and motors from a separate power supply. A 4xAA battery pack will work for one or two servos.

Don't forget to connect the grounds.

Please post a clear photo of a hand-drawn sketch of your wiring, not a useless Fritzing diagram.