Go to advanced search

by alphanerd132
Mon Nov 05, 2018 9:14 am
Forum: Python
Topic: controlling a servo.
Replies: 21
Views: 867

Re: controlling a servo.

The servo and Pi need a common ground reference so they can agree on the GPIO level. So you have to connect one of the ground pins on the expansion header (e.g. pin 6) to the servo ground. The most convenient place might be the ground at the servo power supply end. If you were using a battery to po...
by alphanerd132
Mon Nov 05, 2018 8:48 am
Forum: Python
Topic: controlling a servo.
Replies: 21
Views: 867

Re: controlling a servo.

joan wrote:
Mon Nov 05, 2018 7:36 am
When you use software PWM it will twitch.

One thing which would cause erratic behaviour is not having the Pi ground and servo ground connected.
OHH I can see that, I don't have central grounding at my place.
by alphanerd132
Mon Nov 05, 2018 5:47 am
Forum: Python
Topic: controlling a servo.
Replies: 21
Views: 867

Re: controlling a servo.

Certainly a servo. It's digital which means it can probably accept pulse rates higher than 50Hz, but it should still accept 50Hz. I'm at a loss to know why it's misbehaving. Okay. I did fix the code with while and it fixed the issue for it not responding. But the question is why? I thought IF and W...
by alphanerd132
Sun Nov 04, 2018 7:21 pm
Forum: Python
Topic: controlling a servo.
Replies: 21
Views: 867

Re: controlling a servo.

joan wrote:
Sun Nov 04, 2018 7:17 pm
Are you sure it's a servo? Sounds more like a stepper motor. Can you link to the specs?
https://www.amazon.com/gp/product/B073M ... UTF8&psc=1

I doubt it's a stepper motor based on the sheer torque of the thing. I can't move it by hand when it's turned on.
by alphanerd132
Sun Nov 04, 2018 7:14 pm
Forum: Python
Topic: controlling a servo.
Replies: 21
Views: 867

Re: controlling a servo.

Okay, a couple of things wrong with the code. import RPi.GPIO as GPIO import time GPIO.setwarnings(False) # if you want, this will get rid of all warnings servoPIN=14 aod = 2.5 GPIO.setmode(GPIO.BCM) GPIO.setup(servoPIN, GPIO.OUT) p = GPIO.PWM(servoPIN, 50) #GPIO 14 for PWM with 50Hz p.start(2.50) ...
by alphanerd132
Sun Nov 04, 2018 6:53 pm
Forum: Python
Topic: controlling a servo.
Replies: 21
Views: 867

Re: controlling a servo.

I'll run the code on a Pi later on to see what it actually is doing. The best way to drive one or two servos on the Pi is with the PWM hardware (GPIO 12/13 or GPIO 18/19). To do that you need to find software to put those GPIO in PWM mode etc. The second best way is to use hardware timed PWM such a...
by alphanerd132
Sun Nov 04, 2018 6:20 pm
Forum: Python
Topic: controlling a servo.
Replies: 21
Views: 867

Re: controlling a servo.

I really dislike driving servos using dutycycle as the model. The root problem is you need to default aod to 2.5 rather than zero. You are setting the dutycycle percentage to 1%. At 50 Hz that equates to a pulse width of 200µs which is way out of the safe servo range of 1000 to 2000. You can quickl...
by alphanerd132
Sun Nov 04, 2018 6:07 pm
Forum: Python
Topic: controlling a servo.
Replies: 21
Views: 867

Re: controlling a servo.

It's best if you post the complete script. It sounds like you are using RPi.GPIO. That uses software PWM so it should certainly stop once the script is exited. import RPi.GPIO as GPIO import time #GPIO.setwarnings(false) if you want, this will get rid of all warnings servoPIN=14 aod = 0 GPIO.setmod...
by alphanerd132
Sun Nov 04, 2018 8:38 am
Forum: Python
Topic: controlling a servo.
Replies: 21
Views: 867

Re: Basic question

If GPIO.cleanup is not working try, software, disconnecting from the servo torque engine, such as setting the oTorque = None and then sending a 0 to the pin the servo is connected to, before exiting. How would you go about doing such? Would you just change the ".ChangeDutyCycle(0)" to 0 or is there...
by alphanerd132
Sun Nov 04, 2018 1:23 am
Forum: Python
Topic: controlling a servo.
Replies: 21
Views: 867

controlling a servo.

I am just starting out with python/pi, my question today is, how do you make a pin stop sending output? I am trying to use servos with the pi but even after I use a GPIO.cleanup() it still sends a signal to my servo. This normaly isn't an issue but i'm using high torque servos and it will rip the se...

Go to advanced search