__MAIN_TEXT__

Page 1

TINY TRANSLATION


Elseware_Masters_Elective_2014 Muhammad_Amirrudin_Shah_(Jon) Anthony_Ip

Contents 1_Introduction 1.a_Hardware Examples 1.b_Software Examples 1.c_Architectural Hypotheses 1.d_Initial Research Explorations 1.e_Arduino Research 2_Implementation 2.a_Learning Electronics 2.b_Learning Processing 2.c_Prototypes - Component Integration 2.d_Conclusion 3_Refinement 3.a_Observed Qualities 3.b_Selection Criteria 3.c_Discussion 4_Appendix 4.a_Electronic Experiments 4.b_Software Experiments 5_Commented Code


Right: http://cdn.archinect.net/images/1200x/10/10hqdd8 0egg5ifj8.jpg Below:http://i.kinja-img.com/gawker-media/image/upload/s-iHfUKh3o--/17lmdvs6p4r91jpg.jpg

Introduction Introduction:The project investigates additive forms generated from Photophobia, the condition of being hyper-sensitive to light. By developing this idea of Photophobia the project includes the construction of a robot and implementation of digital architectural production. The goal of the robot is to follow a rule-based system to create recursive landscapes. We are interested in cultivating the relationship between architects and the machine, where through coding, technical means and robotic processes is able to result in architectural spaces and qualities. The tools used to design these proposed sensory landscapes are arduino, a cnc machine and processing. These three tools were used homogeneously to communicate between the physical cnc machine and the digital code. The architectural purpose of the project is to investigate an intelligent self-learning, light sensitive machine able to work autono-

mously to create unpredictable architecture spaces through the medium of silicon or hot glue. The significant achievements of the project were to design the first prototype and get it working through processing, teaching the machine to draw following a walker and the addition of a hot glue gun. The priorities of the project altered due to time, economic and equipment limitations. The drawbacks and limitations of the project were recreating

the machine three times larger, many weeks were used in testing shapes and function, dimensions were redrawn due to change of motors and material thickness. Unexpected outcomes of the machine included putting the


Right: http://wewanttolearn.files.wordpress.com/2011/10/ matsys_pwall.jpg Below: http://doc.tuxee.net/tracking

Hardware & Software Examples The two software’s used in the Photophobic robot project were processing and arduino. Processing is “an open source programming language and integrated development environment (IDE) built for the electronics arts, new media art, and visual design communities with the purpose of teaching the fundamentals of computer programming in a visual context, and to serve as the foundation for electronic sketchbooks.”. Arduino is the program used to communicate between processing and the Arduino single-board microcontroller. This Arduino was intended to make “building interactive objects or environments more accessible”. Typically processing is used in the visual arts industry for generating a rule-based art piece with a pattern. Arduino was intended to be used by the electronics or robotics industry creating simple machines able to react to situations. Other components explored include mouse simulation, walker

movement in processing, web cam integration, heat detectors and hall effect sensor. Mouse simulation was the first component explored in this project, through processing a code was scripted so that the x and y axis of the mouse were linked to the axis on the cnc machine. Thus, the cnc would move to the same coordinate location as the mouse digitally. The second step was for the cnc to follow a random walker movement on processing. The nature

of this experiment was interesting as it was the first self-generating movement sent to the cnc machine. To develop this theory, our explorations began to integrate

the webcam, heat detectors and hall effect sensor to evolve selfprocessing of the robot beyond a single random walker. The integration of the webcam / kinect were investigations of recognizing light and body movement. Based on research, the webcam would be able to isolate shading, resulting in identifying sources of light. This would be useful for exploration towards light sensitivity. The integration of the kinect involved identifying body direction movements and generating creative architectural qualities from a certain gesture, for example hand waving, blinking or even dancing.

The heat detector and hall effect sensor implicate reaction of the cnc machine from heat of distance. This indicated manifesta-

tion of patterns generated from either a hot material cooling, sunlight heat or temperature. To understand how to code a light detector, we looked towards Andrew Kudless’ P-wall. This wall celebrates the “self-organization of material under force”. The wall is a pattern created from isolating areas of dark and light of a greyscale image and setting the

