9. Mechanical design & Machine Design


The team

Ambroise De Vries Quentin Benethuillere Selena Pere

Machine choice and scope

At first we thought about making a machine that could cover several functionalities :

  • a pick and place machine to help grabbing and positioning tiny electronics components on PCBs.
  • a drawing machine.
  • a plotter for light painting.

All those functions basically require mainly 2-axis motion, and eventually a relatively short motion on the vertical axis as well. We were thinking that we could relatively simply replace the tool used depending on the application desired.

Starting from those ideas, we progressively focused on the drawing machine only. However, we are convinced that our machine as it is now would allow us to also make light painting. We would just need to make a box to create a dark environment surrounding the machine but unfortunately we had no time to work on it yet.

Hero shots

Before going any further, here is our drawing machine and one of its first drawings.

Machine presentation
Drawing machine - top view


SW used

  • 3D modelling: Fusion360 (Selena, Quentin) and SketchUp (Ambroise)
  • Slicer for 3D printing: Cura
  • Motor control: Chilippepr
  • 2D drawing: Inkscape
  • Gcode generation: Jscut


Bill Of Material (BOM)

Part Quantity Notes
Stepper motors Nema 17 4 X axis : 1 motor
Y axis : 2 motors
Z axis : 1 motor
Sliding rails 3 500x15x15mm
Bearing pillow blocks 3 60mm x 47mm
Aluminium extrusions 4 610x20x20mm
Timing belts 3
Toothed pulleys 3 20 teeth
Ball bearing 3 1 for each return pulley
End switches 2 1 for Xmin and 1 for Ymin
TinyG CNC v8 1
M3/M4 screws and nuts different length needed
Washers
Zip ties to tighten the timing belts


Phase 1 : Mechanical Design

Basically, herebelow is presented the main material we started with :

Initial material
Initial materials for machine building

Amont the main parts, one can observe the sliding rails and corresponding pillow blocks, extrusions for the main frame, motors (Nema 17), timing belts, pulleys, end-switches and tinyG controller. Of course various sorts of screws and bolts (mainly M3 and M4) have also been used.

Note: On the picture above, one can observe 3 motors, but as we managed quite rapidly to obtain motion on 2 dimensions, we decided to add a fourth motor to control the vertical motion of the pen.

The whole challenge was thus to assemble all those parts together to obtain a machine capable of performing precise and relatively quick movements at first in 2 dimensions (that I will call x and y in the rest of this presentation). In order to do so, we all have designed some parts that we later on 3D printed.

Drawing machine complete 3D model (Selena)


Axes joints, X motor holder, X pulley holder, Y end-switch holder, Simple pen holder (Ambroise)


X motor holder
X motor holder X motor holder

Pulley washer
Pulley washer

X pulley holder
X pulley holder X pulley holder X pulley holder

Y switch holder
Y switch holder

SSimple pen holder
Pen holder Pen holder

Timing belts fasteners, moving pen holder (Quentin)

Timing belts fasteners, with extrusion for end-switch activation.

Timing belt fastener F360 Timing belt fastener F360
Fusion360 timing belt fastener model - top side view Fusion360 timing belt fastener model - bottom side view
Timing belt fastener End-switch activator
Parts positions in the machine Presentation of the end-switch activation function

Pen holder that allows short displacement on the vertical axis to lift the pen away from the material for going from one point to another while drawing.

In order to design a pen holder that could slide in the vertical axis and that could be easyly 3D printed, I have chosen to perform a design in 3 separate parts + a motor shaft cap. They are all presented below :

Pen holder - motor support Pen holder - motor support
Fusion360 motor support model - front view Fusion360 motor support model - back view
Pen holder - fixed part Pen holder - fixed part
Fusion360 static part for vertical motion model - front view Fusion360 static part for vertical motion model - back view
Pen holder - moving part Pen holder - moving part
Fusion360 moving pen holder part - front view Fusion360 moving pen holder part - back view
Pen holder - moving part
Fusion360 moving motor shaft cap
Pen holder - fixed parts Pen holder - motor support
Pen holder - fixed part to allow vertical displacement Pen holder - motor support
Pen holder - full assembly Pen holder - full assembly
Pen holder - full assembly - front view Pen holder - full assembly - side view


