Hi
Whilst this does not exactly show you how to programme your ‘Ultimate’ gripper, the following notes (extracted from my book ‘mBot & Me - The Ultimate Challenge’) might be of some use and give you some useful clues:
"The on-line specs. suggest that the micro-motor will automatically stop running when the gripper is fully open or closed and will not burn out. The threaded section of the motor shaft is a standard M4 right-handed thread and if the gripper is part-closed then you can see that there is a plain unthreaded section of the screwed shaft which allows the motor to slip when the Gripper is fully open.
So fully open is fine, and whilst clockwise power is applied to it, the motor rotates and the the bit of the Gripper that the screw passes through just slips in the non-threaded section. When the motor’s direction is reversed then the thread pulls the Gripper jaws closed again. But at fully closed, there is NO such slippage arrangement and if overzealously closed then the Gripper tends to jam with the jaws shut fast!
This has worryingly happened to me several times whilst undertaking Gripper control experiments, but so-far with no (apparent) damage to the motor since the power applied to it has been cut immediately.
If the Gripper jaws do jam firmly shut then you have to unscramble the problem manually by rotating the threaded shaft clockwise (looking through the gripper towards the motor) this will rotate the threaded shaft anti-clockwise out of the the bit of the Gripper unit that the screw passes through. Applying a burst of +100% power to the motor & a pull on the jaws sometimes tends to free it; but not always and in that case then you need to rotate the shaft manually, however this is hampered by the jaws being closed!
A small pair of snipe-nosed pliers might enable you to do this by grasping the non-threaded bit tightly and rotating it in the appropriate direction. I decided to solve this jamming problem by removing the little black plastic cap-nut and its associated spring and washer and replacing (as you can see in the image on the right) with two M4 nuts locked firmly against each other onto the threaded section at the outer-end of the shaft. In practise this works well and I find that I can just grasped the two nuts between a thumb and a forefinger to apply a loosening clockwise twist. I have incidentally not really seen any value to be gained (so far) by replacing these two nuts with the washer, spring and retaining cap-nut that I removed earlier.
Despite the fact that the N20 Mini-Motor is a DC motor; after some tests I found out that it can be rotated through a certain number of degrees over a period of time by using the appropriate encoder motor block (on port4) and not the specified DC motor block shown below, using port4B - the port from where the Gripper motor is actually powered!
A simple test showed that at 40% power it took 4 secs to fully open or close the Gripper. If the Gripper’s motor is set to ‘pulse’ in this way using rotational steps of 45˚ at 100 rpm then two of these (very short ‘bursts’ of DC power, I guess) will open or close it fully and not jam it shut by almost, but not quite, closing the jaws tightly together.
I have yet to buy another DC motor to test if the theory of using encoder motor blocks in this way to send short power ‘bursts’ is actually true - but I think that I have established that it does work!"