# Week 15 Groupassignment: Machine Design

### Groupassignement: Machine Design

For this week I wanted to contribute th following two points:

1. Some of theoretical mathematical background which decribes the movements of the scara robots

2. Expolore the way of programming and control the stepper motors.

I tried to find out which hardware and sofware we need for this. I found out that there are many different solutions for sending a image file to the machine.

- GRBL shield and corresponding open source software GRBL) translates the G-Code into the CNC comands and can be used with Arduino Uno. Sending of G-Code to the machine is much easier using cross platform written in java called Universal G-code Sender .

- Another open source software Chili Pepper is web browser based and works together with ThinyG shield, GRBL shield and for some time also with Arduino.

- TinyG shield uses also Chili Peppr web platform for communication with the machine.

### 1. Mathematical background of scara robots

The normal informations of a drawing are expressed through x,y coordinates can not be implemented by the scara robot without any further transformation. Because scara robot uses the circular movement of the stepper motors it needs angular informations in contrast to CNC machines which are using x and y axes. I had to find out how to translate the x,y coordinates into the polar coordinates which can be implemented by stepper motors.

I searched after sources of coordinate transformation an found this good explained scriptum from Prof. Dr. Klaus Wust, University of Giessen which is written in german.

The conversion of polar (angle) coordinates to Cartesian coordinates is called kinematic forward transformation.

The conversion of Cartesian coordinates to polar coordinates is called kinematic backward transformation or inverse kinematic transformation.

As Scara Robots need the polar coordinates, we will need the second, kinematic backward transormation. But first we have to start with the view at the forward transformation.

Translatation:

Rotation round the x, y and z achses:

Right-Hand-Rule and Transformational Matrx:

And this is the final calculation of the angles which can be implemented into a programm code and be sent to the motordriver.

### 2. ChilliPeppr, browser based CNC software

ChiliPeppr can be used directly on Arduino, that makes it more interssting as we sould not need to purchase some shield and wait to long to become this. What exactly is ChiliPeppr?

From ChiliPeppr site:

For using ChiliPeppr we need to instal JSON Server.

Following images show the terminal on my MacBook Air during the installation of JSON server and the localhost site after installing the server.

##### G-Code
Marlin - G-Code for Arc.

##### GRBL and universal G-Code Sender
GRBL is an integrated CNC-G-Code-Interpreter and Motion-Controller.

From GRBL site:
"Limitations by design
We have limited G-code-support by design. This keeps the Grbl source code simple, lightweight, and flexible, as we continue to develop, improve, and maintain stability with each new feature. Grbl supports all the common operations encountered in output from CAM-tools, but leave some human G-coders frustrated. No variables, no tool databases, no functions, no canned cycles, no arithmetic and no control structures. Just the basic machine operations and capabilities. Anything more complex, we think interfaces can handle those quite easily and translate them for Grbl."

##### TinyG
"TinyG is a high performance USB based CNC 6 Axis controller supporting XYZ linear and ABC rotary axes with 4 motor outputs"

"Stepper drivers handle 2.5 amps per winding which will handle most motors up thru NEMA23 and some NEMA34 motors. Micro-stepping up to 1/8 (optimized DDA makes this smoother than many 1/16 implementations)"

### Simple stepper motor tests

I tested the small and big stepper motors first with Arduino DIE (G-Code) you can see above, afterwards with the universal G-Code sender. Both did not work pretty well, but it worked.
The GRBL code worked nearly well only with the older UGS version. To be able to program it properly, you need a GRBL board, but it was an interessting trial, if I ca nuse it with a normal Arduino board.

Here are some simple tests with smal stepper motors.