The Heart of the Hub

The SPIKE Prime Hub

When you power up the SPIKE Prime hub, the first thing you see on the display is a pixelated heart. It might look a little cute and quirky, but it’s quite likely that you don’t think much more of it and just get on with programming or scrolling through your stored programs.

Maybe you have pushed the centre button and seen a few blinking dots that don’t really mean much to you, but there’s a lot more to it than that. This “heart program” is a powerful testing tool that allows you to make things work without even programming them.

The first thing this nifty program does is show you what is connected to the Hub. If you run it with nothing connected, it will display a single dot next to each sensor/motor port. When you plug in sensors or motors you will see the display change accordingly, but that’s just the beginning.

Running the heart program with no sensors or motors connected

Working with sensors

If you connect a sensor, the display shows a little bar graph between the two ports on that row, based on the sensor reading. When sensors are plugged in (up to a maximum of one per port row), the bars on the display change according to sensor readings. At the very least this lets you know that your sensors are actually working. It can also be used to determine whether the sensor is reading high or low based on a certain condition.

Connect a sensor while running the heart program to get some simple sensor feedback

Working with motors

It gets even better. You can test your builds without any programming or even build simple things that work without code. If you connect a motor, the six dots disappear and are replaced with two, one at the motor port and the other moving continuously from the opposite port to the connected port.

Control a motor using the heart program

Pressing an arrow button will turn on any connected motors. The more times you press the button, the faster the motors will go. The other arrow button will slow down the motors with each press. Once the motors have stopped, either button will make the motors move again. The direction in which the motors turn depends on which button is pressed and the side of the hub that the motor is connected to.

This feature is obviously very useful when you just need to make some motors go round – maybe testing things at different speeds or seeing if your attachments work before programming them. Just be careful – because when you press either arrow button, ALL the motors will turn.

Multiple motors can be controlled simultaneously

Control a motor with a sensor

The heart program has one more trick up its sleeve. If you connect a sensor to a port opposite a motor, the motor will turn at a speed based on the reading of the sensor. A solid bar of pixels connects the two ports, pulsing as the sensor reading changes. You can make simple sensor-based devices without any programming at all!

Use a sensor to control a motor by connecting them to opposite ports

A motor can be made to turn faster the closer the ultrasonic sensor reads, or the harder the force sensor is pressed. It’s that easy, and it can be a big help if your code isn’t working right – you can check that your build works independently of the programming and narrow down the problem.

The next time you use the SPIKE Prime kit, have a look at the program at “the heart” of the hub. It’s an interesting and powerful tool to help you build faster!

The following two tabs change content below.

Nathaniel

I'm a student member of FRC Team 5593 (Devil Robotics) and mentor in our LEGO-based junior group. I like experimenting with SPIKE Prime and helped run a series of challenges over the Tasmanian lockdown period. I also use LEGO to make a stop-motion animated series of videos chronicling the adventures of a hero named Captain Mustard.

Latest posts by Nathaniel (see all)

Leave a Reply