Y axis motors and return pulleys supports, frame corner brackets (Selena)


Machine assembly (all)


Files

All the STL files I designed can be downloaded here :


Phase 2 : Machine Design

Machine actuation (Quentin + Ambroise)

In order to control the motors of our machine, we use a TinyG (hardware v8) multi-axis motion control system. It is mainly designed for CNC applications but can also be used for a wider range of applications that require highly precise motion control. I have been the one in charge of understanding how to use this control system and in this section I will refer to different pages of the TinyG wiki which was very helpful to get our machine running.

Computer configuration

Based on our lab instructor’s recommandation, we have decided to use the very convenient browser based user interface Chilippepr to operate the TinyG motion controller. For exhaustive information on the Chilippepr interface and configuration, please refer to the Chilippepr wiki.

So basically most of the steps that are described in this section and the following take place in the Chilippepr interface. Prior to being able to control the TinyG, it is necessary to download and install the following elements :

  • FDTI VCP Driver to allow communication between the TinyG and my computer.
  • Serial Port JSON Server (SPJS) to allow communication between Chilippeper interface and the TinyG connected to the computer over USB. To be more accurate, it translates serial communications with TinyG to the websocket format. The download link is also available in the “Serial Port Widget” in the bottom right hand corner of the Chilippepr interface. In my case I downloaded the zip file entitled “serial-port-json-server-1.96_windows_amd64.zip”.

SPJS download
SPJS download


TinyG connection

Connect the following elements to the TinyG :

  • Computer connected over USB.
  • Power supply (between 12 and 30V). Ground must be connected to “GND” and positive side to “Vmot”.
  • Stepper motors. Up to 4 motors can be connected simultaneously, using for each of them the corresponding A1/A2/B1/B2 output pins.
  • Fan (optional), depending on your application. In our case we did not identify the need of using a fan at the moment.
  • End switches, using some of the Xmin / Xmax / Ymin / Ymax / Zmin / Zmax / GND inputs suited to your situation.

Warning: Before providing power to the TinyG, make sure that the power supply is in DC mode and rotate the current trim pots of the TinyG to the minimum or close to the minimum in order to avoid providing too much current to your motors. This will be adjusted later but it is wiser to start with low current.

More information can be foud on the TinyG connection page.

Here below a picture of the TinyG connections for our final drawing machine :

TinyG connections
TinyG connections

Then, to establish communication between Chilippepr and the TinyG, connect the TinyG to your computer over USB, and run the SPJS script downloaded previously (as a Windows user : “serial-port-json-server.exe”).

JSON server
JSON server

Then, in the “Port List” tab of the Serial Port widget, tick the box next to the USB serial port listed.

Chilippepr - port not selected Chilippepr - port selected
Chilippepr - serial port not selected Chilippepr - serial port selected

Note: If you see a message like “You are NOT connected to a Serial Port JSON Server. Go to the “Your Servers” tab and connect.”, it probably means that your SPJS is not running. For further troubleshooting on this issue, a lot of information can be found on the internet.


TinyG configuration

The TinyG needs to be configured using JSON (JavaScript Object Notation) file format. In order to establish the configuration suited to our machine, I refered to this TinyG configuration tutorial which contains all the necessary information. Basically, $cmd allows to read a parameter and $cmd=value allows to set a partiular value to a parameter.

I will not give an exhaustive list of the parameters I used for the TinyG configuration but just a few example for motor 1 configuration :

