Our school purchased several LEGO Mindstorms NXT robotics kits last year, and I have successfully used them with grade 11 and 12 ITGS students to help them with the Higher Level topic Artificial Intelligence, Robotics, and Expert Systems. This year, we wanted to expand the use of the robots into grade 8 ICT classes, where students already learn programming skills using MIT’s Scratch and a variety of other tools. Inspired by the updates from the Mars Curiosity rover, we decided to base our grade 8 project on designing, building, and programming a Martian exploration robot. Thus, the Mars Explorer Robot project was born.
The Mars Explorer Robot challenge was designed to help students understand the challenges faced by robot designers and programmers when dealing with the real world, and to provide a practical and realistic environment to apply their programming skills. We decided to set three key challenges similar to those faced by real robots like Curiosity (in increasing order of difficulty):
- Navigation / obstacle avoidance
- Gathering a sample of solid substances (rocks)
- Taking a temperature measurement from a reservoir of liquid
Robots and Hardware
Each group of students was given the standard Lego Mindstorms NXT 2.0 kit (Update: this has now been superceded by the Lego Mindstorms EV3 kit). Each kit includes three motors for output, an ultrasonic sensor, a colour sensor, and two touch sensors.
If we ran the project again we would probably add an additional motor to each kit, making it easier to attach both the claw (for the rock samples) and the temperature probe (for the liquid) at the same time. These motors can easily be purchased separately.
The thermometers were part of a standard Vernier data logging pack that many schools have (in fact, they offer a lot of sensors that could be very useful in Lego Mindstorms projects). Vernier manufactures a separate sensor adapter to connect these to the Lego NXT brick. A freely downloadable add-in makes these usable with the Lego NXT-G software, and they can also be accessed using the raw sensor functions in the NXC programming language.
Software and programming experience
Prior to embarking on this project, students had experience with Scratch programming. This helped familiarise them with programming paradigms, and the ‘building block’ approach is quite similar to that used by the Lego NXT-G software. That said, all students were also given a chance to use the excellent NXC programming language and the BrixCC environment, and most ended up preferring this to Lego’s own software.
After their introductory programming lessons using Scratch, the students worked on a few related robotics topics before embarking on the Mars Explorer Robot project. These lessons covered:
- The latest developments in robotic technology
- Robots in industry and business and their effects on people
- Driverless vehicles and the technologies they use to sense their surroundings
- Robotic exploration of Mars, including the Spirit and Opportunity rovers, and Curiosity.
- Lego Mindstorms introduction, with students programming the robots to perform a variety of simple tasks (download the cards here)
These lessons helped give students an understanding of the challenges faced by robot designers, as well as the technical skills to use the Lego Mindstorms kits effectively.
Creating the Mars Terrain
The basic design for the terrain was to have robots start in the south-westerly corner, with the rock and liquid samples being placed in the north-west and north-east corners respectively. A central mountainous area would either have to be avoided or negotiated (depending on their robot design) in order to reach these goals.For portability reasons the Martian terrain needed to be lightweight, yet it also required sufficient space to allow the robots to roam (the competition would require robots to run one at a time to avoid interference with each other). A wooden base, approximately 180 cm by 180 cm, was constructed with sides 2 inches high to provide reinforcement (these also provide a good barrier to prevent stray robots going off across the classroom).
We decided against using sand or gravel to create the Martian hills to reduce the potential mess created – we didn’t fancy spending the holidays cleaning sand out of Lego blocks and NXT connectors. Instead, we chose to create contours using a combination of wire mesh (chicken wire) and papier-mâché. To support the weight of the robots, pieces of scrap wood were glue to the wooden base in the rough shape of the contours we wanted.
Ultimately, three out of four groups had functioning robots that were able to attempt the rock sample grab. Of these, two managed to successfully grab the rocks during the final competition, while the third had achieved this goal in practice runs but didn’t manage it on the day.
None of the teams’ robots managed to sample the temperature of the liquid. The biggest challenge in this case was actually detecting the location of the container (which is not at all easy). Overall:
- The uneven Martian terrain was a serious challenge for some groups – there were lots of spills during practice as robots became stuck or even rolled over!
- Some of the more successful designs were the simple ones: attempts at tricycles, suspension systems, and novel steering methods typically resulted in failure.
- Several teams thought to use the Mindstorms’ colour sensor – but in reality it is too sensitive to ambient light to be useful. Hopefully this will improve in the upcoming Mindstorms EV3 kit.
Adapting and Extending the Project
- For younger students the route could be pre-planned, with students making the robots move a fixed distance before performing each task, rather than using the sensors.
- For even younger students, robots could be built and then controlled using MINDdroid – a free app for Android phones
- Students in this project performed initial design work on their projects. A way to improve this in the future might be to use Lego’s Digital Designer software (which includes a Mindstorms mode) to plan their creations.
- To focus on programming skills, to complete the project in less time, or with a limited number of robotics kits, students could be given a standard robot model and create their own code to control it.
There are numerous books available with building and programming ideas for the Lego Mindstorms robots. The ones I have found most useful are described below. All the books below are available from The Book Depository with free worldwide shipping (very useful for international schools):
LEGO Mindstorms NXT – The Mayan Adventure is designed for younger students. It provides a series of increasingly difficult programming exercises, each tied to a specific task – in this case, exploring an ancient Mayan tomb (a separate book, The King’s Treasure, takes a similar approach in a different environment). This is an engaging approach that keeps students interested. The book is broken down into smaller puzzles, each of which tackles part of the overall goal (exploring the tomb). Free solution sheets as well as other material are available on the support web site, which helps extend the life of the book. Read a full review.
The Lego Mindstorms NXT Discovery Book and Lego Mindstorms NXT Inventor’s Guide are both excellent books, featuring building instructions for a series of models (8 and 6 robots, respectively). The early part of the books introduce basic programming concepts before moving on to programming using sensors, and then the main building and programming instructions. One thing I really like about these books is the clear, CAD-style building instructions that look very similar to Lego’s own instructions, and make them very easy to follow.
Power Programming: Robotics in C is designed for more advanced Mindstorms users who use the freely available NXC (Not eXactly C) programming language. Younger students will find the book quite hard to understand, but it is still a useful reference for older students and for teachers. Power Programming does not include exercises or tutorials; it is purely a reference work.
The next Lego Mindstorms competition project? Maybe something based on DARPA’s Urban Challenge….