-
Notifications
You must be signed in to change notification settings - Fork 1
Home
The official PDF version of this report is available here.
Andrew Gerber & Erik Neilson
This is a report for the final project of ECE 3710 taught by Dr. Jonathan Phillips at Utah State University fall semester of 2021. The device designed and built for this project is a CNC router. The router has three orthogonal axes of motion used to precisely move a spindle around a workspace. The spindle uses a cutting bit to shave away parts of the material being machined. Common materials to cut include wood, acrylic, and aluminum.
This document includes the Design Overview, Design Details, and Testing of the CNC router device. A summary of the mechanical, electrical, and software is given under Design Details. Appended are selected code excerpts, a firmware design diagram, and mechanical design notes and drawings. Advanced details of the software implementation, such as hardware level operations, are not included in this document.
Requirements. A project proposal was submitted November 10, 2021 and was subsequently approved by Dr. Phillips. That document is summarized in the following set of requirements:
1.1. The device shall provide three-dimensional movement of a spindle.
1.2. The device shall accept command input via UART serial communication.
1.3. The device shall implement of subset of G-Code commands.
Dependencies. Our design depends on availability of a certain number of electrical components to function properly. The following list contains the electrical dependencies of the design:
- 5 V 500 mA power supply
- 12 V 10 A power supply
- Dremel 3000
- PC with USB COM port
Theory of operation. The device will take in lines of G-code from a user's PC via USB to UART communication provided by the Nucleo-64 board. The input is parsed by the GCode::scanner class which then passes it along to the GCode::Controller. The controller interprets the command and adds a MotionVector object to the MotionVectorBuffer. The MotionVectorBuffer is accessed and consumed by the StepDriver which provides appropriate step and direction outputs to the A4988 stepper motor drivers. This driver chips provide simplified control, including microstepping, for the NEMA 17 stepper motors.
Mechanical. The mechanical design was inspired and derived from two existing open source CNC designs. The first is from the OpenBuilds LEAD CNC [1] that was used to construct the frame and Y-axis of the device. The second is from Nikodem Bartnik's "DIY 3D Printed Dremel CNC posted on instructabls.com [2]. This design was used for the X-axis and Z-axis as well as the carriage to mount the Dremel.
The frame was built using t-slot extruded aluminum and be approximately 300x300 mm. This was expected to provide a working area of at least 200mm by 200 mm. However, the total working area ended up being approximately 100mm by 150mm which is still sufficient for the design. Lead screws were be used to drive the axis as it allows for much more accurate positioning of the system than a belt driven system.
The Y-axis is a dual driven pair of gantries that moving on wheels along the v-slot frame. These gantries come from the OpenBuilds design. The X-axis and Y-axis move along rods using linear bearings. These axes both use carriages from Bartnik's design. One part was custom designed to attach the X-axis rods to Y-axis gantries. All other parts of the design used pieces purchased or 3D printed from existing models.
Electrical. The three axes use NEMA 17 stepper motors driven by A4988 current-limiting driver ICs. The Y-axis uses two motors. Power is be supplied by the 12 V and 5 V rails of a standard ATX computer power supply. The microcontroller board is the Nucleo-L476RG. Limit switches will also be used to home and calibrate the stepper motors.
G-Code. The G-Code will be sent to the microcontroller via UART communication from a PC. Due to the extensive number of G-Code commands as well as its various flavors, a simple subset of these commands was implemented based on RepRap documentation.
Motors. Driving the stepper motors will use the A4988 driver chips. These chips provide step and dir pins to control the stepping of the motors. Proper values for maximum speed and acceleration were found through experimentation.
Control flow. The firmware of the system follows the design illustrated in Appendix A. The design uses abstraction to provide a modular code base that is easy to work on. The abstraction layers include hardware, interface, functional, and control in that order. Each layer is only allowed to interact with the layers directly above or below it.
The design uses the main process thread as well as running a periodic interrupt service routine (ISR). A basic SysTick interrupt is also used for time keeping purposes. The main process handles the UART I/O, command interpretation, and MotionVectorBuffer filling. The ISR is used solely for the StepDriver class. It consumes from the MotionVectorBuffer and controls the stepping of the motors. It is important to note a weakness in this design in that the UART does not use interrupts or DMA. This results in the main processing being tied up in slow I/O operations and leads to dropped input data.
The key to this design is the MotionVectorBuffer. It allows the system to stay responsive to incoming commands as well as providing a command buffer. It is essential that it provides atomic access to both the main process and step driver ISR. This proved challenging to implement and resulted in many difficult to diagnose bugs.
Requirement 1.1. 3D movement.Commands were sent to the device to verify proper movement in all three directions.
Requirement 1.2. UART.The device was connected to a PC via USB COM port. Characters were sent to the device through the terminal. The characters were observed to be echoed back to the host PC as well as additional text returned acknowledging a command input.
Requirement 1.3. G-Code.The device was connected to a PC via USB COM port. The implemented G-Code commands were entered, and the expected corresponding physical output of the system was observed.
The system works but does contain several bugs. During the construction, we ran into various roadblocks with part compatibility that required us to rethink our design slightly. Once the system was built, coding became another challenge to overcome. Implementing a timer to run the commands through an interrupt handler was difficult. Even after extensive testing and debugging, there are still bugs to work out. Our testing did not involve any cutting tools but plotting on paper allowed for sufficient testing to verify the design requirements. The system implements the intended functionality but contains bugs that can cause it to become unresponsive and require a hard reset.
[1] "Lead CNC 1010 (40' X 40')," OpenBuilds. [Online]. Available: https://openbuilds.com/builds/lead-cnc-1010-40-x-40.7832/. [Accessed: 14-Dec-2021].
[2] N. Bartnik and Instructables, "DIY 3D printed DREMEL CNC," Instructables, 12-Nov-2021. [Online]. Available: https://www.instructables.com/DIY-3D-Printed-Dremel-CNC/. [Accessed: 14-Dec-2021].

This appendix contains mechanical design drawings used in the initial phases of planning and design of the project. Their primary use was for obtaining a list of the parts needed. They also served as a guide during assembly in addition to the instructions from both borrowed designs.