Setting Description Notes
$1ma motor mapping axis 0=X, 1=Y, 2=Z, 3=A
$1sa step angle 1.8 in the case of a motor with 200 steps per revolution
$1tr travel per revolution distance covered on the corresponding axis per motor revolution
$1mi microsteps either 1,2,4 or 8
$1po polarity 0=clockwise rotation, 1=counterclockwise rotation

Note: There are 4 motor groups on the TinyG board, numbered 1,2,3 and 4. The examples given above would apply only to motor 1. In order to configure another motor, simply replace the “1” by the desired motor number.

In a similar way, all axis can be configured, and here below is a few examples for configurating the X axis :

Setting Description Notes
$xvm maximum velocity -
$xtn minimum travel in absolute coordinate
$xtm maximum travel in absolute coordinate
$xsn minimum switch mode 0=disabled, 1=homing-only, 2=limit-only, 3=homing-and-limit

Note: This time, replace “x” by y,z,a,b,c for configurating other axis. For information, a/b/c corresponds to rotary axis.

Herebelow is presented the complete startup script I created for our drawing machine.

G21 ;mm

;Motors : X axis

$1ma=0
$1po=1
$1sa=1.8
$1tr=40
$1mi=8

;Motors : Y axis

$2ma=1
$2po=1
$2sa=1.8
$2tr=40
$2mi=8

$3ma=1
$3po=1
$3sa=1.8
$3tr=40
$3mi=8

;Motors : Z axis

$4ma=2
$4po=0
$4sa=1.8
$4tr=24 ;arbitrary because no real z axis (value chosen based on the motor shaft cap length of 6mm to control the pen lifting)
$4mi=8

;Axis : X axis

$xvm=10000
$xfr=10000
$xtn=0
$xtm=330

;Axis : Y axis

$yvm=10000
$yfr=10000
$ytn=0
$ytm=330

;End switch:
$st=0 ; normally open

$XSN=3
$XSX=0
$YSN=3
$YSX=0
$ZSN=0
$ZSX=0
$ASN=0
$ASX=0

;End switch X axis
$xsv=1500
$xlv=500
$xlb=15
$xzb=5

;End switch Y axis
$ysv=1500
$ylv=500
$ylb=15
$yzb=5

In order to load this startup script in Chilippepr interface, refer to the following screenshot :

Chilippepr - startup script
Chilippepr - startup script


Motor control

In order to control motors, we need to send G-code instructions to the TinyG. I have been through this G-code introduction page, and here are a few examples of the basic commands that I noted for testing and controling our drawing machine :

Code Function Example
G21 sets units to “mm” -
G0 rapid move G0 X150 Y80 F10000
G1 linear move G1 X150 Y80 F10000
G28 move to origin G28 X Y
G28.2 move until reaching end switches G28.2 X0 Y0

Of course tests have been performed step by step and not directly with motors already fitted in the drawing machine.

1 - Made sure that computer configuration was correct and that communication could be established properly between the computer and the TinyG. In order to do so, a single motor has been connected to the TinyG and I tried to control it by sending basic G-code instructions (as the ones indicated in the table above) via Chilippepr.

2 - Installed the motor on what was the very beginning of the drawing machine and tried to obtain a motion along on the X axis. As one may notice in the video, at the time there was not a proper return pulley and the timing belt could jump out of its expected position.

3 - Adjusted current delivery to the motor and axis/motor settings to obtain a fast and smooth motion along the x axis. Indeed, as can be observed on the above video, motion was rather slow and not very smooth. By updating parameters $xvm=10000 and $xfr=10000 we obtained a faster movement, however it was still jerky. We managed to fix this problem by setting the microsteps parameter to 8 : $1mi=8.

4 - Installed and configured the end-switch at X-min location. This homing tutorial was of a precious help to configurate the TinyG for end-switch usage. Pretty quickly we obtained the expected behaviour presented in the video below :

