Lift-Off with CodeX - Mission 8: Prepare Lander!
Prepare Lander
Getting to Mars is the easy part. Students build a complete ground sensing system out of several peripherals and write code that walks the spacecraft through the phases of a landing.
Overview
Another small step for mankind. Getting safely to Mars is the easy part, landing safely is where the fun starts. In this mission students put together a complete ground sensing system from several peripherals at once, then write the code that decides what the spacecraft does at each point in the descent.
The object sensor is the new piece of hardware, and it takes a screwdriver and a ruler to adjust it to the manufacturer's specification. Once it is dialed in, students combine it with the microswitch, the NeoPixel ring, and the 180 positional servo. Phases, or states, return from Mission 7, and here they are doing more work: the state variable controls the lighting and the servo, and two different input peripherals move the program from one state to the next.
🎯 Mission Goal: Students write code to simulate landing the spacecraft.
Learning Targets
- I can connect and adjust the object sensor.
- I can change the position of the 180 servo.
- I can use the object sensor to trigger an event.
- I can use the microswitch to trigger an event.
- I can use states and a state variable to control the NeoPixel ring and 180 servo.
Key Concepts
- A variable that represents the state, or phase, allows the program to remember information about events.
- Different input peripherals can be used in the same program to change the state and trigger events.
Assessment Opportunities
- Check for Understanding in CodeSpace
- Mission 8 Assignment
-
Explain the steps, or how the
set_lighting()function works - Exit ticket - draw a diagram of the states of the program
- Submit and/or check the PrepareLander program
- Journal entry on their learning experience
Success Criteria
- Connect an object sensor to the CodeX and adjust it to the manufacturer specifications.
- Use the object sensor to trigger an event.
- Use the microswitch to trigger an event.
- Use a variable for states to control the NeoPixel ring and 180 servo.
Digital Resources
Classroom Materials
- ▸Laptop/computer with the Chrome browser
- ▸CodeX and connecting cable
- ▸Small Phillips screwdriver
- ▸Small ruler with millimeters
- ▸NeoPixel ring
- ▸Object sensor
- ▸Microswitch
- ▸180 positional servo and servo horn
Real-World Applications
Extensions & Cross-Curricular
🔤
Vocabulary
▾
🐍
New Python Code
▾
📐
Standards
▾
CSTA Standards - Grades 6-8
CSTA Standards - Grades 9-10
CSTA Standards - Grades 11-12
- Students need a computer or laptop with the Chrome web browser.
- Make sure students can successfully log in to make.firialabs.com.
- Gather enough small Phillips screwdrivers and millimeter rulers for students to share. They are needed to adjust the object sensor.
- Adjust one object sensor yourself before class so you know how far the screw has to turn and what the indicator light does when it detects something.
- Pull one servo horn per servo and set the extra horns and screws aside before you hand out the peripherals.
- The screwdriver and small ruler are used to adjust the object sensor. Students measure the detection distance and turn the screw until the sensor triggers where the manufacturer says it should.
- This is the biggest build in the pack so far, with four peripherals in one program. Have students connect and test each one on its own before they combine them.
-
The pull property is new here. If a digital input reads as triggered when nothing is connected to it, that is what
pull=digitalio.Pull.UPfixes. - States return from Mission 7 and carry more weight in this program. A state diagram on the board, drawn before anyone types, saves a lot of debugging later.
- Extensions and cross-curricular projects are included to enhance the concepts in the mission. You can use the extensions to extend students' programming experience. A remix is not explicitly planned here, but you can add one as an option to give students additional learning. The next remix comes after Mission 9.
Lesson Outline
Students access prior knowledge by answering the pre-mission questions in the assignment doc.
- Ask: "Getting to Mars is one problem. Landing on it is another. What does a spacecraft need to know on the way down?"
- Ask: "How would a machine know it has touched the ground? What could it measure to be sure?"
Front-load the new hardware and the state model before students start typing.
- Pass around the object sensor. Point out the infrared emitter and detector, and the adjustment screw that sets the detection distance.
- Demonstrate the adjustment with a screwdriver and a millimeter ruler so students see what "manufacturer specification" means in practice.
-
Introduce the pull property and show what
pull=digitalio.Pull.UPdoes to a digital input with nothing connected to it. - Sketch the states of the landing on the board, along with the input that moves the program from each one to the next.
Students work through the mission objectives in CodeSpace, taking notes and answering questions in their assignment doc as they go.
- Connect the object sensor to the CodeX and adjust it with the screwdriver and ruler until it triggers at the right distance.
- Read the object sensor in code and use it to trigger an event.
- Connect the microswitch and use it to trigger a second event.
-
Write the
set_lighting()function to fill the NeoPixel ring with a color for the current phase. - Build PrepareLander using a state variable to control the NeoPixel ring and the 180 servo through each phase of the landing.
- Complete the Check for Understanding in CodeSpace.
Bring the class back together to lock in states, transitions, and the role of each sensor.
- Ask: "What are the states in your program, and what has to happen to move from one to the next?"
- Ask: "Which sensor triggers which event, and why does each one fit its job?"
-
Ask: "Walk me through what
set_lighting()does, step by step."
Students answer the reflection question in the assignment doc, add a journal entry about their learning experience, and submit.
Use the Mission 8 Review Questions or the Mission 8 Review Kahoot! through whichever method you prefer, class discussion, Kahoot!, or an LMS quiz.