Sparki has a gripper, useful for grabbing and moving objects.
The gripper is rack and pinion mechanism driven by a stepper motor, the same kind of motor used to move Sparki’s wheels. The stepper motor’s shaft has a pinion attached, which drives a rack. Moving the motor in one direction opens the gripper, while moving the motor in the other direction closes it:
Programming the Gripper
With the mechanics explained, we are now going to program the gripper’s movements.
To move, Sparki needs batteries properly installed, and the power switch on.
These are the blocks that miniBloq gives to control the gripper. They are (in order) the open, close and stop blocks:
There is no sensor to detect if the grippers are open or closed. We will control the gripper movements in small, timed movements. To start, make sure the gripper is not fully opened or fully closed.
To open the grippers, we will run this code. It first tells Sparki to open the grippers, then to wait 1.5 seconds (1500 milliseconds), and then to stop the grippers from moving. The result should be that the grippers are opened:
On the other hand, if you see that the gripper is fully opened (like the right photo in the previous image), please run a program like the following. It will tell Sparki to close the grippers for 1.5 seconds (1500 milliseconds), then stop.:
Testing the Gripper
Now, try making small modifications to the time interval. For example, you can open (or close) it for 2 seconds. Please don’t try big numbers here, since you will quickly make the gripper grind as it tries to close tighter or wider than it can. By making a few little experiments with different lengths of time, you will soon understand the gripper’s limits.
You can try any combination of these blocks to drive Sparki’s gripper:
This small program will cycle your Sparki’s gripper, opening it for 1 second (1000 milliseconds) and closing it for 1 second: