Machine design

Over View of Assignments

What is Machine Design ?

Machine Design is one of the important branches of Engineering Design. To understand what exactly machine design or mechanical design is let us consider the example of the gear box of the car. The gear box transmits the motion and the power of the engine to the wheels of the vehicle. The gearbox comprises group of gears which are subjected to not only motion but also the load of the vehicle. For the gears to run at desired speeds and take desired loads it is important that they should be designed. During designing various calculations are performed considering desired speeds and loads and finally the gear of particular material and specific dimensions that can take all loads and that can be manufactured at least possible cost giving optimum performance is designed. In similar fashion all the components of the car, including engine, have to be designed so that they optimally meet all the functional requirements at lowest possible cost. This whole process of designing is called as machine design or mechanical design.

Read More

Work Assigned

Link to Group Project Page

The FabArm we build on Mechanical Design week had some missing components and some fixtures also broke. So we decided to redo it once again ,I have helped to build the final model of the Machine,The most of the designing and testing was done in the week9. but this week we had to make couple of flange shafts to hold up the fab arm. This part was missing when we build the fab arm first time, that is what we did this week. We took apart a printer for a Aluminum Alloy Rod. We cut the rod for our specific need.

Cutting the Alumium Rod

Ajith and Ganadev also helped me initally and they left after some to work on the other work assigned.

Assembly of the Fab Arm

