The Mechanical Frog: two motors, one for each back leg. Swing both legs back together, and the frog pushes itself forward. Bring them back, and it is ready to go again.
The Walking Bot in Lesson 10 had one motor, and it stepped along. The frog has two motors. They do not take turns. They must move at the same moment. If not, the frog does not go forward at all. It turns.
A warning: it will not really leave the ground. The motors are not fast enough to throw the whole model into the air. It shuffles forward in little hops. Real machines have limits like this. Your mission at the end is to get it as close to a jump as you can.
In the real world 5 min
Where you have seen it
Frogs live almost everywhere. After rain, you can often hear them. A frog can jump twenty times its own body length. For a person, that would be most of a football pitch!
A frog in the middle of a jump, in the rainy season in India. Both back legs are stretched out together. Photo: Shiv’s fotografia / Wikimedia Commons (CC BY-SA 4.0).
Why it is built that way
Look at the photo. Both legs do the same thing at the same time. That is not luck. It is the only way a jump works.
A frog’s back legs are long. They push on the ground for a long time, and the frog gets faster and faster. And the legs push together. If one leg pushed a tiny bit before the other, the frog would spin off to the side.
What would go wrong without it
Now think about your two motors. Say your program drives one, and then the other. Even a tiny gap matters. The frog gets a push on one side, then a push on the other. It does not go forward. It waddles, and slowly turns.
Think of rowing a boat. Use one oar at a time, and you go round in a circle. Use both together, and you go across the lake.
Two pushes, one after the other, are not the same as one big push. Moving together is a different movement, not just a faster one.
Before you build 1 min
This model has no step-by-step instructions. The video below is not instructions either. It shows a finished frog moving. Watch how far the legs swing, and how small the hop really is. Then build from the model your teacher has. You are not missing a page. There is no page.
The main concept — two motors, one movement 6 min
EV3 has a whole group of blocks for driving two motors as a pair. You met them on the Driving Base in Lesson 1. You used them again in the last two lessons. They are not just for wheels.
Block
What it does
set movement motors to [B v] and [C v] :: movement
Says which two ports are the pair. It is a setting. It moves nothing, just like set speed in Lesson 3.
move [forward v] for (90) [degrees v] :: movement
Turns both motors the same amount. They start and stop together.
set movement speed to (100) % :: movement
Sets the speed for the pair. This is a setting too.
Why not just use two motor blocks?
Because they would run one after the other. A [B v] run for (90) degrees block waits until B has finished. Only then does the next block start. So C has not even started moving yet. Two motor blocks in a row give you a left kick, then a right kick. That is a waddle.
One move block is one instruction for a pair. Both motors start at the same moment, and both stop at the same moment. The Brick keeps them in step while they run.
when program starts
set movement motors to B and C
move for 2rotations at 5050 % speed
50left wheel · B50right wheel · C
Equal speeds → a straight line
Both wheels are set to the same speed.Equal speeds, so the robot tracks straight — the trail is a straight line.Two rotations later it is exactly where it was pointed.Finished — it will run again in a moment.
stopped
The path is worked out from the two wheel speeds in the block, not drawn by hand — so changing the preset changes the numbers and the shape together.
The demo uses a driving base. That is the easiest place to see the idea. Equal speeds go straight. Different speeds curve towards the slower side. Your frog has the same problem. If its legs are out of step, it turns off to one side.
Two motors that must stay in step are a pair. Tell the Brick that once, and it keeps them in step for you.
▶Driving with two motors, and copying animalsHow the Movement blocks work, and why so many models in this course copy animals.Show meHide
ComponentMotion6 min
Driving with two motors
A driving base has two Large Motors, one per wheel. You could drive them with two separate motor blocks — but they would never start at quite the same instant, and the robot would curve away. EV3 has a separate family of Movement blocks that treat the pair as a single driving base.
port B
port C
A driving base is two Large Motors, normally in ports B and C. The Movement blocks treat this pair as one machine rather than two separate motors.
Blocks reference
Block
What it does
set movement motors to [B v] and [C v] :: movement
Tells the Movement blocks which two ports are the driving wheels. Put it at the top of the program, before any movement.
move [forward v] for (2) [rotations v] :: movement
Drives both wheels together, so the robot travels in a straight line.
move for (1) [rotations v] at (75) (25) % speed :: movement
Drives the two wheels at different speeds, which makes the robot curve.
set movement speed to (50) % :: movement
Sets how fast the driving base travels from now on.
The letters must match the sockets
set movement motors to [B] and [C] is the block that decides which two motors every Movement block after it will drive. It does not look at the robot. It drives the two ports you name, whether or not there is a motor in them — so those two letters have to be the two sockets the cables are actually in.
This is the single commonest reason a driving base does nothing, and it is invisible in the program: every block is spelled correctly and the robot still will not go.
Two robots, and the very same program: drive the motors in ports B and C forward.Check the cables. The left robot's motors are in B and C — the two the block names. The right robot's are in A and B.Run it. On the left both wheels are driven and the robot goes straight. On the right only port B has a motor the block is talking to; port C is empty, and the motor in A is never mentioned.So one wheel turns and the other does not, and the robot swings round its dead wheel. Nothing failed, nothing was reported — the program drove the ports it was told to.Finished. Identical programs, identical robots — different sockets.
stopped
The yellow outline marks the two ports the block is driving. A robot only goes straight when both of them have a motor in them.
Both robots run the identical program. The left one has its motors in B and C, so both named ports have a motor and the robot drives straight. The right one is plugged into A and B: the block drives B, finds nothing in C, and never mentions the motor in A at all — so one wheel turns, one wheel sits there, and the robot swings round the dead one instead of driving.
If neither named port has a motor in it — cables in A and D, say, with the block still set to B and C — the robot does not move at all. The program runs happily to the end and the Brick reports nothing wrong, because as far as it is concerned it did exactly what it was told.
So before you look for a bug in the program, look at the cables: read the port letters off the Brick, then make the block say those two. B and C are only the usual choice, not a rule — if your build has the driving motors in A and D, set the block to A and D and everything works.
Straight, curved, and on the spot
Everything a driving base can do comes from those two speed numbers. Try each button below and watch the trail the robot leaves.
when program starts
set movement motors to B and C
move for 2rotations at 5050 % speed
50left wheel · B50right wheel · C
Equal speeds → a straight line
Both wheels are set to the same speed.Equal speeds, so the robot tracks straight — the trail is a straight line.Two rotations later it is exactly where it was pointed.Finished — it will run again in a moment.
stopped
The path is worked out from the two wheel speeds in the block, not drawn by hand — so changing the preset changes the numbers and the shape together.
Both wheels the same speed — the robot goes straight.
One wheel faster than the other — it curves towards the slower side. The bigger the difference, the tighter the curve.
One wheel forward, the other backward — it spins on the spot, which is how a robot turns in a space no wider than itself.
Notice there is no steering block anywhere in that program, and no steering part anywhere on the robot. The turn is made entirely by driving the two wheels different amounts.
when program starts :: events hat
set movement motors to [B v] and [C v] :: movement
move [forward v] for (2) [rotations v] :: movement
move for (1) [rotations v] at (50) (-50) % speed :: movement
How far is one rotation?
“Move forward 2 rotations” says nothing about the floor — it says how many times the wheels go round. How far the robot actually travels depends on how big the wheels are, and once round a standard EV3 driving wheel is about 17.5 cm.
Before doing any sums, get a feel for it. Drag the robot along and watch both scales at once — rotations on top, centimetres underneath, the same line. Land on the half marks: there is a number between 1 and 2, and it is 1.5.
Drag the robot, or use the arrow keys — it moves in half rotations. Rotations above the line, centimetres below.
1.5 rotations26.3 cm
1.5 — a half rotation past 1. Half a turn of the wheels is 8.75 cm, so halves matter.
cm=2rotations
35 ÷ 17.5 = 2. That is a number you can type straight into the block.
1 rotation = 17.5 cm. Two rotations is 35, three is 52.5.
Halves are real. 1.5 rotations is a perfectly good thing to type into the block, and it is 26.25 cm — right between the 1 and the 2 you already tried.
To go a distance you have chosen, divide by 17.5. The calculator does it, but do a few by hand first — 35 ÷ 17.5 = 2 is worth seeing.
Measure your own wheels before trusting the number. A base built with different wheels travels a different distance per rotation, and every calculation on this page moves with it.
set movement motors to [B v] and [C v] :: movement
set movement speed to (30) % :: movement
move [forward v] for (2) [rotations v] :: movement
Turning on the spot
Steering at right 100 or left 100 drives the two wheels in opposite directions, so the base stops travelling and pivots where it stands. The angle it sweeps is a simple doubling of the rotations:
Half a rotation is the one worth remembering: a square corner, 90°.
Rotations
The robot turns
0.25
45° — half a corner
0.5
90° — a square corner
1
180° — turn round and face back
2
360° — all the way round
The one to memorise is 0.5 rotations = 90°. Everything else follows from doubling or halving it.
set movement speed to (20) % :: movement
move [right: 100] for (0.5) [rotations v] :: movement
Turn slowly. The wheels on a driving base are big and the robot carries a lot of weight, so at full speed it keeps going after the motors stop and lands past the angle you asked for. Somewhere between 15% and 30% speed is where turns become repeatable. A turn that overshoots is almost always a turn taken too fast, not a wrong number.
These figures belong to your robot. The distance depends on the wheels and the angle depends on how far apart they are, so a wider base needs a different number for 90°. Test it, measure what actually happened, and adjust — the same discipline as the Gyro Sensor tolerance.
Why it matters
Every wheeled vehicle steers this way — a tank, a digger, an office chair with two driven castors. Cars use a steering rack instead, but a robot that turns by driving its wheels at different speeds needs no steering mechanism at all.
ComponentMechanics5 min
Biomimetic mechanisms
Biomimetics is copying a solution from nature. Not the look of an animal — the mechanism. Wheels are a human invention and a very good one, but nothing in nature has them, and there are places a walking machine goes that a wheeled one cannot.
The idea that has to land first
Nothing in a walking robot walks. There is a motor going round and round at a perfectly steady rate — the same motion that drives a car — and a linkage: a set of bars pinned together whose shape turns that circle into a footstep.
Push down, lift, swing forward, put down. No sensor decides when to do each part, and no block in the program says step. The bars do it, because of how long they are and where they are pinned.
1motor, turning one waydownnear foot½turn between the legs
rotation ina stride outno sensors, no code
One motor, turning steadily — the same motion that drives a wheel. Nothing here speeds up, slows down or reverses.Watch the foot rather than the crank. It is flat and slow along the ground, then lifts and swings quickly over the top.The two legs are half a turn apart, so one foot is always down. That is what stops the body dropping between steps.Finished. A steady circle in, a stride out — and not one part of it was told to walk.
still
The faint circle is the crank pin. The green outline is where the foot goes. They are driven by the same axle and they are not remotely the same shape — that difference is the linkage.
The two paths on that stage are the whole module. The crank pin travels a perfect circle. The foot travels something flat along the bottom and arched over the top — and they are driven by the same axle at the same speed. Everything between them is link lengths.
Why the foot path matters
Flat along the bottom. While the foot is on the ground it must travel in a straight line at a steady rate, or the body bounces and the robot shuffles instead of walking.
Lifted on the return. High enough to clear the ground and whatever is on it. A higher arch climbs better and wastes more effort.
Legs out of phase. With legs half a turn apart there is always a foot down, so the body never drops. Four or six legs in pairs is steadier still — which is why insects keep three feet down at a time and are almost impossible to knock over.
The famous designs are worth looking up by name: Jansen linkages (the strandbeest walkers), Klann linkages, and the four-bar “Chebyshev” walker. All of them are the same trick with different numbers.
Other things worth copying
In nature
As a mechanism
A caterpillar or inchworm
Anchor one end, contract, anchor the other, extend. Slow, and it climbs anything.
A fish tail or a snake
A chain of segments swung out of phase — a travelling wave that pushes backwards.
A bird wing
A four-bar linkage that flaps and feathers at once, from one rotation.
A hand or a claw
Linked fingers driven from a single input, so they close around a shape rather than onto a fixed position — a lever chain that adapts by itself.
Walking versus wheels
Be honest about the trade, because it is the engineering content of the whole topic. Wheels are far more efficient, far simpler and far faster on anything flat. Legs are worth their complexity when the ground is not flat: steps, rubble, soft sand, gaps. A walking machine chooses where to put its feet; a wheel has to roll over everything in between.
Building one out of LEGO
Link lengths are everything, and a stud out is a broken gait. Build one leg, get its foot path right, and only then copy it.
Legs need to be built in mirrored pairs on a common axle, half a turn apart. Getting that phase wrong is the usual reason a walker rocks in place.
Walking is hard work — expect to gear down heavily, and expect it to be slow.
A tall walker tips easily. Keep the Brick low and the stance wide — see Centre of gravity.
Why it matters
Robots that copy animals are how machines reach places wheels cannot: search and rescue in collapsed buildings, inspection inside pipes, planetary rovers over loose ground. Studying the mechanism instead of the appearance is what turns an interesting animal into a working machine.
Say this back before moving on: “Two motor blocks happen one after the other. One move block moves both at once.”
What’s in this build 4 min
Three parts with cables. There is no manual, so you tell us which motors these are. But you already know two things about them. There are two, and they are the same as each other.
Part
What it is doing here
EV3 Intelligent Brick
Runs the program. It is also the frog’s body, so it is most of the weight the legs must move.
Two motors, one per back leg
Ports B and C. They must be the same kind of motor. If not, one leg is stronger than the other. Then the frog will curve, however carefully you program it.
Check the legs are a matched pair
Hold the two motors side by side before you fix them on. Are they the same shape and size? If one is a Large and one is a Medium, stop. Find two that match.
Swing each leg by hand, all the way. Do the two legs move the same distance? A leg fixed one hole further along the beam swings differently.
Are they mirror images? A frog’s legs are the same on both sides. Yours should be too. So, to push the same way, one motor turns clockwise and the other turns counterclockwise.
Put the frog on the table. Does it sit level, or does it lean?
Step 3 is the tricky one. If the two motors face opposite ways, a move forward block will drive one leg back and the other forward. Fix it in the build. Fix the motors so both legs swing the same way. Or swap which motor is B and which is C.
Ports — and the rule 4 min
Sensors go in ports 1, 2, 3, 4. Motors go in ports A, B, C, D. You cannot swap them. If you do, nothing warns you. The robot just will not work.
Once again, the motors are not in port A. There is a reason. B and C are the pair. The Movement blocks use them unless you say otherwise. Every driving base in this course uses them too.
Part
Port
Why this one
Left leg motor
B
In this whole course, left is always B. Stick to it, and another group’s program will work on your frog.
Right leg motor
C
Right is C. The pair is always B and C, in that order.
Sensors
none
The frog cannot see where it is going.
Check your own build now:
Left leg in B, right leg in C. Letters, not numbers. And the right way round!
To find left, sit behind the frog, facing the way it will go. If you look from the front, you get it backwards.
Swing both legs by hand. They should move freely and evenly, with nothing catching.
Run both cables over the frog’s back and out behind. A cable under a leg slows down one side only. Then the frog turns off to one side, which is the problem this lesson is about.
Connect the Brick 4 min
Two routes, and either is fine. USB is the reliable one and the one to fall back on when a room’s Bluetooth is busy; Bluetooth leaves the robot free to move, which some models need.
▶How to connect the BrickUSB and Bluetooth, step by step, with a photograph of every screen. Open it if you have not done this before — or if pairing is not working.Show meHide
USB — the reliable one
Switch the Brick on with the dark grey centre button.
Cable into the Brick’s PC port — the small square socket beside the numbered ports, not one of the numbered ones.
Other end into the computer.
Bluetooth — name it first
Do these in order. Naming the Brick after you go looking for it in the list is how groups end up driving each other’s robots.
Name your Brick. On the Brick: Settings (the spanner) → Brick Name. Type something nobody else will pick, then press the tick. Every Brick is called EV3 until somebody changes it.
Turn Bluetooth on. Settings → Bluetooth. Tick Bluetooth and Visibility. Leave iPhone/iPad/iPod unticked.
Connect from EV3 Classroom. Click the Brick icon at the top of the programming area, find your Brick by name, and click Connect.
Say yes on the Brick. It asks “Connect?” with the computer’s name — choose the tick, then accept the passkey, which is already 1234.
Where to read it. The name sits in the bar across the very top of the screen, on every screen — so you can check which Brick you are holding at any moment without going into a menu. This one is EV3VE. A Brick nobody has renamed says EV3.Step 3, and the reason step 1 exists. Three Bricks in range — read the name before you click Connect. Pairing with the wrong one is not an error: it works perfectly, on somebody else’s robot.
Step 2.Bluetooth switches the radio on; Visibility is what lets the computer find you. With Visibility off your Brick works perfectly and simply never appears in the list.Step 4. Look at the Brick. It asks whether to accept and names the computer. Choose the tick.Then the passkey, already 1234. Press the tick again and you are connected.
The two failures, every class, every time. The Brick has gone to sleep while you were building — press the centre button to wake it. Or you have paired with the group at the next table, which is why the name matters.
The long version, including Port View and how to read the port tiles, is in the Brick & Bluetooth guide.
Use Bluetooth if you can. This model moves about. A USB cable dragging behind it pulls on one side. That looks just like legs out of step. Do not spend the lesson fixing a cable.
Confirm the connection 2 min
Check the Brick icon: is it connected, or not?
Check the port tiles. A motor on B and a motor on C, nothing on A or D, and nothing on the number ports.
Both tiles must say the same kind of motor. With one Large and one Medium, the frog will always curve. No program can fix that.
Swing the left leg by hand. Check that the degree count on tile B moves. Then swing the right leg, and check C.
Step 4 catches motors that are swapped. On a frog, you hardly notice swapped legs. Then it turns the wrong way!
Change it and test 8 min
Make one change at a time, and guess before each run. Mark the start line with tape. Measure how far five hops take it.
Change the kick to 150 degrees. That is a longer push on the ground. Will it go further each hop? Guess, then measure.
Now the important one. Replace the two move blocks with four blocks for one motor each: B forward, C forward, B back, C back. Guess what the frog does. It waddles and turns, because the legs now take turns.
Put the move blocks back, then change set movement speed to 30 %. Does a slow, strong push move it further than a fast one? On a pushing machine, the answer is often yes. That surprises people!
Add a wait (0.5) seconds between the kick and the return. Will the frog go further? Guess first. The wait gives the hop time to finish before the legs come back.
Try move [backward v] first and forward second. Which way does your build really push? On some frogs, the legs are fixed the other way round. Then the whole program runs backwards.
Step 2 is what this lesson is all about. Same motors, same degrees, same speed, same number of hops. But the frog moves in a totally different way. Four blocks in a row cannot do what one block does for a pair.
“At the same time” is something you must ask for. A program does one thing after another, unless you say otherwise.
This is what you are building: the Mechanical Frog.
Build it 15 min
Build the model before you read any further. Everything after this is about making it do something, and none of it will make much sense with nothing on the table in front of you.
Fullscreen it while you build — you can pause and scrub with the player's own controls.
Check the finished build against the picture before you switch anything on. A motor mounted the wrong way round is far easier to spot now than it is to debug later, when it looks like a program fault.
Make it move 10 min
Six blocks: two settings, then a loop that kicks and comes back. Notice there is not a single [B v] run block in it. The whole program talks to the pair.
when program starts :: events hat
set movement motors to [B v] and [C v] :: movement
set movement speed to (100) % :: movement
repeat (5)
move [forward v] for (90) [degrees v] :: movement
move [backward v] for (90) [degrees v] :: movement
end
Both legs kick back together, and both come back together. It does this five times. One block for each movement, not one block for each leg.
Read it in the order the Brick runs it:
set movement motors to B and C — a setting. Nothing moves. It tells the Brick which two ports are the pair from now on.
set movement speed to 100 % — also a setting, so nothing moves. A jump needs all the speed it can get.
repeat (5) — five hops.
move forward for 90 degrees — the kick. Both legs swing together, and the frog pushes itself along.
move backward for 90 degrees — the legs come back to where they started, ready for the next hop. The same amount back as forward, so the legs do not slowly creep round.
What success looks like: five hops in a fairly straight line. Both legs move as one. The frog ends up ahead of where it started. It will shuffle, not leap. That is the motors, not your program.
If it turns instead of going forward, check these in order. Are both motors the same kind? Are the legs fixed the same on both sides? Is a cable dragging on one side? Is one leg catching on the frame? Each of these is a build problem. None of them can be fixed in the program.
Challenges 27 min
Work through them in order — each is harder than the last. The extra challenge comes after all three, and it is meant to make you plan before you build.
Challenge 1
Make it hop straight. Mark a start line. Mark a finish line one metre away. Mark a lane as wide as your frog. Get the frog from start to finish. It must stay in the lane. Do three runs. All three must stay in the lane. Change nothing between runs.
Challenge 2
Find the best kick. Test at least four kick angles. Each time, let it do five hops and see how far it went. Tell us which angle went furthest. Then say why the biggest angle is not always the best one.
Challenge 3
Make it turn on purpose. Use the Movement blocks. Make the frog hop forward three times. Then turn it to face a new way. Then hop three more. You must plan the turn. It must be the same size every time. It is not the wobble off course that you have been trying to stop.
Extra challenge
Get it as close to a real jump as you can. Then say truly how close that is.
The guide says these motors are not fast enough. They cannot lift the model off the ground. Your job is to find out if that is true. Change anything you like on the build and the program. Try leg length, kick angle and speed. Try where the weight sits, and how the legs meet the ground. Get the frog to go as far as it can in five hops.
Plan on paper before you build it again. A jump needs the legs to keep pushing while the body is already moving fast. So find the change that gives a longer push, not just a harder one.
Two questions when you show it. Did any part of your frog leave the ground? How do you know, and not just think? And which change helped the most? Show the numbers that prove it.