density of points to be higher on darker areas and less on lighter areas, by filling the points with material this pattern through digital means is created. We began to think this was relevant to our machine and this process in reacting to light could be used by our cnc machine. The second precedent investigated was a webcam controlled by Arduino


Right: http://matsysdesign.com/wp-content/uploads/2010/02/zerofold_img_1422.jpg Below: http://static.dezeen.com/uploads/2013/05/dezeen_ ProtoHouse-by-Softkill-Design_a.jpg

Architectural Hypothesis Robotics has always been a close industry to architecture depicted by moving louvers, automatic light systems and evolution of cranes. However, until recently robotics and digital media have been used to fabricate architecture either through pre-fab or 3d printing. With movies emphasizing artificial intelligence and hard science novels including Greg Eagan describing universes where humanity can upload their minds. We were interested in the self-replicating machine when architecture could create architecture. With processing and 3d printing, we believe in the future that architecture would certainly be able to adapt and evolve autonomously. The design of the cnc creating architectural spaces is envisioned to scale larger and its material would be harder, possibly concrete and its product would be a building. However, if a building were to be created, the form of our machine would no longer be viable, because the machine

would be larger than the building. Resulting in the possibility that the machine would need to be designed more efficiently. We would like to be able to eject multiple materials at different times creating layering of ingre-

support these different materials and due to time limitations we are unable to continue research in the development of this. By creating a cnc machine that ejects silicon and combining different softwares including processing and Arduino, we are investigating if our hypothesis of creating an autonomous architecture is possible. By combining both processing and the machine it enables us to be more creative in the design process.

dients to create a successful building for comfortable living purposes. This would benefit the building in many ways where materials could be separated between floor, roof and wall. However, our machine does not

If we were to speculate the possibilities of this machine, to make it possible, the design would need to be much taller and thinner for practical construction sites. In the future it could replace cranes in construction to create a building. It would save economic expenses and time

consumption creating enhanced efficiency on site.


Left. : Robot arm programmed to write similar to RMIT

Right: Lego Cnc. Source: http://www.instructables.com/id/ Lego-CNC3D-printerplotter/

Below. Diagrams of Stepper Motors used in a DIY CNC machine

Below. Lego Cnc Source: http://www.instructables.com/id/ Lego-CNC3D-printerplotter/ Below. Toothpick Bridge Builder Source: http://spectrum. ieee.org/automaton/robotics/diy/watch-this-robot-build-aramp-by-randomly-flinging-3600-toothpicks

Initial Research Explorations Our first investigation was the traditional DIY CNC machine driven by a computer. This machine is a stitc machine including the board with a drill attached. Three stepper motors create the x, y and z axis. The benefit of using stepper motors is that they are able to turn 360o resulting in a theoretically infinite length to work on. Compared to servo motors, which are only able to turn 180o.

The second positive design of this cnc is that the axis are moved by ball bearings, creating a smoother movement and flow. This size of the machine is too large, we are aiming to create a machine half the size of the asda

A fun investigation, was the lego CNC. We analysed the machine, other variations of this included where the ‘canvas’ would rotate creating a third axis and resulting in a sculpture. Gears would fit perfectly in these designs, however at the cost of a higher budget.

on Intelligent Robots and Systems in Vilamoura, Portugal The goal of the robot is to use amorphorous materials to create a ramp where it can elevate itself. Inspiration for these robots derived from animals including birds, termites and insects. The researchers investigated how these This design is much more complex than creates built nests and structures. the previous precedent. Both machines are not autonomous. The first material were toothpicks, the “Materials and Mechanisms for Amorphous Robotic Construction,” by Nils Napp, Olive R. Rappoli, Jessica M. Wu, and Radhika Nagpal from Harvard University and Worcester Polytechnic Institute, was presented at the 2012 IEEE/RSJ International Conference

Above: Servo Motor Diagrams

robot would flick a toothpick in the general direction and eventually creating a bridge foritself to move above the box. The second material used was a casting foam-like liquid. This would dry and eventually create a stable bridge for the robot to move.

Above: Stepper Motor Diagrams


