Simple servo sketch killed two Photons

I have a sketch I’m running to toggle this servo from one position to another.

Servo coopDoor;
bool coopOpen;

void setup()
{
   Particle.function("toggleDoor", toggleDoor);

   coopDoor.attach(D0);
   coopDoor.write(0);
   coopOpen = false;
   pinMode(D7, OUTPUT);
}

int toggleDoor(String command)
{
  if (coopOpen) {
    closeDoor();
  } else {
    openDoor();
  }
}

void openDoor()
{
  coopDoor.write(90);
  coopOpen = true;
  delay(500);
}

void closeDoor()
{
  coopDoor.write(0);
  coopOpen = false;
  delay(500);
}

void loop(){}

One of the Photons doesn’t even light up when plugged in and the second has a constant white light. Both are getting very hot directly above the Setup button.

image

I’m assuming both these boards are ruined. Any advice on what to change, so I don’t ruin additional boards?

Thanks in advance!

Hi @nickhough

That area of the Photon is where the voltage regulator is located. Some folks have blown that and then successfully replaced it, but you would have to have a hot-air rework station in my experience.

How are you powering that ginormous servo and the Photon? I suspect very strongly that you are drawing too much current through the Photon board and that has done the damage.

Hi @bko -

Thanks for the prompt response. I have it wired up per one of the Particle examples:

I’ll order some new Photons, as I don’t have faith in my abilities to replace those components. I’ll do some searching for an example that powers the servo separate from the Photon.

Thanks for the info!

As @bko suggested, wiring the servo like this (and assuming - since not shown) that you are powering the setup through USB the stress on the regulator and/or protection diode was too much.

The regulator does also not like a noisy supply voltage (could be caused by the servo too). The noise might cause the regulator to oscillate and drive it into suicide.

For that you need to make sure to have common ground for servo and Photon.
But when you supply power to both (servo and Photon) through Vin and also add some filtering and buffering caps on the supply lines you should be good.

Hi @ScruffR -

Thanks for the advice. I found this post and was able to get it working with a Spark Core. Time to get another stash of Photons. :slight_smile:

I wired it as shown below, with the exception of putting the cap across the power/ground strip, as recommended by @peekay123 in the post referenced above.

Thanks again for the help fellas, much appreciated!

3 Likes