After this I worked on the GUI based on kivy along with ganadev and have used the sample code from Gestalt library to get started and understand it

  1. from kivy.uix.popup import Popup
  2. from kivy.app import App
  3. from kivy.uix.gridlayout import GridLayout
  4. from kivy.uix.label import Label
  5. from kivy.uix.textinput import TextInput
  6. from kivy.uix.button import Button
  7. from kivy.uix.boxlayout import BoxLayout
  8. from kivy.uix.stacklayout import StackLayout
  9. from kivy.uix.slider import Slider
  10. from kivy.config import Config
  11. Config.set('modules', 'serial', '')
  12. # Forked from DFUnitVM Oct 2013
  13. # set portname
  14. # set location of hex file for bootloader
  15. #
  16. #------IMPORTS-------
  17. from pygestalt import nodes
  18. from pygestalt import interfaces
  19. from pygestalt import machines
  20. from pygestalt import functions
  21. from pygestalt.machines import elements
  22. from pygestalt.machines import kinematics
  23. from pygestalt.machines import state
  24. from pygestalt.utilities import notice
  25. from pygestalt.publish import rpc #remote procedure call dispatcher
  26. import time
  27. import io
  28. import threading
  29. import serial
  30. #------VIRTUAL MACHINE------
  31. class virtualMachine(machines.virtualMachine):
  32. def initInterfaces(self):
  33. if self.providedInterface: self.fabnet = self.providedInterface #providedInterface is defined in the virtualMachine class.
  34. else: self.fabnet = interfaces.gestaltInterface('FABNET', interfaces.serialInterface(baudRate = 115200, interfaceType = 'ftdi', portName = '/dev/tty.usbserial-FT0METG6'))
  35. def initControllers(self):
  36. self.xAxisNode = nodes.networkedGestaltNode('X Axis', self.fabnet, filename = '086-005a.py', persistence = self.persistence)
  37. self.xNode = nodes.compoundNode(self.xAxisNode)
  38. def initCoordinates(self):
  39. self.position = state.coordinate(['mm'])
  40. def initKinematics(self):
  41. self.xAxis = elements.elementChain.forward([elements.microstep.forward(4), elements.stepper.forward(1.8), elements.leadscrew.forward(6.096), elements.invert.forward(True)])
  42. self.stageKinematics = kinematics.direct(1) #direct drive on all axes
  43. def initFunctions(self):
  44. self.move = functions.move(virtualMachine = self, virtualNode = self.xNode, axes = [self.xAxis], kinematics = self.stageKinematics, machinePosition = self.position,planner = 'null')
  45. self.jog = functions.jog(self.move) #an incremental wrapper for the move function
  46. pass
  47. def initLast(self):
  48. # self.machineControl.setMotorCurrents(aCurrent = 0.8, bCurrent = 0.8, cCurrent = 0.8)
  49. # self.xyzNode.setVelocityRequest(0) #clear velocity on nodes. Eventually this will be put in the motion planner on initialization to match state.
  50. pass
  51. def publish(self):
  52. # self.publisher.addNodes(self.machineControl)
  53. pass
  54. def getPosition(self):
  55. return {'position':self.position.future()}
  56. def setPosition(self, position = [None]):
  57. self.position.future.set(position)
  58. def setSpindleSpeed(self, speedFraction):
  59. # self.machineControl.pwmRequest(speedFraction)
  60. pass
  61. class FabControl(GridLayout):
  62. def __init__(self, **kwargs):
  63. super(FabControl, self).__init__(**kwargs)
  64. self.cols = 3
  65. self.row = 3
  66. global serialcom, tempmotor1, tempmotor2, tempmotor3
  67. tempmotor1 = 120
  68. tempmotor2 = 90
  69. tempmotor3 = 90
  70. serialcom = serial.Serial()
  71. serialcom.braudrate = 115200
  72. serialcom.port = "/dev/tty.usbmodem1421"
  73. serialcom.open()
  74. self.add_widget(Label(text='Motor1 [ 0 to 120 ] '))
  75. self.motor1 = Slider(min=-30, max=120, value=120)
  76. self.motor1.bind(value=self.Motor1Change)
  77. self.add_widget(self.motor1)
  78. self.motor1value = Label(text=str(self.motor1.value))
  79. self.add_widget(self.motor1value)
  80. self.add_widget(Label(text='Motor2 [ 0 to 180 ] '))
  81. self.motor2 = Slider(min=0, max=180, value=90)
  82. self.motor2.bind(value=self.Motor2Change)
  83. self.add_widget(self.motor2)
  84. self.motor2value = Label(text=str(self.motor2.value))
  85. self.add_widget(self.motor2value)
  86. self.add_widget(Label(text='Motor3 [ 45 to 130 ] '))
  87. self.motor3 = Slider(min=45, max=130, value=90)
  88. self.motor3.bind(value=self.Motor3Change)
  89. self.add_widget(self.motor3)
  90. self.motor3value = Label(text=str(self.motor3.value))
  91. self.add_widget(self.motor3value)
  92. self.add_widget(Label(text='Motor4 [ -100 to 100 ] '))
  93. self.motor4 = Slider(min=-100, max=100, value=0)
  94. self.motor4.bind(value=self.Motor4Change)
  95. self.add_widget(self.motor4)
  96. self.motor4value = Label(text=str(self.motor4.value))
  97. self.add_widget(self.motor4value)
  98. self.move = Button(text="Move")
  99. self.add_widget(self.move)
  100. self.move.bind(on_press=self.initiatemove)
  101. self.startrec = Button(text="Start Record")
  102. self.add_widget(self.startrec)
  103. self.stoprec = Button(text="Stop Record")
  104. self.add_widget(self.stoprec)
  105. self.play = Button(text="Play")
  106. self.add_widget(self.play)
  107. def Motor4Change(self, instance, value):
  108. self.motor4value.text = str(value)
  109. def Motor1Change(self, instance, value):
  110. self.motor1value.text = str(value)
  111. threading.Thread(target=self.movemotor1).start()
  112. def Motor2Change(self, instance, value):
  113. self.motor2value.text = str(value)
  114. threading.Thread(target=self.movemotor2).start()
  115. def Motor3Change(self, instance, value):
  116. self.motor3value.text = str(value)
  117. threading.Thread(target=self.movemotor3).start()
  118. def initiatemove(self,instance):
  119. # time.sleep(5)
  120. threading.Thread(target=self.movemotor4).start()
  121. threading.Thread(target=self.movemotor1).start()
  122. threading.Thread(target=self.movemotor2).start()
  123. threading.Thread(target=self.movemotor3).start()
  124. def movemotor4(self):
  125. print "movemotor4 called"
  126. global stage
  127. # print stage
  128. # print self.motor4.value
  129. # print self.motor1.value
  130. # print self.motor2.value
  131. # print self.motor3.value
  132. #
  133. movemotor4 = int(self.motor4.value)
  134. supercoords = [[movemotor4]]
  135. for coords in supercoords:
  136. stage.move(coords, 0)
  137. status = stage.xAxisNode.spinStatusRequest()
  138. while status['stepsRemaining'] > 0:
  139. time.sleep(0.001)
  140. status = stage.xAxisNode.spinStatusRequest()
  141. # ser = serial.Serial()
  142. # ser.braudrate = 115200
  143. # ser.port = "/dev/tty.usbmodem1411"
  144. # ser.open()
  145. def movemotor1(self):
  146. print "movemotor1called"
  147. global serialcom, tempmotor1
  148. movemotor1 = self.motor1.value - tempmotor1
  149. tempmotor1 = self.motor1.value
  150. print movemotor1
  151. # print movemotor2
  152. # print movemotor3
  153. if serialcom.isOpen():
  154. print("serialcomial is open!")
  155. # serialcom.write('a\n')
  156. if movemotor1 > 0:
  157. for i in range(int(movemotor1)):
  158. print 'sending a'
  159. serialcom.write('a\n')
  160. # time.sleep(.5)
  161. # print serialcom.read()
  162. print serialcom.readline()
  163. else:
  164. for i in range(abs(int(movemotor1))):
  165. serialcom.write('d\n')
  166. # time.sleep(.5)
  167. # print serialcom.read()
  168. print serialcom.readline()
  169. # serialcom.close()
  170. def movemotor2(self):
  171. print "movemotor2called"
  172. global serialcom, tempmotor2
  173. movemotor2 = self.motor2.value - tempmotor2
  174. tempmotor2 = self.motor2.value
  175. print movemotor2
  176. if serialcom.isOpen():
  177. print("serialcomial is open!")
  178. # serialcom.write('a\n')
  179. if movemotor2 > 0:
  180. for i in range(int(movemotor2)):
  181. print 'sending b'
  182. serialcom.write('b\n')
  183. # time.sleep(.5)
  184. # print serialcom.read()
  185. print serialcom.readline()
  186. else:
  187. for i in range(abs(int(movemotor2))):
  188. serialcom.write('e\n')
  189. # time.sleep(.5)
  190. # print serialcom.read()
  191. print serialcom.readline()
  192. def movemotor3(self):
  193. print "movemotor3called"
  194. global serialcom, tempmotor3
  195. movemotor3 = self.motor3.value - tempmotor3
  196. tempmotor3 = self.motor3.value
  197. print movemotor3
  198. if serialcom.isOpen():
  199. print("serialcomial is open!")
  200. # serialcom.write('a\n')
  201. if movemotor3 > 0:
  202. for i in range(int(movemotor3)):
  203. print 'sending c'
  204. serialcom.write('c\n')
  205. # time.sleep(.5)
  206. # print serialcom.read()
  207. print serialcom.readline()
  208. else:
  209. for i in range(abs(int(movemotor3))):
  210. serialcom.write('f\n')
  211. # time.sleep(.5)
  212. # print serialcom.read()
  213. print serialcom.readline()
  214. class FabApp(App):
  215. def build(self):
  216. global stage
  217. stage = virtualMachine()
  218. # print dir(stage.xNode)
  219. #stage.xNode.loadProgram('../../../086-005/086-005a.hex')
  220. #stage.xNode.setMotorCurrent(1)
  221. stage.xNode.setVelocityRequest(8)
  222. return FabControl()
  223. if __name__ == '__main__':
  224. FabApp().run()

To run this code on the ubuntu you have to download the kivy module you can download the kivy module by doing two steps below

  • $ sudo add-apt-repository ppa:kivy-team/kivy
  • $ sudo apt-get install python3-kivy
  • Once you are done with it you can simplely run the program using the command kivy fabarmkivy.py

    UI Design

    © 2017, made with by scitechindian

    Creative Commons License

    This work done by SYED JUNAID AHMED is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.