Photon reboots every time I run servo. Did I fry my breadboard?

I’ve got a 3A servo hooked up to D0 on my Photon. It’s powered by a 5V power supply that also supplies power to the Photon.

It used to work really well, but now, every time I run a servo command, the Photon reboots itself. The function, itself, makes a beep on a piezo buzzer on D1, then is supposed to run the servo. It just never makes it to the servo–it beeps and beeps like it should but then reboots.

I’ve heard breadboards don’t always like handling 3A. Is this a symptom that I fried my breadboard?

Is your power supply rated for 3A+?
I’ve ran quite a bit more through it for LED strips, so 3A should be okay on a breadboard I think.

Yep, it’s a 5V, 3A power supply.

The (electrical) noise produced by the Servo might be tripping the Photon. Have you got some beefy caps on your supply rails?

1 Like

Did you change your code in any way since "it used to work"?

@ScruffR:

I guess it depends on how you define “beefy”. I have a 100uF electrolytic capacitor that came in the Maker Kit. Should I add more?

@peekay123:

Oh yes. I change it all the time. At one point, I had too many variables and functions for it to compile, so I brought it back down to just its core tasks while I figure out how to streamline it. It’s just the core tasks now. I’ve looked over the code and I see no reason why it would cause a reboot.

I should describe what’s happened a little better:

  • It used to work great
  • I tested out a new piece of code while I was away that accidentally ran the servo for like 3 hours straight
  • I then brought all the code back to just the core functions
  • I tried running the servo like normal and it worked okay
  • Tried it again and it ran shorter than it should’ve
  • Now the servo causes a reboot

To make sure there aren’t any complications due to the code, could you try running the example over here: https://docs.particle.io/reference/firmware/photon/#servo

The fact that it used to work, you then changed something after which it doesn’t work anymore, makes me thing it’s the ‘something’ you changed that causes the issue.

@Moors7:

90% sure it just had the same issue. I’m not at home, but I flashed it after adding:

Particle.publish(“activity”,“starting”);
to setup {}

and

Particle.publish(“activity”,“moving”);
to the loop

I flashed it and watched it in dashboard and kept getting
activity starting
activity moving
activity starting
activity moving

over and over…

This would suggest, that your offending code is in loop() after the moving-publish.
Try to find the offending instruction first and then see why this causes a reboot.

@ScruffR:

The code I used in that test was from the servo docs as Moors7 recommended. So the only thing in loop() was Particle.publish(), myservo.write() and delay()

Could it be that your servo is going harder (demanding more current) after your 3h permanent run or for some other reason?

I’m not sure. Any troubleshooting steps you’d recommend? I’m pretty new to all of this.

Try the code without the servo attached.
Try the code with the servo attached, but the servo control statements commented.
Add one by one back (in an order so that the code still builds).

2 Likes

It is a little bit unusual to run the servo and the micro controller off the same power supply. I would guess you were in a rather lucky condition for it to work in the first place, and now a slightly changed sequence of current demands from the servo is momentarily depriving the photon. Its also possible that the power supply is slightly derated. I would beef up the capacitors across the power right at the photon itself - a couple of 100uF - , and move the servo connections off the breadboard. If that doesn’t work, try powering the servo - or the photon - from a battery pack. For the record a breadboard should have no problem with 3A, but make sure the photon is secure in the breadboard as a glitchy power connection would also be revealed by the current demand from the servo.

@humphreyg: Just did as you recommended. The photon no longer reboots, but the servo doesn’t move. I replaced it with a different, 1A servo, which worked fine. Think maybe the servo shorted out?