Kalman
Posts: 31
Joined: Mon Apr 22, 2013 3:38 pm
Location: Sweden

pigpio cleanup doesnt release gpio pin

Tue Jan 02, 2018 10:36 pm

Hi folks!
Needed to change an air-fan. Mowed/mounted over a lid regulating the airflow. The lid is turned by a servo motor. To find out the new positions I try to run a short tesprogram under Python3

First in terminalwindow I start the sudo pigpiod
Then start Python 3
Write commando after the pyton prompt>>>>
This is the program I wrote doing the same job.

import pigpio
pi = pigpio.pi() # Connect to local Pi.
pi.set_mode(12, pigpio.OUTPUT)
pi.set_servo_pulsewidth(12, 1550) #closed
pi.set_servo_pulsewidth(12,1400) #open a little
pi.stop()

Functions okey.
The problem is when pi.stop( )is executed the servomotor has small diminutive vibrations and the big problem is it doesn't release the motor. So I can not turn the lid by hand untill I shut of power from the engine. And after reconnected the power the lid/servomotor turns imidiatly back to the latest position.

What shall I write to avoid this?

I need to able to turn the lid/servomotor by hand, free it up, and the "main" program shall turn it to the next position where ever I have turned it. But let it wtay where I put it untill that time.
Some helping with this , maybee Joan?
Thank You.

pcmanbob
Posts: 7065
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: pigpio cleanup doesnt release gpio pin

Wed Jan 03, 2018 12:34 am

Most modern servos will hold the last posting they are instructed to move to, that's how servos are designed to work.
So no you cant turn them manually while power is still applied even after you stop sending them commands.

You may find a stepper motor is what you need as once you stop powering the individual coils you find you can turn it easily by hand.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

saltydog
Posts: 39
Joined: Mon Dec 24, 2012 10:40 am

Re: pigpio cleanup doesnt release gpio pin

Wed Jan 03, 2018 4:28 am

Set it to 0 (off)

Code: Select all

import pigpio
pi = pigpio.pi() # Connect to local Pi.
pi.set_mode(12, pigpio.OUTPUT)
pi.set_servo_pulsewidth(12, 1550) #closed
pi.set_servo_pulsewidth(12,1400) #open a little

pi.set_servo_pulsewidth(12,0)

pi.stop()

saltydog
Posts: 39
Joined: Mon Dec 24, 2012 10:40 am

Re: pigpio cleanup doesnt release gpio pin

Wed Jan 03, 2018 5:00 am

IIRC, pi.stop only cleans up the socket connection to the pigpio daemon, started when you created the instance pi = pigpio.pi()

Chris

saltydog
Posts: 39
Joined: Mon Dec 24, 2012 10:40 am

Re: pigpio cleanup doesnt release gpio pin

Wed Jan 03, 2018 5:32 am

Can you use a magnetometer to determine and set your current servo position?

Chris

User avatar
joan
Posts: 14352
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: pigpio cleanup doesnt release gpio pin

Wed Jan 03, 2018 8:20 am

The Python pigpio module does not change any user settings when pi.stop() is called. It does not try to double guess the user's intentions. The user must manually do any needed termination.

If you want to stop servo pulses set 0 (as mentioned by saltydog).

Kalman
Posts: 31
Joined: Mon Apr 22, 2013 3:38 pm
Location: Sweden

Re: pigpio cleanup doesnt release gpio pin

Thu Jan 04, 2018 3:36 pm

Thank You all for your patience with me. :)
I just forgot the:
pi.set_servo_pulsewidth(12,0)
It works now and free the lid and no "jitter"
Thanks.

Return to “General discussion”