Make a CNC Drawing Machine
Design, build, and program a machine that draws a pattern, performs the task accurately, and repeats the task.
- Read through this teacher material.
- If you feel it is needed, plan a lesson using the getting started material in the EV3 Lab Software or EV3 Programming App. This will help familiarize your students with LEGO® MINDSTORMS® Education EV3.
Engage (30 Min.)
- Use the ideas in the Ignite a Discussion section below to engage your students in a discussion related to this project.
- Explain the project.
- Split your class into teams of two students.
- Allow your students some time to brainstorm.
Explore (30 Min.)
- Have your students create multiple prototypes.
- Encourage them to explore both building and programming.
- Have each pair of students build and test two solutions.
- Provide them with a large sheet of graph paper and colored pencils or markers.
Explain (60 Min.)
- Ask your students to test their solutions and to choose the best one.
- Make sure they can create their own testing tables.
- Allow some time for each team to finalize their project and to collect assets for documenting their work.
Elaborate (60 Min.)
- Give your students some time to produce their final reports.
- Facilitate a sharing session in which each team presents their results.
- Give feedback on each student’s performance.
- You can use the assessment rubrics provided to simplify the process.
Ignite a Discussion
Computer numerical control (CNC) machines use pre-programmed instructions to control a tool along one or more axes with high precision. They are commonly used in computer-integrated manufacturing to turn a digital design on a computer into a physical object.
Encourage an active brainstorming process.
Ask your students to think about these questions:
- What is a CNC machine and where is it used?
- What is the best way to attach a pencil or marker?
- Which type of motorized mechanism can move the pencil or marker in two dimensions?
- What design features will ensure the machine’s movements are accurate and repeatable?
Encourage students to document their initial ideas and explain why they picked the solution they will use for their first prototype. Ask them to describe how they will evaluate their ideas throughout the project. That way, when they are reviewing and revising, they will have specific information they can use to evaluate their solution and decide whether or not it was effective.
Language Arts Extension
To incorporate language arts skills development, have your students:
- Use their written work, sketches, and/or photos to summarize their design process and create a final report
- Create a video demonstrating their design process starting with their initial ideas and ending with their completed project
- Create a presentation about their program
- Create a presentation that connects their project with real-world applications of similar systems and describes new inventions that could be made based on what they have created
Also, in this lesson, your students created a CNC drawing machine. CNC machines use computer-aided design (CAD) models created by a person to produce parts, products, and prototypes. These CAD models are represented by data stored by computers on local networks or in the cloud.
- Discuss and write about the advantages and disadvantages of storing CAD drawings on a single computer vs. a local network vs. in the cloud
- Keeping in mind that schools and educational software providers must protect student data, including their digital CAD drawings, write an informational essay outlining data privacy and how it relates to the online storage of student assignments
- Compare and contrast the data security concerns of an engineering company that stores CAD drawings online, and a school that stores student CAD drawings online
In this lesson, your students created a drawing machine. But what if their goal was to create a machine that could draw specific geometric shapes? What if they wanted their machine to get better and better at drawing specific shapes? One way of doing this would be to use a type of artificial intelligence called machine learning. In order to use machine learning, the system must be given training data to “teach” it what shapes are, and how to determine whether it has accurately produced a specific shape.
To incorporate math skills development, and practice applying these skills to the topic of machine learning, specifically the use of training data, have your students:
- Write the definitions of three basic geometric shapes (e.g., circle, square, equilateral triangle), and identify how these definitions must be changed if they're going to help a drawing robot produce each shape
- Write the definition of a specific geometric shape in a way that would help the drawing robot produce that shape in a particular size
- Look at the definitions they've just written, and create a training data table that will teach their robots the movements necessary to generate their chosen shapes
To further connect mathematical concepts and skills to this topic, ask these questions:
- What is artificial intelligence? How is it different from a set of prescribed commands? What role do mathematical models play in distinguishing between artificial intelligence and a simple list of commands?
- What would you do to change your robot’s design so that it could observe its surroundings and learn how to draw the shapes it sees?
Give your students an opportunity to build some examples from the links below. Encourage them to explore how these systems work and to brainstorm how these systems could inspire a solution to the Design Brief.
Encourage your students to design their own tests setup and procedure to select the best solution. These tips can help your students as they set up their test:
- Mark the position of the machine on the graph paper to help ensure that you place it in the same position for each test run.
- Use gridlines to identify 1 cm x 1 cm squares to help in recording the results of each test run.
- Create testing tables to record your observations.
- Evaluate the precision of your machine by comparing the expected results with the actual results.
- Repeat the test at least three times.
Here is a sample solution that meets the Design Brief criteria:
EV3 MicroPython Sample Program
#!/usr/bin/env pybricks-micropython from pybricks import ev3brick as brick from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor, GyroSensor) from pybricks.parameters import Port, Stop, Direction, Color, ImageFile from pybricks.tools import wait # Configure the turntable motor, which rotates the arm. It has a # 20-tooth, a 12-tooth, and a 28-tooth gear connected to it. turntable_motor = Motor(Port.B, Direction.CLOCKWISE, [20, 12, 28]) # Configure the seesaw motor with default settings. This motor raises # and lowers the Pen Holder. seesaw_motor = Motor(Port.C) # Set up the Gyro Sensor. It is used to measure the angle of the arm. # Keep the Gyro Sensor and EV3 steady when connecting the cable and # during start-up of the EV3. gyro_sensor = GyroSensor(Port.S2) # Set up the Color Sensor. It is used to detect whether there is white # paper under the drawing machine. color_sensor = ColorSensor(Port.S3) # Set up the Touch Sensor. It is used to detect when it is pressed, # telling it to start drawing the pattern. touch_sensor = TouchSensor(Port.S4) def pen_holder_raise(): # This function raises the Pen Holder. seesaw_motor.run_target(50, 25, Stop.HOLD) wait(1000) def pen_holder_lower(): # This function lowers the Pen Holder. seesaw_motor.run_target(50, 0, Stop.HOLD) wait(1000) def pen_holder_turn_to(target_angle): # This function turns the arm to the specified target angle. # Run the turntable motor until the arm reaches the target angle. if target_angle > gyro_sensor.angle(): # If the target angle is greater than the current Gyro Sensor # angle, run clockwise at a positive speed. turntable_motor.run(70) while gyro_sensor.angle() < target_angle: pass elif target_angle < gyro_sensor.angle(): # If the target angle is less than the current Gyro Sensor # angle, run counterclockwise at a negative speed. turntable_motor.run(-70) while gyro_sensor.angle() > target_angle: pass # Stop the motor when the target angle is reached. turntable_motor.stop(Stop.BRAKE) # Initialize the seesaw. This raises the Pen Holder. pen_holder_raise() # This is the main part of the program. It is a loop that repeats # endlessly. # # First, it waits until the Color Sensor detects white paper or a blue # mark on the paper. # Second, it waits for the Touch Sensor to be pressed before starting # to draw the pattern. # Finally, it draws the pattern and returns to the starting position. # # Then the process starts over, so it can draw the pattern again. while True: # Set the Brick Status Light to red, and display "thumbs down" to # indicate that the machine is not ready. brick.light(Color.RED) brick.display.image(ImageFile.THUMBS_DOWN) # Wait until the Color Sensor detects blue or white paper. When it # does, set the Brick Status Light to green and display "thumbs up." while color_sensor.color() not in (Color.BLUE, Color.WHITE): wait(10) brick.light(Color.GREEN) brick.display.image(ImageFile.THUMBS_UP) # Wait until the Touch Sensor is pressed to reset the Gyro Sensor # angle and start drawing the pattern. while not touch_sensor.pressed(): wait(10) # Draw the pattern. gyro_sensor.reset_angle(0) pen_holder_turn_to(15) pen_holder_lower() pen_holder_turn_to(30) pen_holder_raise() pen_holder_turn_to(45) pen_holder_lower() pen_holder_turn_to(60) # Raise the Pen Holder and return to the starting position. pen_holder_raise() pen_holder_turn_to(0)
Students who enjoyed this lesson might be interested in exploring these career pathways:
- Manufacturing and Engineering (Machine Technology)
- Media and Communication Arts (Digital Media)
Teacher Observation Checklist
Create a scale that matches your needs, for example:
- Partially accomplished
- Fully accomplished
Use the following success criteria to evaluate your students’ progress:
- Students can evaluate competing design solutions based on prioritized criteria and tradeoff considerations.
- Students are autonomous in developing a working and creative solution.
- Students can clearly communicate their ideas.
Once your students have collected some performance data, give them time to reflect on their solutions. Help them by asking questions, like:
- Is your solution meeting the Design Brief criteria?
- Can your machine’s movement(s) be made more accurate?
- What are some ways that others have solved this problem?
Ask your students to brainstorm and document two ways they could improve their solutions.
Encourage a peer review process in which each group is responsible for evaluating their own and others’ projects. This review process can help students develop skills in giving constructive feedback as well as sharpen their analysis skills and ability to use objective data to support an argument.
-Use the design process to solve a real-world problem
HS-ETS1-2 Design a solution to a complex real-world problem by breaking it down into smaller, more manageable problems that can be solved through engineering.
HS-ETS1-3. Evaluate a solution to a complex real-world problem-based on prioritized criteria and trade-offs that account for a range of constraints, including cost, safety, reliability, and aesthetics, as well as possible social, cultural, and environmental impacts.
3A-AP-13 Create prototypes that use algorithms to solve computational problems by leveraging prior student knowledge and personal interests.
3A-AP-16 Create prototypes that use algorithms to solve computational problems by leveraging prior student knowledge and personal interests.
3A-AP-17 Decompose problems into smaller components through systematic analysis, using constructs such as procedures, modules, and/or objects.
3A-AP-22 Design and develop computational artifacts working in team roles using collaborative tools.
4. Innovative Designer
a. know and use a deliberate design process for generating ideas, testing theories, creating innovative artifacts or solving authentic problems.
b. select and use digital tools to plan and manage a design process that considers design constraints and calculated risks.
c. develop, test and refine prototypes as part of a cyclical design process.
d. exhibit a tolerance for ambiguity, perseverance and the capacity to work with open-ended problems.
5. Computational Thinker
c. break problems into component parts, extract key information, and develop descriptive models to understand complex systems or facilitate problem-solving.
d. understand how automation works and use algorithmic thinking to develop a sequence of steps to create and test automated solutions.
6. Creative Communicator
a. choose the appropriate platforms and tools for meeting the desired objectives of their creation or communication.
HSG.MG.1 Use geometric shapes, their measures, and their properties to describe objects (e.g., modeling a tree trunk or a human torso as a cylinder).
HSG-GPE Expressing Geometric Properties with Equations
CCSS.MATH.PRACTICE.MP7 Look for and make use of structure.
Language Arts Extension
CCSS.ELA-LITERACY.W.9-10.1 Write arguments to support claims
CCSS.ELA-LITERACY.W.9-10.2 Write informative/explanatory texts to examine and convey complex ideas, concepts, and information