Exercise 10 Machine design


Requirement


Workload Distribution

As this is a group project spread over 2 weeks (30 Mar - 13 Apr 2016), we have decided to split up the workload as such:

Links to my team-mates' contribution:

My contribution

In this group project, I was involved in the following specific areas:

The Gestalt Framework

Gestalt is a framework for rapidly building controllers for automated machinery. The Gestalt means “an organized whole that is perceived as more than the sum of its parts” (Oxford Dictionaries), which describes Gestalt’s modular yet cohesive approach towards structuring the architecture of machine controllers. The Gestalt framework is comprised of an extensible collection of software modules that can be combined in many ways to quickly realize machine controllers. A physical machine is comprised in part by a number of electronic and electromechanical hardware components. A series of physical control nodes provide low-level control of the machine components, and connect to the Gestalt virtual machine via either a direct connection or a network bus. Each physical control node is matched by a virtual node that exposes to the virtual machine the functions needed to control its specific hardware. The virtual machine additionally might contain kinematic definitions, memory of state (i.e. position), machine-level functions (e.g. to move the machine) and external interfaces through which user applications can control the machine.

Components of the Gestalt Framework
Nearly endless kinematic options from simple parts
Necessary parts for one cardboard linear stage
Gestalt workflow

Communicating with the stepper motors

Modifying the example files found in ~\pygestalt-master\examples\machines\htmaa\, I was able to test the system, and ensure that my computer is able to talk to the machine. These are the changes I've made:

  def initInterfaces(self):
    if self.providedInterface: self.fabnet = self.providedInterface   #providedInterface is defined in the virtualMachine class.
    else: self.fabnet = interfaces.gestaltInterface('FABNET', interfaces.serialInterface(baudRate = 115200, interfaceType = 'ftdi', portName = 'COM3'))


    moves = [[-30,-30],[30,30],[0,0]]
  

Programming Syntax

Based on the example files found in ~\pygestalt-master\examples\machines\htmaa\, I tried to understand the various functions of the programme.


Stage 1: Drawing Machine


Mapping the Portname - Windows environment

def initInterfaces(self):
    if self.providedInterface: self.fabnet = self.providedInterface   #providedInterface is defined in the virtualMachine class.
    else: self.fabnet = interfaces.gestaltInterface('FABNET', interfaces.serialInterface(baudRate = 115200, interfaceType = 'ftdi', portName = 'COM3'))

Mapping the Portname - Mac environment

def initInterfaces(self):
    if self.providedInterface: self.fabnet = self.providedInterface   #providedInterface is defined in the virtualMachine class.
    else: self.fabnet = interfaces.gestaltInterface('FABNET', interfaces.serialInterface(baudRate = 115200, interfaceType = 'ftdi', portName = '/dev/tty.usbserial-FTXW6Q4L'))

To draw a Square

  moves = [[0,0],[-40,0],[-40,40],[0,40],[0,0]]
  

To draw a Triangle

  moves = [[0,0],[10,20],[30,0],[0,0]]
  

Exploring GUI control

We referred to a past project that was similar to us. Credits goes to Asako from Kamakura. We explored and tried to learn their method by modifying their Tkinter module. This is the standard Python interface to TK GUI toolkit from Scriptics.


Commanding a mouse movement to draw something

To command a mouse movement to draw something:

  class Draw:
        
    def on_pressed(self, event):
        self.sx = event.x
        self.sy = event.y
        self.canvas.create_oval(self.sx, self.sy, event.x, event.y, outline = "black", width = 2)
 
    def on_dragged(self, event):
        self.canvas.create_line(self.sx, self.sy, event.x, event.y, fill = "black", width = 2)
        self.sx = event.x
        self.sy = event.y
        
        self.xx = self.sx/1.5
        self.yy = self.sy/1.5
        #print self.sx
        moves = [[self.xx,self.yy]]

        # Move!
        for move in moves:
            stages.move(move, 0)
            status = stages.xAxisNode.spinStatusRequest()
            # This checks to see if the move is done.
            while status['stepsRemaining'] > 0:
                time.sleep(0.001)
                status = stages.xAxisNode.spinStatusRequest()
 
    def __init__(self):
        window = Tkinter.Tk()
        self.canvas = Tkinter.Canvas(window, bg = "white", width = 150, height = 150)
        self.canvas.pack()
                
        quit_button = Tkinter.Button(window, text = "Exit", command = window.quit)
        quit_button.pack(side = Tkinter.RIGHT)
        
         self.canvas.bind("", self.on_pressed)
        self.canvas.bind("", self.on_dragged)
 
        window.mainloop()

Draw()   
  

Outcome


Commanding the machine to draw something


FTDI Interface Board

We milled the fdti interface board using this design onTutorial page. Our challenge was to mill the board by importing a png file, instead of what we've previously learned, which was making from scratch using the eagle schematic to board file to gcode to etch file.


To mill PCB board via "Import Image 2D" on CNC USB Software:


The areas marked by red was not imported correctly and was unacceptable

Cleaned up the image using Coreldraw and tweaked the import parameters

Difference in toolpaths after adjusting the parameters


Learning point

I made a noob mistake. Packing the board next to the motor steppers resulted in a disaster of damaging 2 boards because the board short-circuited on contact with metal. One colleague suggested to use electrical tape to protect the base from accidental short in future. Indeed, "Failures are the beginning of success", said one colleague. She will remember this lesson for good thanks to this mistake. Thanks to Steven who took the challenge to troubleshoot the boards, and managed to revived them. Basically he removed and replaced the damaged chip with an xmega328 board, downloaded the firmware from imoyer github and burned the firmware into the new MCU. Indeed we can learn something new with every problem we encounter.


Gestalt boards were short-circuited.


Future improvement

There surely are opportunities for improvements with this design, but those will have to be on hold until we are able to work on this project again.


For a more detailed documentation of our group project, check out the group page.

MTM Group Page »


Download workfiles


References