5 - Once the motion on the X axis had been validated we could proceed to 3D print the parts for the Y axis assembly. We have made the choice to use 2 motors in parallel for controlling the motion on the Y axis as the weight to be moved was more important on that axis. After assembling the parts together, and based on the experience we developed in the previous steps, we rapidly set up the additional TinyG connections, and adjusted TinyG configuration to obtain motion and end-switches fucntions on both X and Y axis.

The first version of our drawing machine was now ready for being tested !


Sending G-code files for drawing (Ambroise + Quentin)

To be able to draw something, our machine needs to be given a G-code file with a list of instructions, so we have to convert a .svg drawing into .gcode file. After having faced difficulties to perform this task directly in Inkscape, we finally used JScut, which is a Computer Aided Manufacturing web based software that allows converting SVG files to CNC cutting paths.

Here are the main steps to obtain a G-code from a SVG file :

1 - Load the SVG file to be converted into G-code.

Jscut import Jscut SVG imported
Jscut - Import SVG Jscut - SVG imported

2 - Set all units to “mm”, set the parameter “Minimum Segment Length (mm)” to 1 or more (otherwise the machine will be very slow to draw curved shapes), and set “Rapid” and “Cut” speed parameters to the desired values (in our case it turns out that around 10 000 mm/s for both those parameters is a nice balance).

Jscut settings
Jscut settings

3 - Select the drawing in the interface (it turns blue) and hit the “Create Operation” button.

Jscut create operation
Jscut create operation

4 - Select “Engrave” and hit the “Generate” button.

Jscut generate Gcode
Jscut generate Gcode

5 - Visualize the simulated path in the “Simulate GCODE” tab.

Jscut preview
Jscut preview

6 - If you are happy with the result, save GCODE to a file on your computer.

Note: Because of the coordinate systems we have chosen for our machine (X positive when going from left to right, and Y positive when going from the back of the machine to the front), if we want the drawing to be on the correct orientation we currently need to mirror our drawing along the Y axis before saving the SVG file. I am pretty sure that there is a better way to solve this minor issue but we had not time to investigate on it yet.

Once the Gcode fils is ready, simply drag and drop it in the Chilippepr interface, and click on the start button.

After a few first tests unsuccessful because of non perfectly flat and non-fixed surface for drawing, and after resolving low speed issues for curves, we managed to achieve good results as can be seen on the videos below :

Screencast of Chilippepr interface while drawing is ongoing (note : the drawing in this video is not the same as the one presented in this section) :


Pen lifting feature (Quentin)

Once that our machine was able to draw with a fixed pen, it was time for us to test the system I designed to control pen lifting along the vertical axis so that the pen can move from one point to another without being always in contact with the drawing surface.

The ideal would probably have been to use a servo motor for this application but unfortunately it does not seem possible to control a servo motor with the TinyG. I then tried to use a small 5V stepper motor 28BYJ-48 but I only managed to make it rotate in one direction which was not satisfactory for our need. As time was running, I thus decided to keep it simple by using the same model of stepper motor as the ones controlling the motion on the other axes of the drawing machine. It appears a little oversized for this application, but it definitely does the job !

After few adjustments in the TinyG settings to control this additional motor, few tests with the motor not yet fitted in the machine, few madjustments in Jscut to deal with the vertical motion, and few manipulations in Chilippepr to fix the zero position on the vertical axis, I was ready to test it for real ! It turned out to work exactly as expected as demonstrated in the videos below :

Front view :

Side view :


Conclusion and further work

First of all we are happy and proud of the machine that we have designed and built in this short amount of time.

As for future work :

  • Understanding how to modify the coordinates system either in Jscut or Chilippepr to match the coordinate system that we have chosen for our drawing machine.
  • Fixing the buffer issues we sometimes face in Chilippepr that causes the machine to suddenly stop while a drawing is ongoing.
  • Adding a flat support for drawing, with a system (more appropriate than tape) to hold the sheet of paper or other material in place.
  • Working on the electronic TinyG board and wires integration.
  • Designing the box to create a dark environment for the light painting application that we had imagined.