Left: http://files.tested.com/photos/2014/02/04/5789650116-arduino.jpg

Arduino Research

USB PORT

VOLTAGE + GROUND INPUT

NUMBERED DIGITAL INPUTS

This port was used in the project for communication between the computer and arduino. This process involved processing java script from the computer and uploading the information into the arduino through usb tethering. When uploading the arduino will flash green and orange lights until completion.

These ports were used for transferring electricity from the laptop into the arduino to manipulate its movements. The ground was used for to keep the negative of the arduino 0V.

These ports were used to connect the servo motors with the arduino. The servo motors worked by connecting the digital inputs with the yellow cord of the servo motor sending information from the arduino to the motors.


Left. : Render from Hotglue Output to Meshlab Below. Photos of Testing Prototype

Implementation The technical ambitions of our project this semester is to design and build the suitable machine for generating responsive architecture through robotics. The tool will be built through 3 servo motors, an Arduino chip and a breadboard. We will communicate with the machine via processing and Arduino. Through Processing and Arduino code we predict our script will be using feedback. The behavior of the machine will check for conditions of light through a detector and similar to the P-wall eject material onto digital nodes. This process can be interact with humans as we create shadow gestures altering the behavior of the cnc machine in real time. When designing the cnc machine, we worked with processing to control the servo motors. The method used is to connect the Arduino chip to the laptop and script code from either processing or Arduino. Each pin on the Arduino is stated on the code, therefore we know how to

control the components. To control the feedback between the detector and the motors, we process create nodal density from the images / code produced from the detector, the feedback is then processed through code via true or false questions to predict the artificial movements of the architectural tool.


Left. :Photo of Prototype CNC in progress Below. Photos of Electronic component testing

Learning Electronics Building the electronics and machine were one of the biggest challenges we faced. http://www. instructables.com/ was the primary resource used in building the machine and connecting the electronics. This site contained many examples of people building similar machines, however because of our intention and redesign of the cnc machine, instructables was no longer relevant. Developing from the point of the built machine, we regularly went to Jaycar Electronics for advice on how components connected and how to resolve issues. We would suggest learning what type of machine you build from instructables, and if you have any questions either post on instructables or ask to friendly staff in the Jaycar Electronics city store. Some codes were found on github if you look around. The initial code and components successfully working were the single motor spinning and applied to the machine. We could not control when the motor stopped, but it was our first step in generating dynamic

movement from the cnc robot. This code was limited by turning only a single motor and we needed all three motors working to fit our vision.

By evolving our single motor code, we experimented the same code withdifferentelectricalcomponents. During one of the experiments, we discovered that when attaching a potentiometer to regulate the speed, however the machine would generate uncontrolled movements almost like-glitching movements.

Our final development of this code was to get all three motors working, we resolved this by assigning the correct pins of the Arduino and referenced in processing.

Hot glue output from CNC machine, will undergo digital process in meshlab


Calibration Experiment


Small_Physical_Model Top: Elevation Photos of Small CNC Machine Proto-type CNC machine (small) Materials include 3mm MDF, servo mini, 3mm acrylic, M3 screws


Large_Physical_Model Top: Elevation Photos of Large CNC Machine Proto-type CNC machine (small) Materials include 6mm MDF, servo motors, 3mm acrylic, M3 screws


Hot_GLUE_Output Top:Photos of Hot Glue Result


Experiment : _Additive_01 Left. : Hot Glue Meshlab - Vertex Colour Filling


Experiment : _Additive_01 Left. : Hot Glue Meshlab - Discrete Curvature


Experiment : _Additive_02 Left. : Hot Glue Meshlab - Interior_ Electronic Microscope Shader


Experiment : _Additive_02 Left. : Hot Glue Meshlab - Angle Distortion_Flat Lines


Experiment : _Additive_03 Left. : Hot Glue Meshlab - Discrete Curvature


Experiment : _Additive_03 Left. : Hot Glue Meshlab - Texture Angle Distortion


Left. :Photo of Prototype CNC in progress Below. Photos of Electronic component testing

Figure 5 Triple servo motor working for all axis

Figure 1 First servo motor was active and spinning

