Congratulations DJ Sures, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Autoposition - Dc Motors & Servos

Assistance Requested

Help Dave Schulpius with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

Dave Schulpius claims to have checked these sources:

I have to admit I have not tried the AutoPosition control. It's still a bit of a mystery to me but I plan on diving into it in a few days. I've been focused on building a 7 pound arm with 4 joints for my B9 Lost in Space robot. I've now got it working smoothly; twisting and turning and lifting the weight.

The first "elbow joint" lifts all the weight and only moves in the up and down direction. It's powered by a DC motor, feedback is a potentiometer and is controlled by a Sabertooth/Kangaroo with serial commands being sent through V4 EZB's Uart port.

The Second and third joints; The "wrist up and down joint" is powered by a Servo City Servo powered Gearbox. It's lifting the 3 pound claw section. The Gearbox is then directly attached to a Standard Servo for the horizontal wrist movement.

The last and 4th joint is the Claw "open and close" joint. This is powered by a mini servo.

So far I've just been writing crude test movement scripts with servo position and speed commands for the servos and serial Uart commands to the Kangaroo for the DC motor.

I'm wondering if I can include the serial Uart commands to the Kangaroo in the AutoPosition control to get the whole arm to move as one. I fear I'll have to build the frames in the Autoposition for the servos and the elbow's dc motor serial movement commands in a separate script. *confused*

Thanks in advance for any insight into this! I'm looking forward to this challenge. Hopefully with a little help I can have this arm moving around like a snake very soon. Smile

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.

Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


The auto position conyrol works with servos, it will not work with kangaroos. That sounded funny to type. No kangaroos Smile


@Dave... As DJ mentioned, the auto positioner runs servos only... However indirectly, you might be able to have scripts (to control your Kangaroo) run at predetermined points as the auto position control runs your servo movements... Actions can run scripts so you could have an action run a servo movement and then that action can run a script (which would include your serial/Uart kangaroo code)... See the Action part of the auto positioner control to see what I mean...


Thanks guys. It's kinda what I thought. I'll probably start the DC motor moving with a script and in the same script start the auto position .


You can create a script that moves the motor into a position based upon the potentiometer (like you did with the waist of your B9). The variable that you will use to determine the position can be a Virtual Servo (Any of the Vx servos).

That way the Auto Position will set the servo Vx and your script will move and monitor the DC Motor into the position.

Essentially, you will be creating a "virtual servo".

Your last option is to connect a servo PCB to a larger HBridge that moves your DC Motor with a potentiometer - and actually make it a real servo.


Sweet! Thanks DJ. Tongue This is just want I needed. You make this stuff seem so easy. Do you use smoke or mirrors?


lol - thanks Dave Smile


PS, here's an idea of what your virtual servo script would look like...





# 0.7058823529411765 = 180 servo positions divided by 255 (8 bit adc)
$fakeServoPos = round(getADC(0) * 0.7058823529411765, 0)

IF ($fakeServoPos = GetServo(v0))

# We are at the correct position so exit the inner loop

ELSEIF ($fakeServoPos < GetServo(v0))

# Move HBridge to the right because we are less than the specified degrees
Set(d0, on)
Set(d1, off)


# Move HBridge to the left because we are greater than the specified degrees
Set(d0, off)
Set(d1, on)





Thanks again @DJ. Your such a help to us. Don't know what we'ed do if you started moving away from your hands on approach.

For some reason I didn't see the last post with your script till now (5 days later). It looks like just what I needed. I'm truly thankful for your help. Smile