Lesson Overview


This is an open-ended programming lesson that models cell movement towards light. In this lesson, students are introduced to the idea of outlining a program as a series of scenarios and responses. They are also exposed to the engineering method (like the scientific method, but for engineers). They are given a program called Phototaxis_Prog that has 2 to 3 code blocks offered for each scenario. Each group is asked to build their own phototaxis program by assembling the code blocks into a functioning program. The student groups are then asked to improve upon the program in any way they would like, provided they use the engineering method to improve on their program.  

Big Idea(s)

Phototaxis is a behavior where cells sense light and respond by moving towards light.

Flow charts are an effective way to diagram a program.

When developing a program, it’s helpful to think of it in terms of scenarios, situations that will happen while the program is running, and responses to those scenarios.

Engineers, as opposed to scientists, solve problems rather than answer questions.

Engineers define specifications to help them identify when they have solved a problem.

Vocabulary words





    • Lego Mindstorm EV3 robot – default assembly. Follow the instructions found here to build https://education.lego.com/en-us/support/mindstorms-ev3/building-instructions#robot (color sensor forward, cuboid, driving base, gyro sensor, medium motor driving base, touch sensor driving base, ultrasonic sensor driving base. Note: EV3’s borrowed from the Resource Center will already be built in the default assembly and will be pre-downloaded with Mystery Program)
    • Pen lights
    • Phototaxis Program worksheet
    • Phototaxis_Prog open roberta program
    • Robot Quick Start Guide

Daly Ralson Resource Center:

Lego Mindstorm EV3 robot (E779, E780, E781, E782, E783, E784, E785)

Pen lights (E140)


Groups of 3-4 students


1 hour total

15 min – Intro

45 min – Investigation/Coding

Prerequisites for students

Students should have experience working with the EV3 robot and beginner programming knowledge. It is also helpful to have them walk through the programming module for this course so they are familiar with Open Roberta before starting this activity.  

Learning goals/objectives for students
  • Learn the definition of phototaxis and ways in which this strategy might be useful to organisms that need light to survive.
  • Begin to think of programming in terms of “scenarios” and responses to those scenarios
  • Understand and apply the engineering design process of “design, build, test”.
  • Apply engineering problem solving to a programming challenge by identifying a problem and specifying the requirements needed for a authentic solution.
  • Apply their programming knowledge to improve a preexisting program.
Content background for instructor

One way to think about organizing and developing a program is with “scenario” thinking. At any point during a program, the robot will encounter a set number of scenarios. It is the job of the programmer to identify all scenarios and come up with an appropriate response for the robot in the case of each scenario, so that the robot functions correctly.

Just like there is no one correct program, there is no one correct number of scenarios or responses. Each will vary depending on the program and their design specifications.

Getting ready

Share Phototaxis_Prog with all of your students. Make sure all robots have two color sensors, one attached to port 1 and one to part 3. You can have your students do this, or you can set up the sensors before the activity begins.  Each group will need a flashlight or pen light.

Lesson Implementation/Outline


(15 mins)

Introduce the concept of programming in terms of scenarios to students. This method is helpful, for the types of program we will use in this activity. There are many ways to tackle a programming challenge. This is just one of them.

Scenarios are situations that you’d expect for the robot. Done correctly, the programmer should account for all possible scenarios, but it will look different depending on the program and the programmer. Just like there isn’t one correct solution to every design challenge or program, there isn’t one correct number of scenarios.

Give the students an example of scenarios. My examples is standing in an elevator. When the door opens, I envision three scenarios (1. I know the person who enters, 2. I don’t know the person who enters, 3. I’m not sure if I know the person who enters). The important points with this example are:

  • I believe I have covered all possible scenarios (There is no perfect number of scenarios, just as there are many ways to program a robot correctly!)
  • I’ve tried to generalize (Instead of saying: Scenario 1 = Tom enters the elevator, Scenario 2 = Josephine enters the elevator, Scenario 3= etc. etc. I am generalizing so that I’m left with three categories.)
  • I then come up with my response to each scenario: 1. I know them and I say “Hi.”, 2. I don’t know them and I stare at the elevator buttons, 3. I’m not sure and I pretend to stare at the elevator buttons.

As the instructor, you can come up with your own example as long as it can demonstrate generalization of scenarios, covering all possible scenarios (although this will never be perfect, and it’s important to point that out.), and reasonable responses to each scenario.

In the case of a phototaxis program, the robot will have two sensors (sensor port 1 and sensor port 3). Possible scenarios for light sensing include: 1. sensor 1 and sensor 3 see an equal amount of light, 2. sensor 1 sees more than sensor 3, and 3. sensor 3 sees more than sensor 1. One could argue that another scenario is sensor 1 and 3 see no light, but if both sensor 1 and 3 see no light (zero light) sensor 1 and 3 are equal and are therefore covered by the first scenario. However, it might be helpful for you to program a different response to no light or low light (i.e. turn around). This, again, is an example of how there is never one perfect set of scenarios for a given program.

