Week 12 Group Assignments -¶
Group assignment:
- Part 1:
-
Design a machine that includes mechanism + actuation + automation + application
-
Build the mechanical parts and operate it manually Document the group project
- Part 2:
-
Actuate and automate your machine ; Document the group project
Inkuity¶
Meet Inkuity, a 2-dimensional drawing machine.
Link to Jeremy’s Individual Page
Link to David’s Individual Page
Part 1, Design the Machine¶
Ideation¶
- We started by ideating about what type of machine that we wanted to build. We did some research through old Fab Academy projects and broadly on the web. From this session we came up with a number of ideas including:
-
Light painter
-
Self driving Mario Kart game
-
Sustainability device (can crusher or something to process waste/trash)
-
Rotary table for photographs
-
Reflective light painter
-
Pin hole portrait maker
-
Type writer art maker
-
Sharpie pen drawing machine
Since most of our ideas had some element of creating art, we decided to move forward with making a device that would draw pictures and maybe have different heads to create pinhole or typewriter art.
Self Driving Mario Kart¶
Jeremy did build an initial prototype of this device, but we decided not to take it forward for the deliverable for this week. He used SolidWorks to make a case for a Super Nintendo style controller. Then he used a 9g mini servo to push the left and right keys. Using a simple program to move the servo based on the timing of the first level of Mario Kart he was able to succesfully navigate the first two corners with a human using the acceleration button.
Design¶
Concept Exploration¶
We started by defining the motion base for our machine. In our initial work we reviewed the setup of a couple of different motion systems for 3D printers both live and reviewing pictures on the web.
We wanted to keep the base as simple as possble with the fewest drive and motion components. But we also wanted to keep the paper that we were going to use to draw on stationary and only drive the axes. We liked how Prusa MK4 and even the old open source Printrbots had a y-axis with a single y-axis motor with a belt mounted centrally.
We liked this concept, but we wanted to adapt it to work with a gantry design. We thought we could just move the drive belt to the top of the machine and we could lock the belt to the gantry to move the gantry with just 2 motors, and keep the working piece stationary.
Component Set¶
In our exploration we noted that a lot of low cost motion bases use 2020 V-rail. It is an aluminum extrusion system that has beveled edges on the sides of the grooves that allow for wheels to easily run in them. This system has a lot of inexpensive accesories like gantry bearing plates, and reinforcing brackets that make it easy to build simple motion systems. Thus, we decided to build around it.
CAD Design¶
Then we took the design into CAD. Jeremy used SolidWorks to create a model of the base and the drive system. Since many of the 2020 kits available online were based on 300mm rail lengths, we used that as our overall size. We wanted to create drawings of about 150mm square, so that size frame would allow us to do that. Jeremy downloaded CAD files of 2020 rail from GrabCAD. He used these solid files to extract the crosssection geometry of the rail. Then he converted those into weldment profiles inside of SolidWorks so that he could use the weldment tools in the program to build the frame with simple layout sketches.
Then the 2040 profile was added and a short run was added to the front of the frame to hold pulleys.
Then the X axis drive system was laid out. Since we had many of the Nema17 stepper motors that were leftover from another project, we decided to use those with a 20 tooth sprocket. Then we laid out a series of pulleys to guide the belt around the 2040 sled that we will use for the gantry. The motor was placed far to the left of the gantry to put the weight over one of the bearing sleds, and the idler pulleys were distributed so they would allow for about 180 degrees of wrap on the drive sprocket.
Then the X-drive was added to the assembly and the Y-axis drive was laid out. A second stepper motor was added to the back of the frame but in the center of the X. Then the belt was moved high enough to get above all of the components of the X-axis and supports for idlers and the stepper were added. Again, the drive belt was laid out in such a way to make sure that there was about 180 degrees of engagement on the drive sprocket.
With this much of the system laid out, we were able to pull together a bill of materials of the primary components to do an Amazon order.
Build¶
We had to wait a few days for the Amazon parts to come in. Axious to get a start on the control system we decided to go ahead and download a CAD model of a drawing machine to test out driving servo motors etc. We also were uncertain about how long it would take to get the as-designed parts in, and wanted a backup system to move forward with, just in case.
Backup System Test¶
We found a drawing machine on Instructables that used some simple 3D printed components and small 5V stepper motors to drive the 3 axes. The steppers were all driven directly from the Arduino and required only an external power supply to do all 3 axes simultaneously.
We downloaded the files, 3D printed them in PLA and assembled all of the parts. The parts were all printed without supports, so the overhangs needed to be trimmed and filed to get them to slide well enough. The X and Y axes did not go together perfectly and they were crooked when assembled. However, it was a good place to test a motion system.
Then we added some simple code to drive both axes back and forth. It used the stepper motor library to drive the 4 pins for the motor driver board which would then move the board.
With this code were able to successfully drive 2 stepper motors and it would have been no big deal to drive a 3rd. So we decided we should continue to take this design forward with some heavy modifications to make it easier to build and run smoother.
CAD for an updated version was started to me a mix of lasercut and 3D printed components with built-in limit switches. Fortunately, before we finished the updated CAD design, the parts for the original design arrived, and we swithched out attention back 100% to the belt driven design.
Extrusion Motion System Build¶
With the parts in hand, we started the build according to the plans. We used the 2020 rails to make the outside of the frame, and added the carriages. The tension on the carriages was tuned to make sure they were secure, but still rolled. We added the X-axis 2040 rail to the assembly after drilling out holes to get access to the screws to mount them to the carriage. Once the X-axis was added, we found that the motion was a little bit sticky, and we tuned on the alignment until it slid smoothly.
Then we continued the build. We started added the posts for the pulley system and tapped the holes for the M5 screws.
We found that after installing the pulleys that they were grinding on the extrusions, so we quickly designed small spacers to raise them up a few millimeters. Then we added the Y-axis belt and roughed it in. We had printed the motor mount and installed it at the rear of the frame. Then we ran the 6mm belt around all of the pulleys, and secured it with a belt cleat mounted to an extrusion on the X-axis frame.
Then we tensioned the belt and confirmed that indeed the drive pulley would pull the axis.
When the Y axis system was designed it was originally placed in the center of the X-axis rail so that it would pull from the center of the X-axis sled to keep balanced forces. This meant is was potentially in the way of the end-affector. Once we built the axes and setup the belts, we realizized that indeed it was going to cause trouble for the Sharpie holder and limit our travel. So, we tried to move the Y motor all the way to the left of the frame and tried to move it by hand. Fortunately, it worked just finon that side so we kept it there. Then we were able to move the X-axis drive motor to the center of the gantry.
We continued the build by installing the X-axis drive belt. We 3D printed the motor mount and connected it to the frame. Then I waterjetted the idler pulley mounts out of .065” aluminum. I 3D printed some additional spacers to allow the bearings to run freely and to be located in the center of the rail. Then, the belt was installed with the cleat to the V-wheel plate. The belt was tensioned by pulling the idler pulley plates outward to put tension on the belt.
End Affector Design and Build¶
To this point, we had been ignoring the end-affector design, as we were not sure what tool we were going to use. While we had ambitions of making some typewriter art or pin-hole art, we settled on making a Sharpie drawing tool. From our electronics exploration, it was going to be much easier to drive another NEMA-17 stepper, so we opted to use that for our drive and anchored our design on that.
We started by downloading a model of a Sharpie from Grabcad, and added it to a SolidWorks file with the stepper motor. Then a simple arm was created to hold the Sharpie to the axis of the stepper.
Then we 3D printed the arm, added threaded inserts and installed onto the machine.
Other Updates¶
We also took the time to make some more mechanical updates. We noticed that the frame of the machine was bending under the tension of the drive belts. We designed and made some aluminum brackets and added them to the frame for additional support.
We also added a mount to hold the Arduino and motor drive hat to the rear of the machine. This was laser cut out of acrylic. We also created a mount to hold the spiral wrap for the for wiring. This was 3D printed and installed at the back of the machine.
We also designed some custom brackets to hold the limit switches for the X and Y axes. These were 3D printed and installed on the machine. Additionally, we made some 3D printed wire covers for the limit switches to keep the wires from getting caught in the motion.
Manual Operation¶
With the build complete, we could then manually operate the machine by moving the axes and belt by hand. We put a piece of foam board under the machine and moved it around manually to confirm that it would do the job before the motors were employed to move them.
Part 2, Actuate and Automate¶
Machine Automation¶
In order to automate the machine, we followed a common approach that employs used 3 stepper motors to automate the X, Y, and Z elements. The stepper motors are controlled for automation and application using an Arduino UNO type microcontroller with a CNC motor shield to manage individual motor drivers for the stepper motors. This combination has been used with the open-source GRBL software for Arduino 3-axis CNC control using gerber file input.
Stepper Motors¶
The motors used are NEMA-17 size stepper motors from Adafruit.
The physical characteristics of the steppers were important to consider in the mechanical design. The motors needed to mount securely without interfering with actuation. Design considerations included:
- The NEMA-17 size (42mm square) body
- 5mm drive shaft, 24mm long
- The drive shaft is machined, which was both helpful for secure pulley and peripheral attachment
- 31mm square mounting holes for 3mm (M3) screws
The motor characteristics of the steppers were important to consider in the actuation design. The motors needed to map rotational steps to dimensions of actuation. Design considerations included:
- Bipolar stepper
- 200 steps per revoluton (1.8 degrees / step)
- 12 V rated voltage
- 350 mA max current
- 4 leads Red / Yellow and Gray / Green
Automation Control¶
In order to control automation overall, we needed to control each of the stepper motors individually. This needed a motor driver for each stepper motor. In addition, we needed a platform for application driven automation. In order to address these together, we used an Arduino UNO type microcontroller coupled with an Arduino CNC shield. The Arduino CNC shield helps to coordinate multiple stepper motor driver breakout boards for X, Y, and Z axes, as well as other common elements such as limit switches.
The primary elements for automation control were:
- Arduino UNO type microcontroller board
- Arduino CNC Shield v3
- Stepper motor breakout boards for the DRV8834 motor driver
Setting Up Motor Control¶
We first connected the Arduino CNC Shield to the Arduino board. We double checked orientation of each motor driver breakout board when adding to the shield - matching the enable pin on the board with that on the shield socket.
For motor power, we used a variable power supply set with a setting of 12 V / 5 A connected directly to the power pins on the motor shield. The Arduino board was powered with a standard USB connection to the computer.
We conducted initial testing of the setup by:
- Configuring one of the motor drivers (for current limiting)
- Testing each of the servo motors using direct Arduino code control of motor shield pins
- Configuring and testing the remaining motor drivers in turn
Configuring DRV8834 Motor Drivers¶
The DRV8834 motor driver supports active current limiting in order to prevent damage to the motors. The current limit setting is made with a trimmer potentiometer on the driver board. The process is described in the documentation for the https://www.pololu.com/product/2134.
For the DRV8834, the current limit relates to the reference voltage on the carrier: Current Limit = VREF x 2
, or VREF = Current Limit / 2
. Since our stepper motors are rated for 350 mA, the reference voltage should be set for .175 V.
In testing, it is important to note that the Arduino board must be powered, as well as the direct power to the motor shield, in order to read the DRV8834 values.
We used a multimeter to check the reference voltage for each of the motor drivers, adjusting the trimmer potentiometer until each read approximately .175 V. The trimmer resolution made the adjustments for that level somewhat fiddly, but we got there.
Initial Stepper Motor Testing¶
In order to check whether the stepper motors were working, we connected each in turn to one of the motor driver boards. We then tested with direct Arduino pin control on the motor shield pins for step and direction on each of the axes.
The code is based on testing code used in the tutorial: Arduino CNC Shield Tutorial - Control Stepper Motors using CNC Shield V3.0
For the initial testing, we set up the pins for all axes, but tested one at a time by changing which direction (dirX
, dirY
, dirZ
) and step (stepX
, stepY
, or stepZ
) was active. In the following code:
en
- enables the motor shield by being pulled lowdirX
,dirY
,dirZ
- direction for each axis clockwise / counterclockwisestepX
,stepY
,stepZ
- step the motor in the set direction
For the configured axis, a 200 step motor is expected to make one revolution in each directon for each loop.
const int en = 8;
const int stepX = 2;
const int stepY = 3;
const int stepZ = 4;
const int dirX = 5;
const int dirY = 6;
const int dirZ = 7;
void setup() {
pinMode(en, OUTPUT);
pinMode(stepX, OUTPUT);
pinMode(stepY, OUTPUT);
pinMode(stepZ, OUTPUT);
pinMode(dirX, OUTPUT);
pinMode(dirY, OUTPUT);
pinMode(dirZ, OUTPUT);
digitalWrite(en, LOW);
digitalWrite(dirX, HIGH);
digitalWrite(dirY, HIGH);
digitalWrite(dirZ, HIGH);
}
void loop() {
digitalWrite(dirX,HIGH);
for(int x = 0; x < 200; x++) {
digitalWrite(stepX,HIGH);
delayMicroseconds(1000);
digitalWrite(stepX,LOW);
delayMicroseconds(1000);
}
delay(1000);
digitalWrite(dirX,LOW);
for(int x = 0; x < 200; x++) {
digitalWrite(stepX,HIGH);
delayMicroseconds(1000);
digitalWrite(stepX,LOW);
delayMicroseconds(1000);
}
delay(1000);
}
Stepper Motor Integration / Axis Testing¶
After confirming the stepper motors were working, they were mounted and connected into the pulley drive system on the machine. Once mounted, we tried the same basic test to see how the drive worked.
Once we had confirmed everything was operational, we created dedicated connectors for the stepper motors. Confirming the order of the motor leads.
GRBL / Universal Gcode Sender¶
To control the steppers we opted to use the open source GRBL universal GCode sender. This was downloaded from Github. We ran the executable from the downloads folder, which opened the program.
Calibrating Universal Gcode Sender¶
With GRBL installed it was then a matter of getting the controller connected and calibrated. Under the “Machine” menu, we opened the setup wizard. From here the software guided us through connecting and calbrating the device. The connection was found easily through the USB serial port.
In the motor wiring step, we were able to bump the stepper motors to see which way they moved to set the correct direction. We moved all 3 motors and found that just the Y axis was the reverse direction.
On the calibration screen, we calibrated the linear motion of the axes. We did this by moving each axis one step and then measuring the distance traveled by the ruler. Then we would plug that value into the setup wizard for the software to calculate the steps per mm. Then we clicked the button to update the value in the software.
We finished the calibration by setting up the limit switches for the X axis only. Then we were able to drive the toolhead around our machine with predictable step sizes back on the GRBL homescreen.
Creating G Code¶
We chose to use JSCut for our CAM processor to make toolpaths. This was a great easy way to create Gcode files that are compatible with GRBL.
As a first test, we created an ellipse in Inkscape, converted the shape to path using the “Object to Path” command and saved it as an SVG file.
Then we brought this file into JS cut. We selected the geometry, and setup a new operation and selected engrave. We changed the units to mm throughout and adjusted the depth to 2mm. The rest of the defaults were left unchanged. Then we clicked the “Generate” button and it created the toolpath. We were able to view it in the simulator and the path looked correct. So, we saved the g-code.
Running the program¶
We went back to GRBL to run the program that was just created. We clicked the “Open” button and navigated to our Gcode file. This imported the Gcode into the window and gave us a preview of the tool path.
Then we zeroed the axes in the lower left corner in an area where the machine would have room to draw the approximately 75mm ellipse. Then we moved the Sharpie to about 2mm off of the top of the page and zeroed the Z axis. Then we clicked the “Run” button and let it rip. Dutifully, the machine moved into position and drew the ellipse.
Creating a Filled Drawing¶
Inspired by the success of the ellipse, we took it a step further and had it draw a filled in sketch of the UNC Charlotte All In C logo. We imported a dxf of the logo into Inkscape and filled the art in with green. Then we exported the file as an SVG.
Then we opened the C inside of JS Cut. We selected the body of the logo and setup a pocketing routine. We updated the settings to match the Sharpie and set a very shallow depth of cut to insure it would only do one pass. This created a toolpath to color in the art.
Then we opened the toolpath in GRBL and confirmed that it imported correctly.
Then we hit run and watched it draw the logo. In about 7 minutes we had a reasobable drawing of the UNCC logo.
Potential Improvements¶
After building and running the machine there are a number of improvements that could me made to make it better
- Drive System:
-
Move the Y drive outside the usable area to gain more working area
-
Incorporate the Y-axis limit switches and a homing routine
-
Machine stiffer stepper motor holders from billet aluminum to reduce flex
- Tool Head:
- Refine the Sharpie holder to glide more easily on the page. There were some areas where it would drag pretty hard and others where it would fall off the page. A system with a sprung tool holder may help
- We never got the change to try to implement the typewriter font, so it woudl be interesting to create that tool head design
- Misc:
-
Add feet to the motion base
-
Have a way to hold the drawing surface down
-
Replace the long screws with appropriately sized M5s
-
Improve the drawing speed
-
Do an axis alignment