Proto-Proto-TYPE The first successful test was to enable the code for three motors to spin simultaneously, consequently we attached the motors inside the cnc robot and the machine energetically jumped around uncontrollably like a naughty son. The second successful prototype was the enable the cnc to follow the code of the mouse coordinates. Our final prototype was for the cnc to mimic the behavior of the random walkers.

Figure 3 Single servo motor axis with z axis

Figure 2 Erratic movement of servo motor with potentiometer Figure 6 All motors integrated to CNC Robot

Figure 4 Double servo motors connected through breadboard


Figure 1 Construction of large CNC machine

Figure 5 Model imported into Meshlab for analysis

LARGE_Prototype Developing our sucessful CNC design, we created a larger machine. the 3mm MDF was too flimsy and we resolved this by using 6mm MDF for construction. From using the mouse-to-cnc script we attached the hot glue gun and created meshes. Processing these meshes we took photos and uploaded using 123d Catch, then exported the obj into Meshlab to analyze curves and angle distortion for the final output.

Figure 3 Output through hot glue and mouse movement

Figure 6 Experimentation of curvature through colour range

Figure 2 Competed redesign of large CNC machine

Figure 4 Insertion of hot glue into 123d Catch for digital modelling and further investigation


Left : http://topocastlab.com/portfolio/cast-thicket/ Below: http://www.evolo.us/wp-content/uploads/2010/11/ repeat-competition-5.jpg

Conclusion Through both digital and physical tools, we were able to achieve a robotwhichwouldautonomouslybe able to create architectural qualities through a specific medium (In this case, hot glue). The significant sequence of our operations included building, integrating and coding. One of the hardest challenges we faced during the semester was the recreate the robot in a larger scale. We quickly discovered that altering a single part would affect at least another three parts because the robot was built using joints and screws which would need to line up. Being able to run code through the robot was a success and was definitely unexpected. When we introduced the code for the robot to ‘sketch’ it was liberating as it could finally become a tool for an architectural process. Investigating the language and how the computer would command the robot was a challenge

we would take time to understand how it would connect to an electrical circuit then the second challenge would be how to code the component and be able to control

it through processing. Despite the challenges we faced, we had a very strong design intent and goal for the semester which drove our passion to spend time in solving every issue we encountered.

The main limiting factors on the project was our inexperience with electronics and coding, this was in- To resolve these issues, it would fluenced by the time restrictions we have been better if the studio were given. For each component included an electrical engineer to

assist us in our many battles in getting the motors running and under control. Have a quick lesson on general electronics and how voltage, current, amps all work would have been a good help. Considering architecture students generally do not have electrical engineering knowledge. The “Calculated Pull” by Christina Ciardullo and Naomi Ocko has a similar intent to our robot, their research explores interests in“fields, networks, systems, circulation and tension”. The project experiments to making architectural spaces and material qualities from these concepts. Our vision of the robot was the explore our interest in light sensitivity and materializing the spaces of photophobia.


Left. : Image of Experiment 1 with single material Below. Photos of Testing Prototype

Refinement The technical ambitions of our project this semester is to design and build the suitable machine for generating responsive architecture through robotics. The tool will be built through 3 servo motors, an Arduino chip and a breadboard. We will communicate with the machine via processing and Arduino. Through Processing and Arduino code we predict our script will be using feedback. The behavior of the machine will check for conditions of light through a detector and similar to the P-wall eject material onto digital nodes. This process can be interact with humans as we create shadow gestures altering the behavior of the cnc machine in real time. When designing the cnc machine, we worked with processing to control the servo motors. The method used is to connect the Arduino chip to the laptop and script code from either processing or Arduino. Each pin on the Arduino is stated on the code, therefore we know how to

control the components. To control the feedback between the detector and the motors, we process create nodal density from the images / code produced from the detector, the feedback is then processed through code via true or false questions to predict the artificial movements of the architectural tool.


Left : http://topocastlab.com/portfolio/cast-thicket/ Below: http://www.evolo.us/wp-content/uploads/2010/11/ repeat-competition-5.jpg

