Take the 2-minute tour ×
LEGO® Answers is a question and answer site for LEGO® and building block enthusiasts. It's 100% free, no registration required.

I'm interested in mimicking the functionality of the Arqball Spin, at $60 it isn't cheap so I'd like to make the most out of my Mindstorms parts.

I'd like to use NXT-G to program a motor to rotate 360° in 20 seconds. NXT-G can only controll the power of the motor and duration (Unlimited, Degrees, Rotations & Seconds). The power of the motor can be set from 0 to 100 seemingly arbitrary values:

enter image description here

I don't mind using 3rd party software to program the motor, provided it's easy to use.

share|improve this question
1  
Do you have access to the Rotation Sensor at all? You might be able to do some internal calibration prior to the main run? –  Zhaph - Ben Duguid Jul 24 '12 at 11:15
1  
@Zhaph-BenDuguid Yes, I do, but it hasn't helped much. My motor is weak at low power (4-12-ish), it would turn at a reliable speed so I increased the power of the motor and added a small gear to power a larger one. –  Ambo100 Jul 25 '12 at 20:24

1 Answer 1

up vote 5 down vote accepted

The problem can be restated: 360 / 20 = 18 deg / sec = 1 deg / .056 sec

One degree is the smallest increment provided by the rotation sensors.

NXT-G has a timer sensor with 1/100th second resolution.

In pseudo-code:

Set a motorPower variable to 10
Start a timer
Loop until rotationDegrees >= 360
    If timeElapsed * 18 > rotationSensorDegrees
        motorPower = motorPower - 1
    Else
        motorPower = motorPower + 1
    End If
    MoveBlock (power = motorPower)
End Loop
MoveBlock (stop)

Of course, use of the 8 tooth and 40 tooth gears to give a 5 to 1 reduction would give even better results. Even the best programming will have trouble offsetting bad mechanics.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.