Software Archive
Read-only legacy content
17061 Discussions

Edison Crashes when using Servo

David_C_9
Beginner
385 Views

Hello,

I followed Rex's Grove Starter kit and then decided to add a little bit more complexity to it to do more interesting things.  I have the rotary sensor controlling the servo.  The code itself works great for a while until it eventually crashes.  Full symptoms are: Program stops responding to analog input, followed by the wifi appearing to shut down temporarily.

I have attempted increasing the detection to every .25 seconds, which made the issue worse.  Decreasing the time to .05 seconds seems to work better-ish.  I use cylon.js.

every((.05).second(), function() {
var nAngle = parseInt(robo.rotary.analogRead() / 5.6);
var aDelta = nAngle - robo.servo.currentAngle();
if(aDelta > 7 || aDelta < -7 && nAngle > 5 && nAngle < 175)
{
robo.servo.angle(nAngle);
}
});

I have the analog connected to A0 and the servo connected to D3.  I currently have nothing else connected.  The switch is set to 5V.  It seems to die immediately on 3v3.

Any ideas what the issue might be?  Do I need more power?

0 Kudos
1 Reply
Stewart_C_Intel
Employee
385 Views

Measure the voltage rails, its likely the Servo is needing more power than the 5V regulator can supply, especially if it stalls.

 

0 Kudos
Reply