Robots on tour!

Public summary: 

Learn to programme LEGO Mindstorms and learn about IF statements and LOOPs.

Challenges that can be done with robots in a relativley short time period.
Useful information
Kit List: 

Lego Mindstorms EV3 Robot kit (There are four robots in two cases)
18 x AA Batteries (Currently there are 16 rechargeable and 2 non rechargeable)
2 x Recharge stations
1 x Green fabric with blue fabric "pond" sewn on

Packing Away: 

Close the mindstorms program and turn off the computer and robots.
Remove the cables that connect the EV3 Brick from the motors and the sensor and place them in the yellow box.
Disconnect the EV3 Brick from the rest of the robot. This should be simple to do as the base has been designed so that this can be done without difficulty
Take the batteries out of the EV3 Brick and put them into the yellow box. Ensure all batteries, especially those which are charging are placed in the box too.
Take the sensor off the robot. This and the EV3 Brick should be placed in the yellow box
The base which should still include the motors should be wrapped in the bubble wrap it came in.
The bubble wrapped frame and mat go into the same carrier bag.
The laptop and its charger should be put back into its bag.

Frequency of use: 

Set up:

For the computer:
Turn on the CHaOS laptop (currently 2,3 and 4 have the software installed but it is free to download from the lego website)
To login the password is CHaOS (capitalised correctly)
Start the lego mindstorms program
Go to file -> new project. If you want to be able to find programs you have created more easily I recommend you go file -> save as.
It is also possible to double click on the program name to rename it. At public events I like to ask children their names and name it that so which program is theirs can be easily seen.

For the robot:
If you aren't sure of the level of charge immediately start charging its batteries
If you are confident the batteries are suitably charged, put the batteries into the EV3 Brick.
If the robot is damaged, fix it (I need to take pictures so everybody knows what it looked like).
The Ev3 Brick should be put onto the robots base.
Connect the colour sensor to port 3, and the motors to ports B and C. The motor wires should cross due to way the steering works

The programming
Ideally you should experiment with the robot before you start demonstrating. All programs consist of series of blocks that contain instructions which the robot will follow in order.
There are four blocks that I use more than the others:
Green Tab, 3 along. This is "Move Steering" with this you can control which direction the robot turns and how tightly, which direction it will travel and how fast and how long it will do so for. Alternatives to this would be the "Move Tank" and "Large motor" Blocks which I feel are less intuitive
Green Tab, 7 along. This is "Brick Status Light". It can be set to three different colours and be on continuously or flash. It is useful for identifying sensor inputs easily. An alternative to this would be the "Sound" block which I find is too quiet too be heard in a room full of children. The "Display" block can also be used too.
Orange Tab, 3 along. This is the "Loop" Block. Loops are an important concept in programming and quite simple. It works especially well in combination with the next block.
Orange Tab, 4 along. This is the "Switch" block and is the most interesting block I frequently use as it allows the robot to make decisions based on inputs. I use the colour sensor but if you wanted to make modifications there is potential for other sensors to be used. If you want to follow the edge of a colour I would recommend using compare colour. If you wanted to stay with in a coloured area separated by two different colours you would use measure colour. Compare is more reliable as it can tell whether or not something is a certain colour quite well, but with measure it can be hard to determine what the robot will decide it is e.g. purple when you are asking it to choose between red and blue. The two 'paths' of the switch should have the robot turning different directions or travelling in different directions in order for something interesting to be observed.

There's full support for variables (but that doesn't mean you want to use them and it's easier if you don't however for advanced groups) you drop a variable box to create a variable ad it's name is in the upper right and it's data type in the lower left. Operations performed using maths boxes and the lower left box sets the operation and the next two boxes the arguments, these can be variables connected via a data wire. The output can be saved as a variable using a data wire and setting data type as write number.

