Programming Spike Prime SCARA robot - Step by step

1. Install and open the Spike App.

2. Select to work with Spike Prime set.

Diagram

Description automatically generated

3. Close splash window and select NEW PROJECT on next screen.

Graphical user interface, application, Word

Description automatically generated 

4. Create new  WORD BLOCKS project 

Graphical user interface, application

Description automatically generated




5. Click on 3 dots on Project name balloon and select RENAME PROJECT…

6. Name it SCARA_robot and click on SAVE to save it.

Graphical user interface, text, application, chat or text message

Description automatically generated

7. From the block palette select VARIABLES and click on Make a Variable. Name it speed.

Graphical user interface, text, application

Description automatically generated 

8. Repeat this and make 3 more variables: J1, J2, J3. It will be used for displaying the motor positions.

Graphical user interface, text, application

Description automatically generated

9. Set the speed variable value to 15 and assign it to all 3 motors. Note that motors are connected to ports A, B and C as shown in last step of the assembling part of this example. From now on we will use the following notation: M1 = motor A, M2 = motor C, M3 = motor B.  Move the motor A and motor C to starting position (360/0 degrees) using the shortest path option. 

Graphical user interface

Description automatically generated

10. From the block palette choose MY BLOCKS and click on Make a Block button to create a new block. Name it move.

Graphical user interface, application

Description automatically generated

11. Click on Add an input icon 4 times to add 4 input parameters. 

Graphical user interface

Description automatically generated

12. Name the parameters: M1 D1 M2 D2 and click on SAVE to save it.

Graphical user interface, application

Description automatically generated

13. Let’s define the move block. First we will check the D1 and D2 parameters if it is c (clockwise) or cc (couter-clockwise). 

A picture containing diagram

Description automatically generated

14. When we read the direction we will apply it to motors A and C.
M1 and M2 values are angles in degrees. Note that motor A has opposite rotating directions from convention. This is because it’s placed upside-down so we have to switch the directions. 

Graphical user interface

Description automatically generated

15. After the movement is done we read and transfer the position of the motors to variables J1 (1st joint) and J2 (2nd joint)

A screenshot of a cell phone

Description automatically generated with low confidence  

16. Let’s make the effector block. It will be used to move motor B (or M3) block using the same procedure as in previous step. We have 2 inputs - degrees (M3 parameter) and direction (D3 parameters) 

Graphical user interface, application

Description automatically generated 

17. Define the effector block as follows. Note that we are using up and down keywords instead of c and cc as D3 input. At the and we transfer the position (angle) to variable J3. 

Graphical user interface, chart

Description automatically generated

18. Let’s finish the main part using defined blocks and try some movements.

Graphical user interface, application

Description automatically generated

19. Connect your Spike Prime Hub to computer with USB micro cable and turn on the Hub by long pressing the middle button. You will be notified that Hub is connected and Hub icon is displayed with green checkmark in upper left corner of the screen. Note that also all 3 motor positions are visible there. Press PLAY button (yellow) in lower right corner and try the code. Open variable panel (right) to monitor the motor positions J1 - motor A (M1), J2 - motor C (M2), J3 - motor B (M3). 

Graphical user interface, application

Description automatically generated

You can transfer the code in Spike Prime Hub and start it directly from there.