4

The motor is attached to a "door", which rotates to block off an opening. I have it coded to manually go back 1/4 of a rotation, and the distance sensor attached will send it forwards 1/4 of a rotation. However, if it gets triggered twice, then it has to be triggered another two times in order to get back to the default position. I would like to avoid this. I am coding on a laptop, and there is no block that I have seen that can do this. Is this possible, or did I just miss the block?

enter image description here

2
  • 2
    Please add the code you have issues with.
    – Alex
    Jan 5 at 17:21
  • Done. I have edited the post.
    – BJF
    Jan 5 at 21:19

3 Answers 3

3

Expanding on @zovits approach for a rubberband-based mechanical system: I'll suggest something like the following diagram, adding a rubber band between the bush and the belt wedge wheel:

CAD drawing of rubberband mechanism

That can technically be called a friction clutch. With something like that, it's possible to keep the motor turning more than needed: when the cyan liftarm hits the red corner beam, the axle will block and the rubber band will absorb the excess rotation (by means of slipping on the yellow bush).

In order to minimize wear&tear, you should adjust the rubberband tension so it provides just enough grip, but can slip easily.


A similar approach is to use 60c01 Technic, Gear 24 Tooth Clutch or 6542 Technic, Gear 16 Tooth with Clutch:

24-tooth gear with clutch

I don't own any such pieces, and therefore I don't know how well they stand wear&tear - I'd recommend a rubberband just for the ease of finding replacements.


Another approach is to use a linear actuator:

CAD drawing of linear actuator mechanism

A technic linear actuator has a built-in clutch, so will absorb extra rotation as well. That means you can run motor more than needed to get them into a known state (either fully retracted or fully extended).

By building an assembly as shown above (and securing both the motor and the black axle, but letting the linear actuator swing around the motor's axle), extending the actuator will make the black axle rotate about 90 degrees. You'll need to adjust the system to get the desired rotation angle.

2
  • Thanks for the illustrations! Adding a clutch to enable driving up to (and over) an end position has not occurred to me but is indeed a good idea. In the sentence "Technic liftarms will absorb extra rotation" did you mean "Technic linear actuators" perhaps?
    – zovits
    Jan 9 at 12:56
  • Sorry, my english skills seem to be still on holiday, and couldn't recall the word "clutch". 😇 Also fixed the liftarm→actuator bit. Jan 9 at 13:46
1

For an ordinary motor it is not possible, as the axle position can't be queried from the software. What you can do though is to write your software in a way to return to the starting position before ending the program (define a counter for the number of trigger events, increase it every time, then at an appropriate point apply the necessary amount of reverse movement).

Another possibility is to build in a mechanical system that returns the axle to a pre-defined position (with force from gravity or a rubber band) and set the motor in feathering mode to let it turn without resistance until the starting position is reached.

The most convoluted way is to build your own position encoder: set up a sensor (push button, colour sensor or ultrasonic) that can tell when the axle is in the starting position, then when resetting, turn the motor while querying the sensor until the starting position is reached.

0

Drive the motor at low power for some length of time in a direction until the door jams against some obstacle. Set the position sensor of the motor. Drive the motor to the desired starting position relative to the jammed position.

This violates one of the constraints of the questions, since this would run before you ran your code. However, it is simple.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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