stop power on a servo

Forums:

Hello,

just received my UB, connected und got it running in less then 15 minutes. Awesome :-)
I noticed that after UB.SetServoPosition1(Value) servo is permanently under power. How can i stop power (to save battery) for servo like i do
with RPIO:
servo.stop_servo(GPIO Number)
OR
Rpi
GPIO ...
p = GPIO.PWM(GPIO Number,Number)
p.start(0)
ChangeDutyCycle...
p.stop()
GPIO.cleanup()

Kind regards
dirk

PS: and how can i get and install Tix which is needed for ubTuningGui.py

piborg's picture

Unfortunately UltraBorg cannot turn off the output to the servo completely, often known as tri-stating, like the Raspberry Pi can with its GPIO pins.

What you could do is connect a relay between the V+ terminal and the 5V supply.
This way you can disconnect the power from all of the servos at once.
The downside to this is when the power is off you will also be unable to read from any attached ultrasonic modules.

You can install Tix using this command:
sudo apt-get -y install tix
Tix should have been installed as part of the UltraBorg installer script, so you may need to check if any error messages are shown when trying to install it.

Hi piborg,

thanks for your quick answer. A relay should work, but after i reconnect power supply all servos will move to 0 position and not stay in her latest pos bevor i cutted power. Is there any way to workaround this for example by saving last pos. For now i did'nt read the whole manual (i shoud do that :-) and just used some code snippets.
For the Tix thing, i did'nt use the script, just imported UB...py in my scripts or started Tuning.py. Will install and test.
Thanks again
Dirk

piborg's picture

This should not be a problem if the 5V link is not in use.
When the UltraBorg has the 5V link jumper removed their are two separate 5V power lines:

  1. Logic 5V - Supplied from the Raspberry Pi GPIO
    This is used to power both the control chips and the I2C communication
  2. External 5V - Supplied from the V+ / GND screw terminals
    This is used to power the servos and the ultrasonic modules

When the external 5V is removed no power is provided to any of the servos or ultrasonic modules.
The chip which drives the servos is still powered though, retaining the current position status.

When the external 5V is connected again the drive chip should start providing power to the servos again, with the last values set from software.

If the logic 5V from the Raspberry Pi is disconnected then the drive chip powers off and the servos are no longer being driven.
In this state the memory in the chips gets cleared, so they no longer remember what anything was set to.

When the logic 5V is reconnected both chips go through their start-up sequences.
This causes the start-up positions to be read from the EEPROM, which are then the positions the servos get set to.

In other words the servos are only powered as long as both 5V supplies are connected.
If the eternal 5V is the only one disconnected then the set positions should be retained when the power is reconnected.

Alternatively it is also possible to save the current position as the start-up position.
This will mean that when the chips start-up they will move back to that position.
This is how the start-up position is set in the tuning GUI.

Hi,

i have it running using a relay. It's a saintsmart (2 Channel) 220V and i think it's overkill for what i'm doing.
http://ras-pi.de/2014/07/relaisboard-per-raspberry-schalten/ (just in german)
Do you have any recommendation for a low voltage relay, which could directly connected to GPIO? Maybe this is the wrong place for that question,but ...

Many thanks for your help and
kind regards
Dirk

piborg's picture

Whilst a 220V relay capable board is a bit overkill for this, driving a relay directly from the Raspberry Pi GPIO is probably not a great idea.

The reason for this is that any GPIO pin can only really handle a drain of 16mA.
It is fairly likely that even a low voltage relay will take more than that.
Source: http://www.mosaic-industries.com/embedded-systems/microcontroller-projec...

You can wire a relay up using a transistor yourself, there are plenty of pages on the web explaining how to do this.
Alternatively you could get a pre-made board to either drive some relays or that has relays onboard, but since you have a board working already it is probably easier to stick with the one you have.

Subscribe to Comments for "stop power on a servo"