Robogator: Your Fearless LEGO Mindstorms Guardian

Robogator is the second construction suggested by the LEGO Mindstorms 8547 Set. It is a robot that imitate a crocodile and has a moving jaw and four legs which are used to patrol and defend a position. Personally I haven’t found this one really fun to build or impressive to watch, but it has been awesome to learn more about NXT-G coding.


This second guide will put some light on Robogator, your own crocodile LEGO Mindstorms robot. Robogator uses the three NXT Motors, both Touch sensors and Ultrasonic sensor. As with ShooterBot, the task of building the complete robot is split in steps that are easier to achieve.

See Robogator in action

1st Step: Build the moving jaws

If you want to defend your place you need the biggest, strongest jaws out there. Here we will need to use the NXT Motor to build a LEGO jaw instead. So, put your plans to conquer the world to a side and keep reading.

Just follow LEGO instructions to build the moving jaw that will use also the Ultrasonic Sensor. It is a fairly easy construction even for someone so new to LEGO Technic as me, so you shouldn’t have any major problems building it.

NXT-G Program: Detect and Open and Close Jaws

Next, just write the program to open and close the jaw in NXT-G application. Just play a bit with the values of time and make sure not to force the motor by opening the jaw too much. I suggest you change the motor power from 75 to 100 for a more cool looking moving jaw that really bite! Beware with your fingers!.


Problems and bugs

Problem: NXT Brick not found

I have had this one several times. Is the USB cable plugged? Did you turn on the NXT Brick?
One of the times my Mac Book went nuts and it didn’t recognize the NXT Brick. Rebooting fixed the problem.

Problem: Robogator jaws open too much or too little

If you recall, when we wrote the program we configured the A Motor to move in one direction and then in the other for a small amount of time… so check:
– That the motor is really plugged
– That the direction of the motor is correct. Maybe the jaws are moving on the other direction? Check it.
– Did you correctly wrote the time, try increasing the value ( for both directions )

Problem: Robogator doesn’t detect my hand

Well, the Ultrasonic sensor that comes with Mindstorms is far from perfect, or even good, so make sure you move your hand slightly over the jaws or it won’t be detected.
Of course, just make sure that you plugged it correctly ( Port 4 ) and that you added the Wait Block for it.

2nd Step: Making Robogator move forward and backward

Now we build the body of our Robogator, just make sure you plug the motor in the correct way. Although in this model it isn’t really important as long as the jaws are plugged in motor A.

So once you have the body built, you will have something similar to this.

So let’s go back to NXT-G and let’s code the behaviour.

NXT-G Program: Walk Forward and Bit

This is a quite interesting program and the first one to use two threads of execution.


The upper part controls the body of our Robogator so that it moves the crocodile forward if we are far from the detected thread until it is barely 20cm away.
On the other hand, the lower part of the program takes care of moving the jaw.

So, the trick? The lower part of the program only moves the jaw when the detected object is at less than 30cm of range. This program is a great example of how complex behaviours can be split in simpler tasks and executed in parallel.

Overall, it is usually not a good idea to add many threads to our NXT-G programs, just keep that in mind.

Problems and bugs

If it doesn’t work check that the cables are correctly plugged and also check that there is something really in front of the Ultrasonic Sensor. It is a bit blind sometimes so make sure that it is something big.

If it doesn’t bite make sure you connected the lower branch of code to the upper part. The color will change.

3rd Step: Patrol and Protect its Territory

This last part is something like “See, we can also add touch sensors here”. Personally I don’t see much of the point of it and it could have been done without them. The overall gain here is that our Robogator will end with the legs on the foot each time it moves.

NXT-G Program: Patrol


Don’t be intimidated by how complex it looks. In fact I think it is as simple as the first step. This program just moves each leg until it touch the press sensor and then it does detect anything it will launch our crocodile forward for a few turns and then back again. On a different thread we has the jaw operating much like the above program, when it detects anything it opens and closes the mouth.


It is a cool robot to build and quite big! My kid loved it and the coding introduced the concept of parallel execution with NXT-G.

Personally I prefer ShooterBot because it was more like a robot, and although Robogator looks great and really looks like a crocodile it doesn’t reach such subtle beauty that the little robot base had.

Anyway, interesting model to build. And I have learned a lot.

Miguel says 8/10
Building experience
Value for money


You can buy LEGO Mindstorms 8547 Set at Amazon… but personally I won’t. I would wait a few months for the upcoming Mindstorms EV3 Set.

1 thought on “Robogator: Your Fearless LEGO Mindstorms Guardian”

  1. Pingback: LEGO Mindstorms Arm: Sorting color balls like a PRO | The Technic Gear

Leave a Comment