FREE 5-7 DAY SHIPPING for all orders over $25 shipped within the USA
Building Modular Robots with Cubelets
- A first robot
- Try swapping Sense blocks
- Try swapping Action blocks
- How numbers flow
- Using the Bar Graph block to see the numbers
- How you arrange the Cubelets makes a difference
- A Sense block can control more than one Action block
- Think blocks
- The Inverse Think block
- Differential drive
- Action blocks average their inputs
- Gradients: diffusion
- Use the Minimum block as a switch
- Use the Blocker block to separate two parts of a robot
- Take a look at your Cubelets
- A note to experienced programmers
You need a gray block, a black block, and a clear block. Snap them together. You’ve built a robot!
Every robot needs power. The blue-gray block is the Battery block.
(hint: the Battery block has an on-off switch. Make sure it’s on before you start to play; turn it off when you’re done.)
A robot is a machine that senses its surroundings and acts on its surroundings. So every robot needs a Sense block and a Action block. Sense blocks are black and Action blocks are clear.
Snap together a Battery block, a Knob Sense block, and a Flashlight Action block. The Flashlight Action block lights up. You control its brightness by turning the knob.
It dims when you turn the knob counterclockwise (to the left) so you could call it a dimbot.
Now take out the Knob Sense block. Put a Brightness Sense block in its place. You still have a flashlight robot, but now its brightness depends not on the knob, but on the light around it.
Test it: Cover the Brightness Sense block with your hand.
(Hint: one face of every Sense block has the actual sensor. It’s the different face without the magnet connectors.)
The flashlight dims. Move your hand away and the flashlight gets brighter.
You can swap any Sense block for any other Sense block.
You’ll still have a robot, just a different robot. In the dimbot we swapped a Brightness Sense block for a Knob Sense block to make a light-sensitive dimbot.
We tried swapping Sense blocks. You can also swap Action blocks. Put a Drive Action block in place of the Flashlight Action block. Now your robot has a Brightness Sense and a Drive block (and of course, a Battery block).
This robot moves when it senses light. In a bright room it’s a fast robot. In a dark room it’s a slowbot.
Try more swapping. What if you use a Speaker Action block instead of the Drive Action block? (canarybot)
What about a Distance Sense block instead of a Brightness Sense block? (timidbot)
Try turning the Drive Action block so the robot goes backward instead of forward (friendlybot or timidbot).
Each black Sense block senses some property of its surroundings and turns it into a number. The Knob Sense block senses how much you rotate its knob. Turn the knob all the way counterclockwise (left), and the Knob Sense block produces a small number. Turn it clockwise (to the) right to produce a big number.
Each Sense block tells its number to all its neighbors.
The Brightness Sense block senses how light the room is. In a dark place the Brightness Sense block produces a small number. In a light place, the Brightness Sense block produces a big number.
Each Action block takes numbers from its neighbors and turns the numbers into an action.
The Flashlight Action block takes a number and lights its lamp. A big number makes the lamp bright. A small number makes the lamp dim.
Think of the number as hopping or flowing from one block to the next. Numbers are flowing through the blocks of the robot from Sense blocks to Action blocks all the time. That’s what makes the robot behave the way it does.
Numbers don’t flow through Sense blocks. Each Sense block produces its own number, so it doesn’t pass numbers from its neighbors.
You can use the Bar Graph Action block to understand what’s going on inside your robot—to show the numbers flowing from block to block.
Attach the Bar Graph Action block to any block in a robot. The Bar Graph Action block shows how big the number is. If the number is big, all the cells in the bar graph light. If the number is small, only a few light up. If the number is very small (or zero) no cells light at all.
Try it. Build a simple brightness gobot with a Brightness Sense block and a Drive Action block. Attach the Bar Graph Action block to one of the blocks. If there’s a lot of light, the Bar Graph Action block will show a full bar (and the Drive Action block will move fast). If there’s not much light, the Bar Graph Action block won’t light much.
You don’t need the Bar Graph Action block to understand what’s going on with this simple robot. But with bigger and more complicated robots, the Bar Graph Action block can help.
This robot comes in different versions because you can put the Drive Action block into the robot in different ways. One way, the robot goes straight. The other way, the robot goes around and around. You could call it a turnabot.
It’s not just which Sensor and Action blocks you choose. It’s also how you place them in the robot. The same Cubelets arranged in a different physical configuration make different robots.
Place the Brightness Sense block so its sensor face points down. Now it doesn’t see the light. This gobot is a nogobot. No matter how bright the room is the robot won’t go. Its Brightness Sense block doesn’t sense the light.
Try placing the Brightness Sense block to face in different directions. How does that affect the robot’s behavior?
Some robots are more stable than others. Try building a simple gobot with a Distance Sense block and a Drive Action block. It’s stable if you build a train with all three blocks (the Battery block, the Drive Action block, and the Distance Sense block) arranged in a row.
The Distance Sense block produces a big number when something gets near it. You can chase this timidbot around with your hand. When you get near the timidbot, it runs away.
If you build this robot as a tower instead of a train, it still works, but it’s no longer stable: Approach the Distance Sense block and the Drive Action block starts moving. Then the tower falls over.
You can fix this: Add a block at the bottom next to the Drive Action block. Any block will do, but try one of the green blocks, either a Passive block or a Blocker block.
Notice that you can build this gobot in different ways. If the Distance Sense block faces the same direction that the Drive Action block moves, your robot comes toward your hand. If you turn the Distance Sense so it faces the opposite direction, it moves away. You can chase it around with your hand.
Build a simple gobot with a Brightness Sense block and a Drive Action block: It goes when it senses light.
Add a Speaker Action block. Now it goes and chirps when it senses light.
Add a Flashlight Action block. Now it goes and chirps and lights up when it senses light.
Add all the Action blocks you want. They all respond to the same Brightness Sense block. With a lot of light on the Brightness Sense block all the Action blocks will act a lot. Without light on the Brightness Sense block the Action blocks won’t do much.
Build a lighthousebot that uses the Knob Sense block to control the speed and the brightness of a rotating robot tower.
You’ve met the Battery block, and the black Sense blocks and the clear Action blocks. It’s time to meet the colored Think blocks. The simplest Think block is the red Inverse Think block.
Think blocks are the colored blocks.
Let’s go back to the light-sensitive dimbot. It has a Brightness Sense block and a Flashlight Action block. (It also has a Battery block of course but we’re going to stop mentioning the Battery block because every robot has one).
The dim-bot made a silly flashlight. Its lamp is bright when it’s in a bright room, and dark when it’s in a dark room. We’d prefer a flashlight robot that turns on when it’s dark, and off when it’s light.
Put the pink Inverse block between the Brightness Sense block and the Flashlight Action block.
Remember the number flow story: Every Sense block produces a number. The Brightness Sense block produces a big number when it senses a lot of light. It tells that big number to its neighbor (the Flashlight Action block), which turns the big number into a bright light.
The Inverse Think block turns a big number into a small number (and a small number into a big number).
When we put the Inverse Think block into the robot, numbers pass through it from Sense block to Action block. When the Brightness Sense block senses a lot of light it produces a big number, which the Inverse Think block turns into a small number, and passes to the Flashlight Action block, which dims its lamp.
It also works the other way. When you put the robot in a dark room (or shade it with your hand) the Brightness Sense block produces a small number. The Inverse Think block turns it into a big number, and the Flashlight Action block makes its light bright: A nightbot that turns on in a dark room, and turns off in a bright room.
Swap out the Flashlight Action block and put a Drive Action block in its place. Now you’ve built a robot that goes when it’s dark, and stops when it’s light.
The Inverse Think block in this night-gobot inverts the number from the Brightness Sense block before passing it to the Drive Action block. In low light, the Brightness Sense block produces a small number; the Inverse Think block inverts it to a big number, which makes the Drive Action block go fast. In bright light, the Brightness Sense block produces a big number, which the Inverse Think block inverts to a small number, so the Drive Action block moves slowly, or not at all.
Remember the go-bot that uses a Distance Sense block to control a Drive Action block? Put two gobots together on a robot (facing the same way) and you’ve built a steeringbot.
The steering-bot has two gobot towers with a Battery block in between. They each act independently. (Each Sense blocks does not pass the value from the other Sense block.) Each gobot tower responds to an object (like your hand). Put your hand near the right side gobot tower and its Drive Action block will go, while the left side’s Drive Action block stays still (or goes slower).
When one Drive Action block moves and the other doesn’t, or turns the other way, the steeringbot turns. That’s called “differential drive steering”.
We saw how one Sense block can control several Action blocks. If your robot has two Sense blocks and one Action block, which one controls the robot?
Build a testbot with two Distance Sense blocks and a Bar Graph Action block between them.
The Bar Graph Action block shows a low value if neither Distance Sense block senses an object.
Put one hand in front of each Distance Sense block. They will both produce a high number. The Bar Graph Action block shows a high number.
Now put your hand in front of just one of the Distance Sense blocks. This block now produces a high number while the other Distance Sense block produces a low number. The Bar Graph Action block takes both numbers and averages them. It shows a number that is halfway between the numbers it gets from its two Distance Sense neighbors.
If your robot has an Action block right between two Sense blocks, the Action block averages the numbers the two Sense blocks tell it.
If one Sense block is farther from the Action block than the other, then the closer block has a stronger effect. You can test this using the Bar Graph block.
Build a robot with the two Distance Sense blocks on either end and two Passive blocks between them. Add a Bar Graph Action block to one of the Passive blocks.
Now play with your robot: put one hand in front of each Distance Sense block, so that the Bar Graph Action block reads high (all its cells light). Take your hand away from the Distance Sense block that is farther from the Bar Graph Action block. Now put your hand back and try the other Distance Sense block. The Bar Graph Action block responds more strongly to the closer Distance Sense block.
An Action block acts according to the average of the Sense block numbers it gets, weighted by the distances (number of blocks from Sense block to Action block, or “hop count”) they’ve travelled.
Suppose you want to make a light-sensitive go-bot—it goes when it sees light. But you also want to be able to turn it off. Of course, you can just switch off the battery, or take out the Battery block. But you can also use Cubelets to make an on-off switch. Here’s how.
An ordinary light-sensitive go-bot just has two blocks: a Brightness Sense block and a Drive Action block (plus a Battery block). The number from the Brightness Sense block tells the Drive Action block how fast to go. A brighter light, a bigger number, a faster go-bot.
Take out the Brightness Sense block and put a Minimum Think block in its place. This Minimum Think block tells the Drive Action block how fast to go. It takes all the numbers its Sense block neighbors give it, and chooses the smallest (minimum) of those numbers. This smallest number is what it tells its Action block neighbors.
Attach the Brightness Sense block to the Minimum Think block, and also attach a Knob Sense block. Now, if you turn the Knob Sense block all the way counterclockwise (left), then the Minimum Think block tells the Drive Action block, “zero”, because this is the smaller of the numbers it’s getting. If you turn the Knob Sense block all the way clockwise (right) then the Minimum Think block will tell the Drive Action block whatever number it’s getting from the Brightness Sense block. With the Minimum Think block, the Knob Sense block acts like an on-off switch.
The dark green Blocker block passes power but does not allow numbers to flow through it. Use it to build a robot with two parts that don’t talk to each other. Here’s an example.
One half of the robot is a lighthousebot with a spinning light; the other half is a robot that chirps when it sees the light from the lighthousebot.
The lighthousebot is Knob Sense block that controls the speed of a Rotate Action block, and on top of that, a Flashlight Action block that points outward (sideways). When you turn the Knob Sense clockwise (to the right), the light goes on and spins.
Now add a Blocker block to the base (say, on the Knob Sense block). Then, on the other side of the Blocker block add a Speaker Action block, and on top put a Brightness Sense block with its sensor face pointing toward the rotating light. The Speaker Action block chirps (the rooom is bright), and every time the rotating light beam passes over the Brightness Sense block, the Speaker Action block responds by chirping faster.
To the right of the green Blocker block is a Lighthouse block: a Knob Sense block, a Rotate Action block and a Flashlight Action block. The Flashlight Action block spins when you turn up the Knob Sense block. On top of the green Blocker block is a Speaker Action block and a Brightness Sense block. When light from the spinning Flashlight Action block strikes the Brightness Sense block, the Speaker Action block chirps faster.
Does it have a Battery block?
Every robot needs a Battery block.
Is the Battery block turned on?
If the Battery block is turned on then the Battery block’s LED is lit. If it’s not lit, try turning it on with the switch. If that doesn’t work, try charging the Battery block’s batteries.
Is the LED light on in each block?
Occasionally Cubelets don’t make a good connection at their faces. Try wiggling the blocks gently to seat them. Look at the LEDs to see which blocks are connected.
Does your robot have a Sense block and an Action block?
Every robot needs at least one Sense block and one Action block. Without the Action block, it won’t do anything. Without the Sense block, it won’t know what to do.
With a larger robot that’s not working, try taking away blocks to remove complexity. Simpler smaller robots are easier to understand, so they’re easier to debug.
If you think one of your Cubelets is broken, try using it to build a very simple robot. For example, if you think a Drive Action block is broken, try using it to build a simple go-bot with a Knob Sense block.
Cubelets come in four types: Sense blocks, Action blocks, Think blocks, and Utility blocks. Sense blocks are black, Action blocks are clear, and Think and Utility blocks are different colors. The Sense, Action, and Battery blocks all have five connecting faces and one special face. All other blocks have six connecting faces.
Every Cubelet has a small LED light in one corner. When the Cubelet is part of a robot and the robot’s Battery block is turned on, the LED light is on too. This LED light shows that the Cubelet is getting power and talking to its neighbors. Each Cubelet robot must have one Battery block, which powers all the other blocks in the robot.
The Battery block has a small switch. When you slide it one way, the Battery block is powered on. The other way, it’s off. Turn it off to save battery life when you aren’t playing with your Cubelets.
The Battery block has two rechargeable Lithium-Iron-Phosphate (LiFePO4, or LFP) cells. To recharge the batteries, unscrew the metal screw, slide back the plastic cover, remove the cells, and place them in your charger. (Don’t lose the metal screw while you’re recharging!)
Each connecting face of a Cubelet has three conductors. The outer ring and magnets conducts ground; the inner metal ring, power; and the center pin conducts data from one Cubelet to the next. These three conductors must connect with their neighboring counterparts in order for two Cubelets to communicate.
Experienced programmers often ask, “So which block is the IF-THEN block”. Or, “Which block is the CPU?” We understand the questions, but that’s not how Cubelets work.
Building robots with Cubelets is different from the procedural programming (in C, Java, or BASIC) that you may know. In procedural programming, a robot’s behavior results from executing a sequence of instructions in the robot’s “brain” (usually a single microcontroller).
Cubelets operate with a completely different model: distributed programming.
Every Cubelet has a microcontroller. The robot’s behavior results from local interactions between Sense, Think, and Action blocks and the numbers flowing from block to block.
There’s no single “brain” block, and there’s no sequence of instructions. There are no variables, functions, or procedural logic. Instead, in Cubelets, the robot is the program. The way you put the blocks together determines the way numbers flow from Sense to Action blocks, and this determines your robot’s behavior.