Spike Prime
The state of being expert
Content:
Block-based Programming
Preamble • Straight Movement
Hardware Components • Rotational Movement
• Main Hub • Custom Function (My Blocks)
• Rechargeable battery • Moving lifts and arms
• Charging cable • Steering
• large angular motor • Lighting up the on-surface pixels
• Medium angular motor • Making sounds and beeps
• Color sensor • Relative Position (Motor Encoder)
• Distance sensor • Conditional & Loop Statements
• Force sensor • External Sensors (Force, Distance, and Color)
• Spike App – overview • Parallel Commands
• Variables
• Lists (arrays)
• Problem-Diagnosis Procedure
• Introduction to Engineering Control
Preamble
LEGO Education Group recently releases the most cutting edge product; the successor of the EV3 and
WeDo platforms; it’s the Spike Platform. It comprises two sub-platforms; the Spike Essential (meant for
grade 1-5 students) and the Spike Prime (meant for grade 6-8 students). In this course, Spike Prime is
going to be in the light spot.
Hardware Components
With a Spike Prime set, you handle EV3-like devices; as below:
1. The Main Hub
2. The rechargeable battery
3. The Charging cable
4. The large angular motor
5. The medium angular motor
6. The color sensor
7. The distance sensor
8. The force sensor
The Main Hub:
It represents the brain which is a programmable control unit that sensors and motors can be attached to.
The Hub has an intrinsic light and button interface. Here are the major constituents and their technical
specifications:
System:
- The CPU of the hub mainly includes:
• An ARM Cortex M4 core (can be clocked up to 100MHz).
• 1MB of flash
• 320KB of RAM
• 32 MB of memory for programs, sound, and data storage
- The storage memory is split into 20 various positions
- The Hub operates in 2 modes.
• Download mode
• Streaming mode
Spike Prime - The Hub
Size and Weight:
- Hub Weight: 63 g (without battery), 190 g with battery.
- Hub Dimensions: L-88 x W-56 x H-32 mm.
5x5 on-surface LED matrix white display:
- 25 white LEDs, each is programmable and it can be dimmed in 10-step increments.
Input/output ports - :
- 6x LPF2 input/output ports (A, B, C, D, E , and F).
- 115 KB port speed (ports E and F are prepared for "high-speed").
- Auto-detection of sensors and motors.
The Rechargeable Battery:
It is charged while placed inside the Hub via a micro USB cable and can be removed from the Hub
without the use of any tool.
General specifications:
- Lithium-ion polymer battery.
- 2100 mAH / 7.3V
- Lifetime: >500 cycles (min. capacity after 500 cycles: 30%).
- Storage lifetime: one year after production, then it needs to be recharged.
- Charging time will depend on the capability of the charger used.
Spike Prime - Hub’s Battery
The Medium Motor:
The motor is incorporated with an integrated advanced rotation sensor; therefore, the motor can report
both speed and position. It can also sense direct user input if the output is rotated by hand.
General specifications:
- The percentage of the instant speed is controllable
- It returns the relative position and absolute position in degrees
- Wire length: 250 mm
- Operating voltage; (5V to 9V)
- Speed: 135 RPM "revolutions per minute" (+/- 15%)
Note: use medium motors to move your lightweight robot (2kg or Less)
Spike Prime - Medium Motor
Task:
Attach a medium motor to the Hub through any port, run the auto-program (heart-shaped) by clicking
the middle button (from the brain), start doing quick clicks on the right button then the left one to test
the motor.
The Distance Sensor:
It can measure the distance to an object or surface using ultrasonic technology. In addition, the sensor
has a light output around the "eyes" which is divided into four segments that can be activated
individually.
General specifications:
- Wire length: 250 mm
- Approximate scope of work 50-2000 mm +/- 20 mm
- Sensor sample rate: 100 Hz
Spike Prime - Distance Sensor
Spike App – overview
You can program Spike robots through Spike App that is
available for Win10, Chrome OS, iOS, Android, and macOS.
You can either launch the online editor or download the
offline one on your computer.
• Launch the app online or download it through
https://education.lego.com/en-us/downloads/spike-
app/software
• Don’t forget to check "System Requirements" from that
website.
Spike App Icon
Open the Spike App, choose
"Spike prime“, you will be
navigated to the (Home) page;
there are 5 major domains:
The Sidebar
Get started
Recent projects
Unit plans
Building instructions
The Home Page
Save The Project
Project Tab
Go To
Home
Page The Connection icon
Create New
Project
Coding Blocks
Block Categories The Main Block
Chart Screen
simulator simulator
Memory Storage
Position
Add More
Categories
The Coding Page
The Data tab; gives data that may be collected from different connected sensors.
Task:
Attach a large or medium motor to the Hub through port C
Open the Spike App up, make sure your Hub is updated, create a new (World Blocks) project, connect
your hub to the computer then open the port view through clicking this icon ( )
Check the different data values come form the attached motor by dropping down the list
There are five different shapes of blocks, each shape tells you about its role. As the table shows:
Block Shape Description Block Examples
Hat blocks To start a stack of blocks, they are shaped
to attach blocks below them.
Stack blocks Perform main commands. They are shaped
to attach above or below each other.
Boolean blocks hexagonal (six-sided) blocks return a
condition as either true or false.
Numeric blocks Oval blocks report and gives values in the
form of numbers.
Conditional & Loop blocks Such blocks are executed according to a
certain condition.
Straight Movement
Objectives:
• Understand the functionalities of the related blocks
• Understand the required programmatic commands for robot movement
• Comprehend skills and concepts of mobile SPIKE PRIME robots
• Utilize the programmatic commands to move robots
The Robot in Use:
From spike prime app
Go to building instructions
Build the "Driving Base 1"
- When using Movement Blocks, they are designed to control two synchronized motors. Therefore, they
must be of the same type.
- In this part, respectively, the left and right motors are linked via ports A and B (the default ports). We
will change them later.
- At first the speed will be left as it already is (default speed "50%") then it will get changed.
- Some blocks are considered as though action blocks, while others are setting blocks.
In practice: New Blocks Used
Rotational Movement
Objectives:
• Understand the functionalities of the related categories and blocks
• Understand the required programmatic commands for robot rotation
• Understand the working principle of gyro sensor
• Comprehend skills and concepts of rotational mechanisms
• Comprehend the main terms (Pitch, Yaw, and Roll) angles
• Utilize programmatic commands to do rotation with different angles
• Perform various on-path missions
- In spike prime, there is a degrees-division convention you must know and commit when writing a
piece of code to flawlessly rotate your robot
-1 0 1
-60 60
-90
90
-180 179
It is a technique in robot
programming where the motors
are set to operate at a constant
Motor-speed
speed throughout the execution
of the movement (in our case,
rotation). This helps achieve
stable and consistent motion;
however, it comes at the cost of
losing some accuracy when
stopping at the desired angle.
θ Angle
Constant Motor-speed technique
Spin Mechanism
In practice – mehtod1:
Your conclusion:
Hint: to get more accurate results, it’s
a good idea to use a pseudo heading
angle.
Mission 1: Heads up ! The previous pieces of code only cause turning to the right, modify them to act the
other way round.
Mission 2: your robot should move along the following path.
- The straight movement speed should be 80% of the maximum value.
- The rotation speed should be 25% of the maximum value.
Start
500 mm
60 cm
Custom Function (My Blocks)
To compact a group of frequently-used blocks such as the previous rotation-purposed blocks into a
single one, use the (My Blocks) category.
STEP-1 STEP-3
Go to "MY BLOCKS" category,
STEP-2
Click "Make a Block"
Give a name , add a suitable number of numeric inputs
Mission 4: Heads up ! The previous piece of code only causes turning to the right, modify it to act the other
way round. Then get it compact in one block.
Mission 5: your robot should move along the following path; with straight movement speed of 60% and
rotation speed of 20%.
400 mm
300 mm 350 mm
300 mm
15°
550 mm
40° 40°
Start 20°
400 mm
250mm 300 mm
Start
The Color sensor
- It runs on three modes (Color Mode, Reflected Light Mode, and RGB Mode).
- We work in the scope of the Reflected Light and Color Modes.
In practice: New Blocks Used
Your conclusion:
In practice:
Parallel Commands
Mission 1: the robot moves 1m, meanwhile, it must have the ability to detect 5 different colors and show up
the 1st letter of each color's name on the screen.
Mission 2: the robot moves 1.5, then, at the same time, it goes back, exerts sound through all the way back,
and rotates an arm for 2 sec.
Mission 3: the robot moves along a square path, meanwhile, it should be able to check the distance if it
becomes less than 10 or the detected color if it becomes red, when that happens , a sound should be exerted.
Mission 4: Use some pervious versions of WRO and choose some missions to solve .
Mission 1: According to the below figure, write a piece of code that orders the robot to carry each
box to its dedicated place.
0.2 m
0.6 m
1.5 m
Mission 2: resolve Ex.3 so that you use a better strategy of coding.
Mission 3: Use some pervious versions of WRO and choose some missions to solve .
P-controller:
The output of this controller is the error scaled by the gain (Kp) in each instant. So, if the error is large,
the proportional path produces large output. When the error is zero or negative, the output is yielded
according to that, and so on.
Kp value is set based on the
P-controller yield = Error * Kp Governing Equation
"trial and error" strategy
P-controller yield
Error
Time Time
The relation between the error signal and
the proportional controller output.