
Introduction
Do you remember the spintop? You might have had a wooden or plastic one, but we bet it wasn't a smart one. Now you can finally make one – it will register your centrifugal force. Measure it against your friends to see who is centrifugally the strongest one! 💪
In this project, you will learn to measure the fast spinning of the box. 👈
All you need is the box with button and the USB dongle in the basic HARDWARIO Starter Kit.
Download new firmware
- If you haven't done it yet, put it together the Starter Kit.
- Upload new firmware to Core Module - bcf radio spinning game (you will find it among other firmware in the Playground). Thanks to this firmware, the box will become sensitive to rotation. 👌
Our tip: You don't know how to download firmware or what it even is? You can find out here.
- Pair the Core Module with the USB Dongle. Right after pairing it, you will notice that your Core Module has changed Alias to rotation-g-meter.

Build in the Node-RED
- In the Playground, click on the Functions tab, where is the programming desktop Node-RED. 🤖
- Start as always: first place the MQTT node from the Input section on the desktop.
Double-click on it and copy Topic to the field. With this, the box will measure the centrifugal force:
node/rotation-g-meter:0/rotation-g

Confirm it with the Done button.
- Surprise. 😲 Under the first MQTT node, place a second MQTT node from the Input section. This time, save another Topic in its settings; with this one, the box will measure the rotation time:
node/rotation-g-meter:0/rotation-time

- To each node, place one node for javascript. You can find them in Function section, under Function (original, right? 🤡).

- Double-click on the upper Function node and insert this code into the large field. The code will register the record centrifugal force. 💪
var record = flow.get("record") || flow.set("record", 0.0);
var lastSpin = parseFloat(msg.payload);
if(lastSpin > flow.get("record"))
{
flow.set("record", lastSpin);
return msg;
}
In the Name field, name the node as Save the record.

Confirm it with the Done button.
- Into the bottom Function node, insert the code that will register the record spin time. ⏰
var record = flow.get("timeRecord") || flow.set("timeRecord", 0.0);
var lastSpinTime = parseFloat(msg.payload);
if(lastSpinTime > flow.get("timeRecord"))
{
flow.set("timeRecord", lastSpinTime);
return msg;
}
In the Name field, name the node as Save the record.

Confirm it with the Done button.
- Under the upper Function node, place the text node from the Dashboard section. You can place it elsewhere, but for the sake of clarity it will be better if they are aligned vertically.

In settings, name it Last spin. This way, it will show you the value that the box just measured.

- Place another node under this one; thanks to the bottom one, the values will be registered into a graph. 📈 You will find it as Chart node in Dashboard section.

In the Label field, name it as History. Into the X-asis Label field, set automatic, which means that the unit will be added automatically.

- Under the second javascript, place the Text node from the Dashboard section.

You will determine in it how the length of the latest rotation is displayed: Time of last spin.

- Next to each level, place one Text node from the Dashboard section. Those will affect the way you see the record time registered in the graph. Set up the Record label and Record time, respectively.

- And then connect it all as shown in the picture. You will have two separate flows on the desktop. In the end, don’t forget to press the Deploy button to make it all work. 🚨

Give it a spin!
- Invite all your friends and get them worked up. Have a Coke. 😄
- Measure your centrifugal force! One by one, spin it. Our tip: For the best spin, make the box stand on its button.
- Follow the results in the Dashboard tab. So, good luck and …. spin it like you dare!