Discussion We were ecstatic to create meshes from our robot through the hot glue medium, which was an unexpected outcome. Our architectural intent was to create an autonomous machine able to selfdetect conditions and to create architectural qualities and spaces from the feedback of these conditions. Our focus was Photophobia the phenomenon of sensitivity to light, through the use of a webcam we envisioned to detect dark and light to create reactive spaces. We did not know what geometry would be created if any, therefore it was a success for our robot to create any type of geometry. We speculate that the effect of different conditions including wind, sound and elevations would generate a more intelligent and complex mesh. We focused on the single phenomenon of light to create spaces with maximum sunlight, imagine if feedback were given to the robot of all the conditions of site, what would the form be? Would it really create the most site-intelligent architecture?

The project would be improved by introducing more conditions creating more feedback for the robot, by considering more conditions we speculate the robot would

design should be considered. The ball-bearing CNC machine would be a good reference, because it creates less friction for our robot and be a more feasible machine. The robot should slowly be modeled larger, as it fits its role as an autonomous machine for printing architecture. Additional code of interest would include the mouse-detecting code and the walker code for the CNC to react to.

create a more complex mesh for investigation. Different materials including even concrete would create a more realistic attempt in creating a site-sensitive architectural space. Significant hurdles to continuing the project would be to creating an even larger robot and introducing two different conditions and feedback for the machine to process. If the robot were to be made much larger than our proto-prototype, different motors would need to be used and even a different


Left. : Image of Experiment 1 with single material Below. Photos of Testing Prototype

Commented_Code


Left. : Image of Experiment with single material Photo of single servo motor1sweep

Erratic movement of servo motor with potentiometer

Below. Photos of Testing Prototype

1 SERVO /* Sweep by BARRAGAN <http://barraganstudio.com> Adapted by Philip van Allen <philvanallen.com> for the VarSpeedServo.h library (October 2013) This example code is in the public domain Sweep a servo back and forth from 0-180 degrees, 180-0 degrees Uses the wait feature of the 2013 version of VarSpeedServo to stop the code until the servo finishes moving Note that servos usually require more power than is available from the USB port - use an external power supply! */

