Using the Gripper

Learn how to use Sparki’s grippers to grasp objects.

SparkiDuino
Easy

Lessons You Should Know

Introduction

Sparki has a gripper, useful for grabbing and moving objects.

Front - Gripper

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:


Rack Pinion


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 basic commands that Sparki’s software provides to control the gripper:

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 1500 milliseconds (1.5 seconds), and then to stop the grippers from moving. The result should be that the grippers are opened:



On the other hand (or gripper!), to close grippers, we will run this code. It first tells Sparki to open the grippers, then to wait 1500 milliseconds (1.5 seconds), and then to stop the grippers from moving. The result should be that the grippers are opened:



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 reach the gripper’s mechanical limit fast. By making a few little experiments with the intervals of time, you will soon be familiarized with the gripper’s limits.

Finally, you can try the example program included with the SparkiDuino software.

This small program will open and close your Sparki’s gripper in a never-ending loop, opening it for 1 second (1000 milliseconds), closing it for 1 second, then pausing for 1 second:

Please go to the menu File > Examples > Gripper and download the code to your Sparki:



Extra Activities

If you want to improve the control of the gripper, you can always use the stepper motor instructions that we have learned before:

Although these two instructions (motorRotate and motorStop) will allow you to control the gripper’s speed, they aren’t as handy as the standard gripper functions learned in this lesson. But why not to experiment with them too? As a tip, the motor parameter that should be used in order to work with the gripper is MOTOR_GRIPPER.