I start off by asking them their names so that we have an easily identifiable program (In schools the groups will likely be too large for this. I then ask them, what do robots do? You will get a range of different responses, sometimes close to the answer of "they follow instructions". I then introduce the program to them and tell them that the blocks are just instructions for the robot.

Depending on the age of the children you can ask them what they want it to do e.g. "Do you want it to turn left or right?" and program it yourself or tell them "this slider controls how it will turn" and let them do it. After they have made their block they need to download the program to the robot.

Connect the cable to the computers USB port and the pc port on the output side of the robot. Press the download arrow in the bottom right of the screen. It may be grayed out if you have just connected the robot. After you have pressed download the robot will make a noise. This means it has downloaded. You will now need to look for your program on the robot. Go to the file tab, pick the correct project, then scroll down to the correct name. Get the child to verify that that is their name on the program that is about to be run. Place the robot in a suitable space and let them press the middle grey button.

You can then move on to making the program more complex, normally by making lights flash and a second movement block. If you think they are mature enough move on to using the sensor. Delete the previous program and put the loop and switch in place. Let them chose what they want in each option but give hints so that it ends up doing something interesting.

If they really want to do more let them, but I normally end by discussing in which jobs are robots most useful. The boring ones (painting cars), and the dangerous ones (missions to mars).

To get ready for the next child create a new program and keep the old ones as some may do interesting things which take time to program. However keeping too many programs can resulting in downloading taking more time.

Advice for demonstrating in Schools:
- It is more important that you don't keep the children for too long, this experiment can easily take 20 minutes if you try to get them to do the line following even with significant prompting.
- Try to ensure that all students make an input to the program, this becomes more difficult with larger groups
- For primary school students it is probably fine to ignore the sensor completely and just let them play around making a basic program with flashing lights, sounds and movement.
- For older secondary age (Y9+) students you should try to get them to do line following.
- For children in Y7&Y8 ask them whether they want a challenge (line following) or just to play around.

Braitenberg Vehicles - fast to demonstrate, easy to explain, but still produces complex behaviour

A possible easy way to demo robots is to teach the kids about some of the earliest robots - things called “Braitenberg Vehicles”. To set this up, just hook up some light sensors to output numbers straight to the motors. If we have two light sensors, each outputting light-intensity, and we just whack those numbers into the motors, we can create some “life-like” behaviour. Setting this up means you have to have a light sensor on either side of the robot, and feeding that number to the “move tank” block by using the variable drag and drop lines on Mindstorms:

There are two possible behaviours, where the robot will speed towards lights, or speed until they’re facing away from them, “aggressive” (charges towards lights in a search-and-destroy fashion - this might be part of the reason Moths fly towards lights, I think I read that they have a biological feedback similar to this) and “cowardly” (runs like crazy to get away from light):

If we multiply the sensor output by -1 (use an arithmetic block), then another two behaviours are possible, “explorer” (goes all over the place), and “loving” (lovingly and slowly approaches the lights). You can let the kids fiddle with the numbers and rewire the sensors to other motors.

Depending on age and time, you can use the Braitenberg vehicles to talk about perception-action loops - what's the loop going on here, what about if we wanted to give it instructions, what about if the robot is now on the moon and we want to give it instructions, what problems are there now (the moon is 1 light second away...). Could also talk about reactive vs deliberative behaviour - are the vehicles reactive or deliberative, why? (reactive because there's no planning going on, you could mention that they don't need to remember anything).

For people who really know what's going on, you could talk about vehicles with more sensors - you can combine them in lots of different ways, even having multiple sensors wired to each (motor) output... if the outputs are a linear combination of the inputs, we have a complicated Braitenberg vehicle. But... if we want a non-linear combination of the input variables, then we can use a neural network to add up inputs in any which way we want. Now you could get them thinking about their bodies... we have a series of inputs (feel, smell, sight etc.), which go through something inside our skull which is a bit like a neural network... which outputs to a series of actuators (muscles). Proceed into philosophical discussion about consciousness until the kids are either forced to leave by terror or boredom.

PLUS Explanation

The line following works well for this age as most have not done significant amounts of programming so it will still be a challenge. For students who complete that quickly you can push them further. Instruct them to start far from the blue and travel in a straight line until they hit the pond then follow it around, stopping when they get to a red piece of card.

You should not let yourself be restricted by these instructions if you have other ideas of how to run this. There is a huge potential of things that could be done.

The below sections are not part of a demonstration but are retained as they could be used in future designs


A simple maze can be created with the wooden blocks or cardboard. The challenge is to program the robot so that it can navigate its way through the maze without any outside influence once it has started. This can be be done in several ways that progressively advance in difficulty:
1. Dead reckoning: the robot is programmed to move forward a certain angle, turn, move forward another certain amount and so on. This requires no sensor use and the robot is likely to generate errors in its positioning as it moves further. The robot could potentially fitted with a missile to try and hit targets once it has been through the maze.
2. Sensors with knowledge of the maze: The robot is equipped with touch/light sensors on its front and detects when it hits an obstacle. With knowledge of the maze, it will be possible for children to have set the correct direction for the robot to turn. The robot should be able to progress through the maze with smaller errors.
3. Sensors and a generic maze: The robot will be programmed to turn whenever it hits an obstacle and if that turn leads to another obstacle it will turn the other way. Through use of counters it could even find its own way back through the maze with little crashing. Sensors on the sides could be used to correct its course if it has a glancing impact with the wall.
4. Maze with coloured tiles. Using the ability of the robots to detect colours we can tell them to perform certain actions when they see a certain colour.
This compares well with the simple Turtle Robots which are often used like this and you can read the RA for that to find information about programming them in this style.

Robot Writer

The A3 sheet will be placed under the wooden blocks used for the maze so that it does not slide. The robot will be equipped with a pen holder arm that will be raised or lowered as necessary. This arm could be stationary relative to the robot or could move, allowing more effective writing to be used. The movements are likely to be by dead reckoning.
Children could be instructed to program the robot to make letters of the alphabet and write words. A simple task could be for them to write the word CHaOS. They would create a sub-program for the letter "H" and then add it to to subprograms created by the demonstrator that write the other letters.
Potential inputs could be morse code claps to be picked up by a microphone and subsequently written down by the robot. This bit is likely to be too advanced for the time we have but could be used in less time sensitive places such as public events.

Risk Assessment
Date risk assesment last checked: 
Thu, 30/01/2020
Risk assesment checked by: 
Conor Cafolla
Date risk assesment double checked: 
Thu, 30/01/2020
Risk assesment double-checked by: 
Beatrix Huissoon
Risk Assessment: 
Description Laptops with NXT programming software installed:
Hazard Risk Affected Person(s) Likelihood Severity Overall Mitigation Likelihood Severity Overall
Power cables Trip hazard. All 4 3 12 Ensure wires are either taped securely to surfaces, or are placed behind tables, so no one walking past will catch themselves on the wires.
In case of an accident, turn off power at the mains, do not touch any other components, such as the laptop or its battery. Call first aider.
2 3 6
Electrical components Various risks associated with electrical components All 3 3 9 All laptop chargers will be PAT checked for safety and will be kept out of reach of children.
See electrical parts RA.
1 3 3
Description Lego Mindstorms NXT Kit
Kit consists of control brick, with enclosed batteries, associated cables to connect the brick to peripherals, and Lego pieces to construct robots with. Motors and sensors are also provided:
Hazard Risk Affected Person(s) Likelihood Severity Overall Mitigation Likelihood Severity Overall
Small Lego parts Choking hazard for small Lego components Mainly small children 4 3 12 All visitors will be monitored regularly by demonstrators to ensure they do not put Lego in their mouths. The robots are largely pre-built, minimising visitors' use of individual parts, and any modifications will be supervised by a demonstrator. Particularly young children will be supervised closely, though it is unlikely that very young children will be present as the workshop is targeted at older children.
Call a first aider if choking occurs.
1 3 3
Motors Short circuits in motors. All 2 2 4 Motors are sealed in a robust manner, so any short circuits will result in a simple failure, with no risk to users. In the very unlikely event of an exposed short, voltages and currents used are very low (powered by 4 AA batteries), so present no significant risk to users.
If short circuit occurs, power down the robot and do not use the kit further. Call a first aider if required, though risk here is minimal.
2 1 2
Motors Objects wrapping around motors i.e. hair. All, particularly those with long hair 4 2 8 Motors are sealed, so hair is unlikely to be caught, though it may be caught by gearing systems. All visitors will be made aware of the risk and asked to ensure any dangling objects on their person are kept out of the way and advised to tie long hair up if they might lean near the gearing system. They will also be made aware of the emergency stop, which will shut off all motors instantaneously.
Immediately stop robot if anything is caught in motors. Call a first aider if required.
1 2 2
Robots Robots/laptops falling off tables and hitting small children/sitting children. Children 3 2 6 Robots should be used on the floor unless they are immobile or all children present are standing and have their heads above the edge of the table.
Laptops if used on tables shouldn't be moving around, and should be far enough away from table edges.
Call a first aider if required.
1 2 2
This experiment contains mains electrical parts, see separate risk assessment.