void setup() { myservo.attach(servoPin); // attaches the servo on pin 9 to the servo object myservo.write(0,255,true); // set the intial position of the servo, as fast as possible, wait until done } void loop() { myservo.write(180,255,true); // move the servo to 180, max speed, wait until done // write(degrees 0-180, speed 1-255, wait to complete true-false) myservo.write(0,30,true); // move the servo to 180, slow speed, wait until done }

1 SERVO /* Sweep by BARRAGAN <http://barraganstudio.com> Adapted by Philip van Allen <philvanallen.com> for the VarSpeedServo.h library (October 2013) This example code is in the public domain Sweep a servo back and forth from 0-180 degrees, 180-0 degrees Uses the wait feature of the 2013 version of VarSpeedServo to stop the code until the servo finishes moving Note that servos usually require more power than is available from the USB port - use an external power supply! */

#include <VarSpeedServo.h>

#include <VarSpeedServo.h>

VarSpeedServo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created

VarSpeedServo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created

const int servoPin =9;

const int servoPin =9;

void setup() { myservo.attach(servoPin); // attaches the servo on pin 9 to the servo object myservo.write(0,255,true); // set the intial position of the servo, as fast as possible, wait until done } void loop() { myservo.write(180,255,true); // move the servo to 180, max speed, wait until done // write(degrees 0-180, speed 1-255, wait to complete true-false) myservo.write(0,30,true); // move the servo to 180, slow speed, wait until done }


Single servo motor with movement of z axis

1 SERVO /* Sweep by BARRAGAN <http://barraganstudio.com> Adapted by Philip van Allen <philvanallen.com> for the VarSpeedServo.h library (October 2013) This example code is in the public domain Sweep a servo back and forth from 0-180 degrees, 180-0 degrees Uses the wait feature of the 2013 version of VarSpeedServo to stop the code until the servo finishes moving Note that servos usually require more power than is available from the USB port - use an external power supply! */ #include <VarSpeedServo.h> VarSpeedServo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created const int servoPin =9;

void setup() { myservo.attach(servoPin); // attaches the servo on pin 9 to the servo object myservo.write(0,255,true); // set the intial position of the servo, as fast as possible, wait until done } void loop() { myservo.write(180,255,true); // move the servo to 180, max speed, wait until done // write(degrees 0-180, speed 1-255, wait to complete true-false) myservo.write(0,30,true); // move the servo to 180, slow speed, wait until done }

Double servo motors connected through breadboard

2 SERVO SWEEP /* SweepTwoServos By Philip van Allen <philvanallen. com> for the VarSpeedServo.h library (October 2013) This example code is in the public domain

const int servoPin1 = 9; // the digital pin used for the first servo const int servoPin2 = 11; // the digital pin used for the second servo

void setup() { myservo1.attach(servoPin1); // attaches the servo on pin 9 to the servo object myservo1.write(0,255,false); // set the Sweep two servos from 0-180, 180-0 intial position of the servo, as fast as in unison possible, run in background Uses the wait feature of the 2013 ver- myservo2.attach(servoPin2); // atsion of VarSpeedServo to start the first taches the servo on pin 9 to the servo servo moving in the background object and immediately starting a second myservo2.write(0,255,true); // set servo moving and waiting for the the intial position of the servo, as fast second one to finish. as possible, wait until done } Note that two servos will require more power than is available from void loop() { the USB port - use an external power myservo1.write(180,127,false); // supply! move the servo to 180, fast speed, run */ background // write(degrees #include <VarSpeedServo.h> 0-180, speed 1-255, wait to complete true-false) VarSpeedServo myservo1; // create myservo2.write(180,127,true); // servo object to control a servo move the servo to 180, fast speed, // a maximum of eight wait until done servo objects can be created VarSpeedServo myservo2; myservo1.write(0,30,false); // move the servo to 180, slow speed,

run in background myservo2.write(0,30,true); // move the servo to 180, slow speed, wait until done }


Triple servo motors running through a breadboard

SWEEP 3 SERVOS /* SweepTwoServos By Philip van Allen <philvanallen. com> for the VarSpeedServo.h library (October 2013) This example code is in the public domain Sweep two servos from 0-180, 180-0 in unison Uses the wait feature of the 2013 version of VarSpeedServo to start the first servo moving in the background and immediately starting a second servo moving and waiting for the second one to finish. Note that two servos will require more power than is available from the USB port - use an external power supply! */ #include <VarSpeedServo.h> VarSpeedServo myservo1; // create servo object to control a servo // a maximum of eight servo objects can be created //VarSpeedServo myservo2;

//VarSpeedServo myservo3;

const int servoPin1 = 9; // the digital pin used for the first servo //const int servoPin2 = 10; //const int servoPin3 = 11; void setup() { myservo1.attach(servoPin1); // attaches the servo on pin 9 to the servo object myservo1.write(0,255,true); // set the intial position of the servo, as fast as possible, run in background // myservo2.attach(servoPin2); // attaches the servo on pin 9 to the servo object myservo2.write(0,255,false); // set the intial position of the servo, as fast as possible, wait until done // myservo3.attach(servoPin3); // attaches the servo on pin 9 to the servo object // myservo3.write(0,255,false); // set the intial position of the servo, as fast as possible, wait until done }

Servo motors integrated into cnc applied into axis

void loop() { myservo1.write(180,127,false); // move the servo to 180, fast speed, run background // write(degrees 0-180, speed 1-255, wait to complete true-false) // myservo2.write(180,127,true); // move the servo to 180, fast speed, wait until done

SWEEP 3 SERVOS

// myservo3.write(180,127,true); // move the servo to 180, fast speed, wait until done

Sweep two servos from 0-180, 180-0 in unison Uses the wait feature of the 2013 version of VarSpeedServo to start the first servo moving in the background and immediately starting a second servo moving and waiting for the second one to finish.

myservo1.write(0,30,false); // move the servo to 180, slow speed, run in background // myservo2.write(0,30,true); // move the servo to 180, slow speed, wait until done // myservo3.write(0,30,false); // move the servo to 180, slow speed, wait until done }

/* SweepTwoServos By Philip van Allen <philvanallen. com> for the VarSpeedServo.h library (October 2013) This example code is in the public domain

Note that two servos will require more power than is available from the USB port - use an external power supply! */ #include <VarSpeedServo.h> VarSpeedServo myservo1; // create servo object to control a servo // a maximum of eight servo objects can be created //VarSpeedServo myservo2;

//VarSpeedServo myservo3;

const int servoPin1 = 9; // the digital pin used for the first servo //const int servoPin2 = 10; //const int servoPin3 = 11; void setup() { myservo1.attach(servoPin1); // attaches the servo on pin 9 to the servo object myservo1.write(0,255,true); // set the intial position of the servo, as fast as possible, run in background // myservo2.attach(servoPin2); // attaches the servo on pin 9 to the servo object myservo2.write(0,255,false); // set the intial position of the servo, as fast as possible, wait until done // myservo3.attach(servoPin3); // attaches the servo on pin 9 to the servo object // myservo3.write(0,255,false); // set the intial position of the servo, as fast as possible, wait until done }

void loop() { myservo1.write(180,127,false); // move the servo to 180, fast speed, run background // write(degrees 0-180, speed 1-255, wait to complete true-false) // myservo2.write(180,127,true); // move the servo to 180, fast speed, wait until done // myservo3.write(180,127,true); // move the servo to 180, fast speed, wait until done

myservo1.write(0,30,false); // move the servo to 180, slow speed, run in background // myservo2.write(0,30,true); // move the servo to 180, slow speed, wait until done // myservo3.write(0,30,false); // move the servo to 180, slow speed, wait until done }


Arduino Code for Mouse x and y

//Arduino code: #include <Servo.h> Servo yservo; Servo xservo; // servos for x and y //set initial values for x and y int ypos = 0; int xpos= 0; void setup(){ xservo.attach(9); //(analog pin 0) for the x servo yservo.attach(10); //(analog pin 1) for the y server Serial.begin(19200); // 19200 is the rate of communication Serial.println(“Rolling”); // some output for debug purposes. } void loop() { static int v = 0; // value to be sent to the servo (0-180) if ( Serial.available()) { char ch = Serial.read(); // read in a character from the serial port and assign to ch switch(ch) { // switch based on the value of ch case ‘0’...’9’: // if it’s numeric v = v * 10 + ch - ‘0’;

Processing Code for Mouse x and y

/* so if the chars sent are 45x (turn x servo to 45 degs).. v is the value we want to send to the servo and it is currently 0 The first char (ch) is 4 so 0*10 = 0 + 4 - 0 = 4; Second char is 4; 4*10 = 40 + 5 = 45 - 0 = 45; Third char is not a number(0-9) so we drop through... */ break; case ‘x’: // if it’s x /* ....and land here where we send the value of v which is now 45 to the x servo and then reset v to 0 */ xservo.write(v); v = 0; break; case ‘y’: yservo.write(v); v = 0; break; } } }

update(mouseX, mouseY);

import processing.serial.*;

}

int xpos=90; // set x servo’s value to mid point (0-180); int ypos=90; // and the same here Serial port; // The serial port we will be using

void update(int x, int y) { //Calculate servo postion from mouseX xpos= x/2; ypos = y/2; //Output the servo position ( from 0 to 180) port.write(xpos+”x”); port.write(ypos+”y”); }

void setup() { size(360, 360); frameRate(100); println(Serial.list()); // List COM-ports //select second com-port from the list (COM3 for my device) // You will want to change the [1] to select the correct device // Remember the list starts at [0] for the first option. port = new Serial(this, Serial.list()[0], 19200); } void draw() { fill(175); rect(0,0,360,360); fill(255,0,0); //rgb value so RED rect(180, 175, mouseX-180, 10); // xpos, ypos, width, height fill(0,255,0); // and GREEN rect(175, 180, 10, mouseY-180);


CNC Machine cut layout

Profile for Muhammad Amirruddin Shah Ahmad Nizam

Tiny Translation  

Muhammad Amirruddin Shah Ahmad Nizam Anthony Ip

Tiny Translation  

Muhammad Amirruddin Shah Ahmad Nizam Anthony Ip

Profile for mrrazr
Advertisement