Show the flow chart to students so they can see how it is arranged.  It is very similar to the mystery program flow chart.

Walk the students through the structure of Phototaxis_Prog. The greyed out portions of the program will be ignored unless they are connected a start block.  They can choose from several Scenario 1, Scenario 2, and Scenario 3 blocks, but their final program must include blocks for all three scenarios (there is one block that combines Scenario 2 and 3, and if used they would only need two blocks).

Once student groups have a working phototaxis program (it moves toward the flashlight in most cases). They will then need to improve on their program.

Present the difference between the Engineering Method and the Scientific Method.  Important points:

  • Science: a question solved by observation and investigation
  • Engineering: a problem solved by design and innovation
  • Engineers do the following steps
    • Define a problem
    • Preform background research
    • Specify requirements
    • Design, build, test
      • Repeat the above step until you have a prototype that satisfies all design requirements.

(45 mins)

Turn off the lights in your classroom so that the robots will be more responsive to the flash lights. Have all student groups build their phototaxis program from Phototaxis_Prog, being sure to include all three scenarios. Have all student groups send the assembled Phototaxis_Prog to the robot and check to see if it worked.

After they have developed a working phototaxis program, have them improve on that program. The blocks including in Phototaxis_Prog are intentionally simple. This gives space for students to be creative. They can speed up the robot’s ability to find light, program a response when no or low light is detected, create a robot that will find light even if the light source is behind the robot, etc..

Checking for student understanding

Walk around the room as students are assembling a working phototaxis program from the scenarios and code blocks in Phototaxis_Prog. Not all combinations will work. Programs that have similarly coded scenario 2 and 3 will work best. If a student’s program works sporadically, check to see which scenario 2 and 3 they have chosen.  It also works best to have the code block for scenario 1 first, followed by scenario 2 and 3.

If the program does not work at all (error messages), check to make sure the students’ robot has the correct configuration (robot configuration tab should include two color sensors, one in port 1 and one in port 3).

As students are beginning to improve on their phototaxis program, walk around the room and ensure that they are organizing their design by using design requirements. This well help group communication and make sure everyone is on the same page.  Ask questions like “What are your design requirements?” “How will you know you’ve completed your program?” “What do you want your robot to do when you have a working program?”


This program is usually presented as an open-ended challenge that allows student groups time to tinker without need to report their findings, but you can conclude this activity in several ways:

  • Have students turn in a final flow chart of their improved program including design specifications
  • Have students create a poster about their robot on chart paper. Present their robot design in a gallery walk
  • Present their robot design orally to the class. Include design specifications and a robot demo.



Structure and Function

Natural Selection and Evolution

ETS1 Engineering Design

ETS2 Links Among Engineering, Technology, Science, and Society

Performance Expectations

HS-LS1-3 From Molecules to Organisms: Structures and Processes

(Students model phototaxis, which uses positive feedback to move the robot toward a light source.)

HS-ETS1-2 Engineering Design

(The complex problem of developing a phototaxis program is broken down for students into three smaller problems, called scenarios (light is left, light is right, light is forward).)

HS-ETS1-3 Engineering Design

(After creating a phototaxis program by combining code blocks that address all three scenarios, students are challenged to improve on the phototaxis program by first considering what criteria should be prioritized to create “better” program. Each student group may come up with a different set of prioritized criteria.)

HS ETS1-4 Engineering Design

(Students are challenged to develop a program that models the real cellular behavior of phototaxis. As a group, students must come up with their own prioritized criteria for an improved phototaxis program. As a design constraint, their robot can only use two color sensors to detect and move towards light.)

Disciplinary Core Ideas

HS LS1.A Structure and Function

ETS1.A Defining and Delimiting Engineering Problems

ETS1.B Developing Possible Solutions

ETS1.C Optimizing the Design Solution

ETS2.A Interdependence of Science, Engineering, and Technology

(Science and engineering are connected through modeling and designing an observed cellular behavior like chemotaxis. Scientists and engineers collaborate in real cellular engineering labs to modeling cellular behavior in robots.)

Science and Engineering Practices

Practice 1. Asking Questions and Defining Problems

Practice 2. Developing and Using Models

Practice 3. Planning and Carrying Out Investigations

Practice 4. Analyzing and Interpreting Data

Practice 5. Using Mathematics and Computational Thinking

Practice 6. Constructing Explanations and Designing Solutions

Cross-Cutting Concepts


Cause and effect

Systems and System Models

Structure and Function

Stability and Change