https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Special:NewPages&feed=atom&hideredirs=1&limit=50&offset=&namespace=0&username=&tagfilter=ENGR005_2012 - New pages [en]2024-03-28T11:59:55ZFrom ENGR005_2012MediaWiki 1.26.3https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Https://wikis.swarthmore.edu/Https://wikis.swarthmore.edu/2024-01-18T17:15:07Z<p>Maxima: Created page with "https://wikis.swarthmore.edu/"</p>
<hr />
<div>https://wikis.swarthmore.edu/</div>Maximahttps://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Team_Crossbow-finalTeam Crossbow-final2012-12-18T05:43:15Z<p>Cpitts1: Created page with 'http://wikis.swarthmore.edu/ENGR005_2012/index.php/File:CROSSBOW.doc'</p>
<hr />
<div>[[http://wikis.swarthmore.edu/ENGR005_2012/index.php/File:CROSSBOW.doc]]</div>Cpitts1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Final_Project_Written_Report_Clock_Em_Sock_EmFinal Project Written Report Clock Em Sock Em2012-12-17T14:23:39Z<p>Schen3: /* Results: */</p>
<hr />
<div>==Final Clock Em Sock Em Written Report==<br />
<br />
===Title:=== <br />
Clock em’ Sock em’ <br />
<br />
===Group Members:=== <br />
Erin Gluck, Daniel Redelmeier, and Lucas Chen<br />
<br />
===Abstract:===<br />
We designed gears and hands with the Solidworks, 3D printed them out, and assemble them into a mechanical analog clock, with an 1 rpm motor as our energy source.<br />
<br />
===Introduction:===<br />
For our project we decided to design and build a mechanical analog clock. We chose this project because we wanted to build something and become more familiar with the designing process that is used in the real world. We wanted to design a unique clock and since most clocks have each hand on the same plane, our clock is unique because it has three separate gears where you can see each individual hand moving. We also wanted to become more familiar with Solidworks, which we were able to do through this project.<br />
<br />
===Background/ Theory:=== <br />
Important Formulas: v1 = -v2, w1r1 = -w2r2, W engine = 1rpm, W second = W engine, W minute = 1/60Wsecond = 1/60rpm, W hours = Wminute/12 = 1/720rpm. <br />
<br />
===Completed Project Design:=== <br />
Our completed solids works design <br />
<br />
[[File:Clock_model_1.PNG |500px|]]<br />
<br />
final solidworks design, with the one exception that the gear that is solid actually had holes in it.<br />
<br />
We fit the second hand on top of the motor, and then we used a combination of Radius5 gear and Radius12 gear to slow down the angular velocity to 1/60. This Radius12 gear is attached to the minute hand. And similarly, we used a combination of Radius6 gear and Radius2 gear to slow down the angular velocity to 1/12. And thus we got the correct speed for the hour hand.<br />
<br />
===Results:===<br />
Our project was successful and worked well. The second hand turned one round every minute. So our timing is recording correctly. <br />
We did encounter one error with measurements that we eventually realized and reprinted gears for. <br />
<br />
Here is how the final project turned out <br />
<br />
[[File:Final.png]]<br />
<br />
===Discussion/ Conclusion:=== <br />
This project took numerous steps to complete. We first had to come up with the proper measurements for the gears as well as an over all design idea for the clock. Our first design had a gear with radius 1 attached to a large gear with radius 12. Then another gear with a radius of 1 attached to a gear with radius 5. Finally a gear with radius three attached to a gear with radius four. This kept the ratios for the second minute and hour hands accurate. We had to redesign because there was nothing to support the gear with a radius of 5. So we can up with a very similar design but now every gear was supported by the metal rods. When designing the teeth the main thing we had to keep in mind was making sure the radius of the indented teeth was equal to the radius of the teeth that stuck out. Finally building the hands was difficult but we managed to design the three hands of the clock by having a cylinder stick horizontally our of another cylinder that’s on top of a gear. After we finished designing everything we printed the pieces and had to soak them to get rid of some excess materiel. In conclusion our clock is very unique and we are proud of our E5 project.</div>Egluck1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Action_Potential_Final_ReportAction Potential Final Report2012-12-17T07:31:07Z<p>Kbarron1: /* LEDs */</p>
<hr />
<div>==Team Action Potential: Modeling the Electrical Currents in a Neuron==<br />
===Participants===<br />
* [[User: Kbarron1|Kate Barron]]<br />
* [[User:jlandis2 | Joe Landis]]<br />
<br />
==Abstract==<br />
<br />
There were several steps that we needed to complete for our project: the first was to decide how to construct our model and attach the LED lights. There were several options, but we decided to go for the most straightforward one, which entailed constructing the model in SolidWorks with holes the size of LED lights. Joseph modeled the neuron, using mostly the spline tool and the extrusion tool in SolidWorks, and Kathryn helped while also planning the lighting effects and creating a MATLAB code to program them. We included every main element of a neuron: the dendrites, the cell body, with a nucleus, two ribosomes and two endoplasmic reticulums, and the axon, which in turn carried the axon terminals. We placed the lights in a way that, through MATLAB coding, we could animate the action potential process by activating the LEDs in a particular region of the cell in the appropriate order: dendrites, nucleus, axon, axon terminals. We ran into some trouble with the proportions of the model in SolidWorks, mainly because of the multiple scalings that we used, so we could not attach the LED lights to the model itself. To deal with this issue we picked out a piece of wood to mount our model on, and the staff in the Wood shop kindly drilled holes for the lights at locations we had previously marked. After this Joseph strung the ground wires together, attached to the shorter wire on each LED light, while Kathryn soldered the E5 Shield to the live wires and, in turn, to the longer wire on each LED light. Kathryn tweaked the program for each set of lights after the physical model had been completed and mounted to the board, and after that step was finished, our project was complete.<br />
<br />
<br />
==Introduction==<br />
<br />
-Kathryn is very interested in Biology, so she had the idea to model a brain cell in Solidworks. Joseph thought the model would be a fun challenge, so that’s what we agreed on. Professor Cheever suggested that we use LED lights to animate the action potential of the cell and he explained to us how we should go about it, a process that we outlined in the abstract. Our goals were to construct a three-dimensional model of a neuron on SolidWorks, print it, and attach LED lights in the holes we had included. As we explained in the abstract, however, we could not include the cuts that would make the holes for the LED lights large enough, so our new goal became to attach the model to a board and let the LEDs shine through.<br />
<br />
-This project was interesting and engaging because we were taking something as incredibly complex as the neuron, simplifying it, and essentially mimicking the way that the body transmits thought and emotion. We were also pleased to learn some basic electrical engineering techniques as well when attaching the LEDs, and found it to be a very enriching experience. We were motivated by our clearly defined goals and our interest in both the idea behind the project and the work the project involved.<br />
<br />
==Background/Theory==<br />
===Nerve Cells===<br />
<br />
Neurons are the cells that direct thought, senses, and feeling in our bodies.The membrane barrier surrounding the cell keeps concentrations of certain ions (salts: potassium+ and sodium+)at very specific levels both outside, and inside the fluid cytoplasm of the cell. Since the ions have charges, this results in an electrical potential between the inside and outside of the membrane. When the nerve is stimulated (by pressure, chemicals, or other interactions) the cell responds by changing those ion concentrations in a very specific way; the concentrations change such that the normal negative (resting) potential is switched to a positive potential in the area that received the stimulus. This causes the surrounding areas to react by temporarily switching potential as well; overall a chain reaction of negative-to-positive potential changes travels from the dendrites (structures receiving input) to the axon terminals (structures that communicate to other cells). (Sadava 2006)In this project, we used LED lights to simulate this electrical signal traveling down the cell.<br />
<br />
===LEDs===<br />
The LED lights we used are pictured below (source Prof. Cheever pers. comm.). <br />
[[File:LED3Diagram.gif|200px|thumb|left|Diagram of a 3mm LED]]<br />
Each LED has a ground pin and a power pin that had to be correctly wired to the E5 Shield. The ground pins were connected together and led to the ground hole on the E5 Shield. All of the LEDs were assigned power pin numbers that corresponded to where they plugged in on the E5 Shield. Those numbers were used to sequence the LEDs using matlab code. The LEDs were sequenced to first show insufficient stimulation in the dendrites (3 LEDs turn on and off at half brightness), then full signaling/action potential, as all the lights on the cell light up in order.<br />
<br />
===Matlab===<br />
The matlab code was fairly simple (Appendix 1); it mainly operates using for-loops to separate various sections of the neuron (e.g. pins 11,12, and 7 are the axon terminal lights). Vectors were constructed for the necessary pin numbers, then the for-loop ran the vector's values through either the a.analogWrite function or the a.digitalWrite function. The a.analogWrite function allows a pulse-count input, which varies the brightness on the specified LED. The a.digitalWrite funtion has simpler inputs, and simply turns the number-specified LED on or off.<br />
<br />
==Completed Project Design==<br />
<br />
-Our project, as previously stated, includes a roughly seven-inch-by-five-inch three-dimensional model of a neuron, with LED lights programmed to illustrate the passage of an electrical impulse. The model’s foundation is a sketch in SolidWorks, for which we employed the spline function to make the appearance more organic and true to our subject, and the extrusion function to create a three-dimensional, printable model out of our sketch. The sketch was initially too small, so we scaled it to five times its size, which led to an unfortunate string of scaling that left us confused as to how to create enough material for the 3.9-millimeter cuts that our LED lights required. The relation of the original sketch to the three-dimensional model was unintelligible, but the project was saved through the kind actions of the wood-shop staff. Our printed model served as our reference for the circles we drew on our block of wood, which would then serve as the holes for the insertion of the LED lights. The holes that the kind man in the wood shop drilled were 3.9 millimeters in diameter on the bottom side of the wood, and only 2 millimeters on the top so that the LED lights could easily fit without coming through to the top side. We used tacky material to attach the model to the block of wood, and inserted the LEDs into the bottom drill-holes. We used five red LEDs at the holes corresponding to the dendrite and nucleus sections of the cell to illustrate unprocessed electrical impulses. For the axon and axon terminals we used green LEDs so that viewers could see that these impulses are different, i.e. strong enough to be transmitted.<br />
We used 3-millimeter LEDs for our project, as we have referenced before. These lights have two main parts: the light itself and the two wires attached behind it. The light itself is 3 millimeters in diameter but its base is 3.85 millimeters. Out of the base, the longer wire to protrude is called the anode and the shorter is the cathode. These are the wires we previously referred to as the “longer” and “shorter” wire, respectively. After we had inserted the LEDs into the bottom side of the wood, the wires were still exposed. Joseph attached a ground wire, or a negatively-charged electron conductor, to the cathodes of each light, carefully winding the ground wire around the cathode using a special tool. He then attached each cathode to the next cathode in the string of LED lights so that the entire display was connected by a negatively-charged conductor. This completed about half of the electrical work needed for the project.<br />
<br />
-Kathryn completed the positively-charged portion of the electrical work. She first soldered a new top to the normal E5 Shield, attaching resistor pins to a circuit board with number-designated output pins. There were a total of 13 places to wire our LEDs to; our final design used 11. An inherent property of the E5Shield was that pins 3,5,6,9,10, and 11 were compatible with the a.analogWrite matlab function described above, but the rest of the pins were not. This meant that we attached the dendrite-region LEDs (the ones we wanted to vary the brightness of) to aforementioned pins, and the rest of the cell body LEDs could be assigned random pin numbers. Once all the soldering was done, and the code written, all that remained was testing it out!<br />
<br />
==Results==<br />
Ultimately, we were able to model a neuron in Solidworks (if not quite to the scale we had planned), manipulate the necessary circuits and wiring to perform our simulation. The code worked well, and after one glitch of a malfunctioning LED, all the wiring proved to be working well. The final demonstration of our project had its flaws however - most importantly, the somewhat ineffective lighting. The simulation of the action potential traveling down the cell as demonstrated by sequenced LEDs was not as easily visible as we had hoped; our printed model blocked to much of the light. Below are some video demonstrations of the LED neuron in action, as well as pictures of our final design.<br />
[[File:Neuronproject.JPG|200px|thumb|left|Final neuron model with E5 shield above]]<br />
[[File:Wiresss.JPG|200px|thumb|left|backside of the model, so many wires!]]<br />
[http://youtu.be/-QDmcwFwl5Y Video of neuron model with lights]<br />
<br />
[http://youtu.be/JfPWs7TubHU Video of lights without model]<br />
<br />
==Discussion==<br />
<br />
-Our project was not an experiment, but it was definitely a learning-and-growing experience for both of us. It forced us to learn more about SolidWorks and MATLAB, and to find alternate solutions when our original plan did not work out very well. If we could do the project over again from the start we would have planned for the block of wood to be our base the whole time, allowing us to drill 3.9 millimeter holes through all of the wood. This would allow us to cut holes in the model only 1 millimeter in diameter, which we could have fit in the model if it were only slightly bigger. That said, another issue we would have to fix is the confusion that resulted from scaling multiple times. Faced with the same situation we encountered then in the future, if we were unhappy with the first scale we would simply erase the action using the project manager toolbar, setting only one relation between the sketch and the model. One other improvement would be to hollow out most of the cell body using the shell tool. We are happy with the way that the lights were animated; we just wish they could shine through more and in a more-lit room.<br />
<br />
-One thing we could try to do if we worked further with this idea is to create individual parts for each part of the cell, connected by hinges so that the cell can bend and move.<br />
<br />
==Appendices==<br />
===1. Matlab Code===<br />
[[File:NeuronLEDCode.m]]<br />
<br />
===2. References===<br />
Sadava, D., Heller, H.C., Orians, G.H., Purves, W.K., Hillis, D.M. 2006. Life: The Science of<br />
Biology. 8th ed. Sunderland, MA: W. H. Freeman. Print. 1266</div>Jlandis2https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=The_PhoenixThe Phoenix2012-12-17T03:14:37Z<p>Aguarin1: </p>
<hr />
<div>This is the final report page for the work done by team Phoenix Chavez (Gustavo Garibay & Ascanio Guarini). Our project was to design a phoenix reminiscent of Phineas the Phoenix (Swarthmore's Mascot) and 3D print the final design. The main issues we encountered were related to improperly connected design elements or printer-related issues. Overall, the final results were satisfactory, although we hope for one final print to come out. <br />
<br />
===Introduction & Final Design Changes===<br />
<br />
For this project we designed and printed a phoenix modeled after Swarthmore's mascot, Phineas the Phoenix. Our main design and production medium was Solidworks, which allowed for us to easily 3D print our design and iron out any issues with each step in the design process. Originally we aimed to design a phoenix modeled after the Cesar Chavez flag as noted in our project proposal ([[Phoenix Chavez|Project Proposal for the Phoenix]]), and the goal was to create something tangible that we would enjoy designing. In addition, this project allowed us to further our understanding of Solidworks, which will prove useful in further engineering courses.<br />
<br />
Overall, the final design was very different from what we had originally planned. First of all, we decided not to use the machine shop, as we did not have the necessary expertise to build what we wanted and the time frame was slightly strained. In addition, we decided to create a more rounded design to create a more aesthetically pleasing final result. The curves created a slightly more realistic model and also required more manipulation in Solidworks. <br />
<br />
===Solidworks Design===<br />
<br />
The main Solidworks design relied on a few key elements. The main design elements used were mirroring, filleting, and extrusions. Mirroring allowed us to create multiple, symmetrical parts throughout the model. <br />
<br />
[[File:Initial1.png|200px|thumb|left|Figure 1: Top view of the first design iteration showing mirroring of the wings]][[File:Initial2.png|200px|thumb|right|Figure 2: Frontal view of initial design]]<br />
<br />
The main areas which were mirrored were the eyes, feet, wings, and beak, shown partially in Figure 1. Most edged surfaces were filleted, including the wings, beak, and feet. The textured effect in the "feathers" was achieved by filleting twice. This effect is shown in Figure 2. Almost every surface on the model was extruded somehow, with some surfaces being rotated and extruded (such as the head and torso) and some simply being extruded along a plane. Many new planes were created in order to extrude sufficiently. Another minor design element comes with the text on the torso which reads "Go Garnet!", which was achieved through first creating a text sketch, then wrapping the sketch on the torso, and finally extruding into the torso. <br />
<br />
Although the first design appeared sufficient, there were some issues, mainly with how the elements were connected. Unfortunately, rather than create an assembly with multiple parts, we created the entire model as one 3D part. This meant that each object could not be perfectly connected with each other (the end result of this will be shown in the Printing section). These problems can be seen in Figure 3 where the feet are not connected well, and in Figure 1 where the tail appears to go to a point, not adequately connected to the torso. The wings were also not adequately supported and appeared precarious.<br />
<br />
[[File:Initial3.png|300px|thumb|center|Figure 3: View of the feet]]<br />
<br />
In order to fix this issue, we created supports for the wings, tail, and connected the feet, the results of which can be seen in the Printing section.<br />
<br />
===Printing (Results)===<br />
<br />
The first design was printed in a much smaller scale, so we would be able to see how the first attempt worked out without having to wait too long for the 3D printer. The results of the first print are shown in Figure 4.<br />
<br />
[[File:Print1.png|150px|thumb|left|Figure 4: Image of the first print]] <br />
[[File:Final1.png|200px|thumb|left2|Figure 5: Frontal view of second design showing supports on wings]][[File:Final2.png|200px|thumb|right|Figure 6: Side view of initial design showing supports on feet and tail]]<br />
As you can see, the tail and feet did not adequately connect to the torso and so were were disconnected following printing. Interestingly, the wings were connected even though they appeared precarious. In order to counteract these issues, supports were added to the second design, as shown in Figures 5 and 6.<br />
<br />
The results of the second printing were much more satisfactory, although there were some issues with the printing itself rather than the design. The second print was larger than the first, although unfortunately despite the supports the tail still fell off. Results of the final print are shown in Figures 7 and 8. As you can see, most of the design went very well, with some strange results in the feet. The "spaghetti string" effect was the result of the model being printed face down, resulting in the feet themselves being printed incorrectly. Although this was an unfortunate effect, it did not mar the final result too much.<br />
<br />
[[File:Print2.png|150px|thumb|left|Figure 7: Image of the final print]][[File:Print3.png|150px|thumb|center|Figure 8: Image of the "spaghetti feet"]]<br />
<br />
<br />
<br />
<br />
----<br />
<br />
===Discussion & Conclusions===<br />
<br />
Solidworks is very well suited to design models of various types, from simple phoenix designs to complex machinery. In the case of our project, we were able to create a fun model while learning a lot about designing in Solidworks. Some of the things that worked well were the ease with which Solidworks allowed for new planes and faces to be created. This proved vital for us because we were able to test many different orientations of any sketch and see how it would look. Overall we wanted to create an aesthetically pleasing piece and Solidworks allowed us to do so. The main things that didn't work well were some of the printer issues and the fact that we did not use the assembly feature which resulted in our first design being disjointed. For subsequent projects we will make use of the assembly feature more readily, as it would have allowed for more adequate connection of our parts and would have also allowed for some measure of testing each feature. Although not necessary for this project, measuring stresses and strains could prove instrumental for designing a bridge (which is important for E6). Overall, this was a successful project and we are proud of the work we have done.</div>Aguarin1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Gear_Placement_-_Matlab_CodeGear Placement - Matlab Code2012-12-17T02:34:48Z<p>Cemery1: </p>
<hr />
<div>%% Shaft Heights <br />
<br />
% Imagine the clock lying with the face up and you're looking at the gears from the side so that the "width" of the gear is, in this model, the height.<br />
<br />
<br />
GTH=(1) % Gear Thickness. <br />
<br />
WBG=(1/4) % Width Between Gears.<br />
<br />
T=8 % Number of teeth of the smallest gear. In this model, T is represented by the horizontal width.<br />
<br />
d=GTH+WBG % A combination for ease <br />
<br />
cla<br />
<br />
axis([-15*T 15*T 0 (GTH+WBG)*10])<br />
<br />
<br />
for i=1:9<br />
<br />
var=[1,2,2,3,5,4,5,6,6,4,3.5,2,2]; % This matrix gives the ratios for the gear sizes<br />
<br />
yvals = [0 0 GTH GTH]; % Y values are constant; all gears are the same width<br />
<br />
xvals = [0 var(i)*T var(i)*T 0]; % X values vary by the ratio of the gear size<br />
<br />
xtrans=[0,T,2.5*T,4*T,6*T,-4*T,-7.5*T,-11.5*T,-8*T,-4.5*T,-6.5*T,-4.25*T,-5.75*T]<br />
<br />
ytrans=[d*(i-1),d*(i-2),d*(i-2),d*(i-2),d*(i-2),d*(i-6),d*(i-6),d*(i-6),d*(i-5),d*(i-5),d*(i-5),d*(i-5),d*(i-5),d*(i-5)]<br />
<br />
<br />
Gear = patch(xvals+xtrans(i),WBG+yvals+ytrans(i),[1 1 0]); <br />
<br />
end<br />
<br />
<br />
for j=1:7<br />
<br />
xvals2 = [0 T T 0]<br />
<br />
yvals2 = [0 0 GTH GTH];<br />
<br />
<br />
xtrans2=[1.5*T,3*T,5*T,-2.5*T,-5.5*T,-9*T,-9*T,-5.5*T,-4*T,-5.25*T,-3.75*T];<br />
<br />
ytrans2=[d*j,d*j,d*j,d*(j-3),d*(j-3),d*(j-3),d*(j-3),d*(j-3),d*(j-3),d*(j-3),d*(j-3),d*(j-3)]<br />
<br />
<br />
Backing=patch(xvals2+xtrans2(j),WBG+yvals2+ytrans2(j),[1 0 0]);<br />
<br />
end<br />
<br />
<br />
%% Shaft Locations<br />
<br />
cla;<br />
<br />
r=.25; % radius of the first (smallest) gear<br />
<br />
<br />
% First, all the x values will be generated<br />
<br />
ax=0; %Center (second hand)<br />
<br />
<br />
bx=3*r*cosd(60); %Blue Circles (minute hand); ex is centered<br />
<br />
cx=6*r*cosd(60);<br />
<br />
dx=6*r*cosd(60-acosd(7/9));<br />
<br />
ex=0;<br />
<br />
<br />
fx=-5*r*cosd(45-acosd(87/(10*sqrt(98)))); %Green circles (hour hand); ix is centered<br />
<br />
gx=-7*r;<br />
<br />
hx=0;<br />
<br />
ix=0;<br />
<br />
<br />
<br />
% Then, all the y values will be generated<br />
<br />
ay=0; %Center (second hand) <br />
<br />
<br />
by=-3*r*sind(60); %Blue circles (minute hand); ey is centered<br />
<br />
cy=-6*r*sind(60);<br />
<br />
dy=-6*r*sind(60-acosd(7/9));<br />
<br />
ey=0;<br />
<br />
<br />
fy=5*r*sind(45-acosd(-87/(-10*sqrt(98)))); %Green circles (hour hand);iy is centered<br />
<br />
gy=7*r;<br />
<br />
hy=7*r;<br />
<br />
iy=0;<br />
<br />
<br />
% Create matrices for the x and y values calculated above<br />
<br />
xvals=[ax,bx,cx,dx,ex,fx,gx,hx,ix];<br />
<br />
yvals=[ay,by,cy,dy,ey,fy,gy,hy,iy];<br />
<br />
<br />
% Plot the values on a graph<br />
<br />
plot(xvals,yvals,'ro');<br />
<br />
axis(r*15*[-1 1 -1 1]);<br />
<br />
grid on;</div>Cemery1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Robot_LaserRobot Laser2012-12-17T00:51:48Z<p>Jkarol1: </p>
<hr />
<div>== Team Super Laser Robot ==<br />
<br />
=== Participants ===<br />
<br />
[[USer:Jkarol1| Jess Karol '16]]<br />
<br />
[[USer:Slu1| Shaina Lu '16]]<br />
<br />
[[USer:Rqueved1| Raundi Quevedo '16]]<br />
<br />
=== Abstract ===<br />
For our final project, we decided to build and program a robot laser arm pointer. We built this using our knowledge of robot arms and matlab based on lab 8 (the mini robot arm project). We began by building the physical model with two servo motors, one on top of the other. The laser barrel was then attached to the second servo model. While building this model we were careful to zero the motors using matlab to ensure that the starting position of robot arm was aligned. We then moved to the matlab script. We began with much of the same script as lab 8. Even the calibration was generally kept. The one major change was the inverse kinematics. To account for the movement in three dimensions, the invKin function had to be changed according to the math that Professor Cheever shared with us.<br />
<br />
=== Introduction ===<br />
<br />
Our goal was to use the information and knowledge we had from Lab 8 to create a robotic arm that would draw a circle on a surface using a laser. The idea of a laser was interesting because it required us to use different planes in a three dimensional context, while the previous lab had "simple" x and y planes. We were motivated by the idea of applying previously learned knowledge in a creative way to create a new, more challenging type of robot arm.<br />
<br />
===Background/Theory===<br />
Our project is an adaptation of the previous robot arm that could draw on a piece of paper with a pencil. We built Matlab code that could take Cartesian coordinate points and translate them, through a series of Matlab functions, into pulse counts. Pulse Counts are the length of the signal that the servo motor uses to turn to a specific angle. The script entitled MoveLaser.m calculates and creates a matrix with the coordinates of the circle that the laser draws on the wall. The laser does not actually move in a circle; it moves in 360 small lines that create the appearance of moving in a circle. Because the laser rotates the three dimensions, a different inverse kinematics was used to calculate the angles for which the robot arms needed at in order to achieve setting the robot arm to a certain coordinate point. Below is the inversekin function used for our lab:<br />
====Inverse Kin====<br />
r = sqrt(x^2+y^2+z^2-rho^2); %defines the variable r<br />
<br />
thetaA = asin(z/r)*180/pi; %defines theta, the angle for servo 1<br />
<br />
thetaB = (asin(rho/(sqrt(x^2+y^2)))-atan2(y,x))*180/pi; %defines thetaB, the angle for servo 2<br />
<br />
=== Completed Project Design ===<br />
Our Robot Arm Design had two servo motors. On that moved in the horizontal x-axis plane and one that moved in the vertical y-axis plane. X-axis servo motor is mounted above the base and held up the mount for the y-axis servo motor. The y-axis servo motor is directly connected to the laser pointer itself. The battery powered laser pointer is embedded inside the metal holder that allows the laser to remain on. When these two servo motors move together, they are able to achieve pointing the laser on a vertical plane with a wide spectrum. <br />
<br />
In our matlab code we used 4 different functions. One function defined the coordinate points for a circle. (found in results section of lab). The next most important function translated these points, along with two constants (the distance to the vertical plan and the distance from the moment of rotation to the laser) to determine the angle at which the two segments of the robot arm should be placed. Then the GetPCs function translates these angles into pulse counts. This part of the code was the same as the previous lab (robot arm lab) and is found below. And the Goto Angles function writes the pulse counts to the servo motors. In order to calibrate our motors, we used the ServoCalibrate function to measure the degrees of change using 5 different pulse counts. This allowed our robot arm to move with accuracy. <br />
<br />
====code====<br />
mA=0.4127; bA=-52.0028; <br />
mB=0.3999; bB=-50.3903; <br />
<br />
pcA = round((thetaA-bA)/mA) - 1; <br />
pcB = round((thetaB-bB)/mB) - 1; <br />
<br />
<br />
<br />
=== Results ===<br />
The results of our project were as expected. We where able to make the Robot Laser arm to move in a circle on a horizontal plane "x" distance away from the robot. This was demonstrated in the project presentation on Tuesday, December 11th. Below is the code used in order to make the rotation take place. <br />
<br />
r = 2; % Radius of the circle is 1.<br />
y = ones(1,360); % Create a matrix of ones to be filled by the x-values of the circle.<br />
z = ones(1,360); % Create a matrix of ones to be filled by the y-values of the circle.<br />
<br />
<br />
for i = 1:1:360; % We found the x and y coordinates for every degree of the circle.<br />
y(i) = r*cosd(i);<br />
z(i) = r*sind(i);<br />
end<br />
<br />
% count = size(y, 2);<br />
% Tpart = Ttot / count;<br />
<br />
% Create a matrix of ones to be filled by values of theta, <br />
% where thetaA is the angle for the lower arm and theta B <br />
% is the angle for the upper arm.<br />
thetaA = ones(1,360); <br />
thetaB = ones(1,360);<br />
<br />
for j=1:1:10; % The graphing of the circle is repeated 10 times.<br />
<br />
for i = 1:1:360; % Iterates for all x and y values.<br />
[thetaA(i) thetaB(i)] = invKin(10,-y(i),z(i),6); <br />
[pcA(i) pcB(i)] = getPCs(thetaA(i), thetaB(i));<br />
a.servoWrite(2,pcA(i))<br />
a.servoWrite(3,pcB(i))<br />
% Finds the angles using the invKin function. 29 is the y intercept.<br />
% gotoAngles1(thetaA(i),thetaB(i)); % Using the angles found above, the gotoAngles function orders the robot arm to draw.<br />
pause(.01);<br />
end<br />
end<br />
<br />
=== Discussion/Conclusion ===<br />
<br />
We had originally decided that we would draw a five pointed star, but realized that would be difficult to code and furthermore not necessarily easy for the audience to see. We also noticed that the servo motor had difficulties reading our pulse counts, and did not know wether our angles and code were wrong or if the rounding that matlab did on values affected the pulse counts. We modified the code and realized we had made a mistake, because our servo was then able to move at the right angles. Finally, we had difficulties with the design of our arm, because the laser was too heavy and wobbled. We fixed this by switching its position and then nailing it.<br />
<br />
===Pictures of Our Arm===<br />
<br />
[[File:Capture d’écran 2012-12-16 à 20.22.05.png]]<br />
<br />
===Code===<br />
[[File:LASER_PART_II.zip]]</div>Rqueved1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=V6_Engine_ReportV6 Engine Report2012-12-17T00:13:06Z<p>Kswartz1: </p>
<hr />
<div>==Abstract==<br />
In this project I decided to design a simple model of a V6 engine that would be used in a car. I used solidworks to build the engine. I was unable to print out the model due to time constraints. Furthermore, my engine did not function in the same manner as a normal V6 engine as the 3 pistons on each side moved together and not in different cycles. However, this model still is able to reveal how a cylinder engine functions on a basic level.<br />
<br />
==Introduction==<br />
The motivation behind this project was to reveal of the pistons of an engine drive the rotations of a wheels in a car. I wanted to expand my Solid Works skills and attempt to model a more complex object from scrap. The engine is complicated as it requires different parts to move together in harmony. The engine is one of the most basic objects that led to advances in technology and as such it is important to understand how objects like this work.<br />
<br />
==Background/Theory==<br />
The V6 cylinder engine is one of the most common car engines. Shaped like a V, the V6 engine has 6 pistons that turn a crankshaft which lead to the turning of the wheels of a car. The pistons move with a small explosion of fuel. This type of engine is more compact than other models.<br />
The V6 engine functions with four strokes from each piston: the intake, compression, power and exhaust. The intake begins as the piston moves downward in the cylinder, drawing in a mixture of fuel and air from the intake valve. The compression then begins as the piston moves upward in the cylinder, compressing the fuel. The power stroke occurs as the piston reaches the top of the cylinder and the spark plug fires, igniting the fuel and pushing the piston to the bottom of the cylinder. This is what provides the power for the causes crankshaft to rotate. The final stroke is the exhaust stoke where the piston moves back to the top of the cylinder and the exhaust value opens, releasing the exhaust material. This process is occurring for all 6 cylinders at different times, so the crankshaft is constantly being smoothly turned.<br />
<br />
<br />
==Completed Project Design==<br />
The design process of this engine began with the design of the individual parts through sketches. The parts where then contstucted individually in solidworks. Using an assembly, the parts were fit together to see if they run properly. When errors occurred in the assembly, the indivual parts were changed in order to meet the nessecary specifications for the assembly to work.<br />
<br />
The design for the pistons was a circle with a diameter of 2 inches extruded 1 inch. Two rectangular 1 in. X .21 in. prisims were then extruded .25 inches above each other from the bottom of the cylinder. They were the connected with a cylinder with a diameter of .25 in. This cylinder is the means for connecting the piston to the piston connector which will then attact to the crankshaft.<br />
<br />
[[File:piston.jpg]]<br />
<br />
The piston connector was a simple recatangular shape will two circles on each end. The connector was 2 inches from the center of either circle and extruded .1 inch. Two smaller circles with diameter of .25 inches were then drilled into the center of the larger circles.<br />
<br />
[[File:Piston_connector.jpg]]<br />
<br />
The design of the engine shell first began by constructing a 10x6 inch rectangular frame extruded .1 inch with each side having a thickness of .1 inch. On the front end of the 6 in. side of the frame, a frame of a tiangle with the hegit of 4 in. with side of .1 thcikness extruded .1 inch was contsructed. This frame was then extruded to the back of the rectangle. From these new surfaces, two rectangular prisims 9x4 inches were extruded. In each of these prisims, three circles with 2 inch diameter were drilled all the way through. These would function as the cylinders of the engine. The cylinders centers were each 4 inchs away from each other, the outside cylinders being .5 in. away from the edeges of the prisim. Each of the four sides of the original frame were extruded down 5 inches. A .25 inch hole was then drilled in the center of the front sides of the engine 2 inches down.<br />
<br />
[[File:Engine_shell.jpg]]<br />
<br />
A crank used to turn the crankshaft for modeling purposes was the contructed by first extduding a circle of diameter .5 inches by 2 inches. This was then connected to a straight slot with a diameter of .5 inches, length 1.5 inches, extruded .2 inches. On the opposite side of the slot, another cylinder with a diameter of .25 inches and height 1 inch was constructed.<br />
<br />
[[File:crank.jpg]]<br />
<br />
The final part was the crankshaft which was designed differently from a normal crankshaft. In a normal V6 engine, the crankshaft would be designed so that each of the 6 pistons moved seperatly. However, because this was only a simple V6 engine model, the cranksahft was designed so all three pistons on each side would move together, giving the engine the functionality of only two cylinders in relaity. The crankshaft began with sketching a circle with a diameter of 3 inches. Two arcs were then drawn inside the circle in order to trim some of the circle away giving in a curved T shape. This sketch was then extruded .1 inches. A cricle of .5 inch diameter was drilled from in the center of this 3-d sketch. A new part was made which was simply a 9.5 inch long cylinder with a diameter of .25 inches. In an assemply, two of the curved T shapes were connected togetther by the cylinder.<br />
<br />
[[File:Crankshaft.jpg]]<br />
<br />
Once all of these parts were correctly constructed the were put together in an assembly. 6 pistons were mated with piston connectors trough one of the holes on the piston connectors to the rod on each of the pistons. These full pistons were then mated to each of the cylinders in the engine shell. The crankshaft was mated with the crank through the hole in one of the front ends of the engine. Each remaining hole on the piston connectors was then mated to the cylinder of the crankshaft. In order to make the final animation, a motor was places on the crank so that it would turn, causing the mostion of the pistons, although in reality, the pistons would be moving the crank.<br />
<br />
[[File:Engine.jpg]]<br />
<br />
[[File:EngineFinal.avi]]<br />
<br />
==Results==<br />
Overall my goals were somewhat achieved as I was able to construct a very simple model of a V6 engine in solidworks. However, I was unable to make the crankshaft correctly and as such the pistons moved three at a time instead of all at different times. This is a key part of a V6 engine. Yet, the pistons were still able to move and represent the way in which an engine works.<br />
<br />
In order to more fully achieve my goals, I could have desinged a correct cank shaft which would allow the pistons to move seperately. My engine as is would not be very functional. Furthermore, because my model is so simple, it does represent all of the different strokes of a piston engine. There are no spark plugs or intake or exhaust valves.<br />
<br />
==Discussion and Conclusion==<br />
Overall, my design process worked fairly well. I was able to design parts and have the put together in an assembly and then go back and chagne them if nessesary. The most difficult and time consuming aspect was figuring out the correct dimensions for each part so that the pistons would go up and down as the were supposed to.<br />
<br />
The biggest issue I had wa designing the crankshaft. Although I was able to find many pictures of crankshafts on the internet and a few in soldiworks models, I was still unable to figure out how to correctly build one. This was partly due to my inexperience with solidworks. In order to have built a better crankshaft I would need to spend more time on the blueprint sketchs in order to get the pieces to fit together correctly.<br />
<br />
In the end, my model is still able to eximply the basic motions of a cylinder engine, although it could have been better designed.</div>Kswartz1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Connect_Four_Final_ReportConnect Four Final Report2012-12-16T18:09:36Z<p>Klin1: /* Code */</p>
<hr />
<div>== Members of Team Connect Four ==<br />
[[User:bthomps1 | Bennet Thompson]], [[User:klin1 | Katie Lin]], [[User:mheppe1 | Madison Heppe]]<br />
<br />
== Abstract ==<br />
<br />
This project consisted of creating a MATLAB script for the game Connect Four. We created code that set up a 6 by 7 board. The rules for the game are exactly the same as any Connect Four game. Two players play against each other: black versus red. The player hovers the mouse over the board and then clicks on any column and their chip will fall to the appropriate row. This means that if there are no chips in that column, it will fall to the bottom, but if there are already chips in that column, it will fall to the row directly above it. The code detects if you try and place a chip in an already taken spot, and it does not allow you to do that. We also made code that determines when there is four in a row and someone has won the game.<br />
<br />
== Introduction ==<br />
<br />
The goal of this project was to make a computer game using MATLAB, and Connect Four seemed like the most fun. We wanted our MATLAB version of Connect Four to be as realistic to the actual board game as possible. We wanted all the same rules to apply. The motivation for this project came from the desire to give Professor Cheever a fun game to play over winter break, and from the aspiration to make a game people can really play on the computer. This project is interesting because the code involves some complicated nested for loops and if then statements. This project took a lot of problem solving, but with lots of trial and error we were successful with creating Connect Four on MATLAB.<br />
<br />
== Background ==<br />
<br />
In order to understand this project, you need to be at least somewhat acquainted with MATLAB. The code has three parts: setting up the board, playing, and checking for four in a row. The latter two parts are repeated for the second player. MATLAB statements that we use include for loops, if then else statements, ginput, round, and patch. The patch statement sets up the 6 by 7 board with yellow circles. The ginput statement allows the player to add their chip to the board, and the round function rounds the x and y positions of where they clicked to a round number, so that their chip falls directly in the column. We set up a matrix called bval, which is composed of zeros. Wherever the red player plays, the matrix value is changed to one, and wherever the black player plays the matrix value is changed to negative one. This is so that MATLAB knows where all the black and red chips are. The nested for loops along with the if then statements help guide the chip to the correct position. Once the chip is settled, the “break” statement at the end of the if statement terminated the turn. <br />
<br />
[[File:Connect.png]]<br />
<br />
[[File:Connectmatri.png]]<br />
<br />
Note: The columns in the matrix appear as rows on the board.<br />
<br />
==Completed Project Design==<br />
<br />
For our project we wanted to create a MATLAB version of the game connect four. There ended up being three main sections of our code: graphics, gameplay, and recognizing four in a row.<br />
<br />
===Graphics===<br />
<br />
For the graphics of the game, we created 42 yellow circles, each representing a space that someone can insert a chip. We chose the color yellow because the original connect four board is yellow colored.<br />
<br />
for x=1:W,<br />
for y=1:N,<br />
board(x,y)=patch(x+xc,y+yc,[1 1 0]); % Creates patch graphic of yellow<br />
% circles centered at increasing zeroes according to N & W<br />
end<br />
end<br />
<br />
To set up the board itself, we had to create a 7 by 6 matrix (the actual dimensions of the board of connect four). Our first step in creating each circle is to calculate fifty points around the circumference of a circle, centered about each point in the matrix. The radius of the circle is .4 units (since each point is spaced 1 unit apart, we wanted to leave a little space between each circle). The yellow circles were then created by using the patch command that we used in some of our previous labs. To create 42 circles, we ran a nested four loop (the outer limit representing the number of columns, the inner representing the number of rows) of the patch command. To make the board look more visually appealing, we squared the axes, got rid of any extra space on the graph and removed the tick marks.<br />
<br />
===Gameplay===<br />
<br />
The first thing we needed to code for was alternating red and black turns. To do this we set up a for loop that ran 42 times (the maximum number of turns in a game because it is the number of available spaces on a board). When it is red’s turn, we programmed MATLAB to take the coordinates of where someone clicked, rounded those coordinates to the nearest integer, and then changed the original patch function of the yellow circle to the color red. When it black’s turn, the code does the exact same thing except it changes the patch function to create a black circle instead of a red circle.<br />
<br />
set(board(i,j),'FaceColor',[1 0 0]); % set the clicked spot to red<br />
<br />
or<br />
<br />
set(board(i,j),'FaceColor',[0 0 0]); % set the clicked spot to black<br />
<br />
We also assigned the red circles a value of +1 and the black circles a value of -1. These values were stored in the matrix that we used in creating our board.<br />
<br />
When you play the real version of connect four, if you slide a chip into the top row, it falls all the way down due to gravity. We wanted our software version to do the exact same thing. To achieve this we had to set up several if… then statements to test for certain conditions. For starters, we had MATLAB test whether the space below was empty by determining if the value of that space was 0, in which case it was empty or -1/+1 in which case it was already filled. If it was already filled, we had MATLAB change the color of the circle you clicked on to the color of whichever turn it was. If it wasn’t filled, we had MATLAB change the color of the circle below, change the color of the circle you clicked on back to yellow, and then test once more whether or not the circle below that was filled. <br />
<br />
if bval(i,j-p)==0, % if spot below click iterated by p is yellow<br />
set(board(i,j-p),'FaceColor',[1 0 0]); % turn spot red<br />
bval(i,j-p+1)=0; % resets bval above to zero<br />
set(board(i,j-p+1),'FaceColor',[1 1 0]); % resets spot above to yellow<br />
bval(i,j-p)=1; % Identifies red circle in the array as a 1<br />
<br />
elseif bval(i,j-p)<0, % if the spot below is below is black<br />
set(board(i,(j-p)+1),'FaceColor',[1 0 0]); % set clicked spot to red<br />
bval(i,j-p+1)=1; % Identifies red circle in the array as a 1<br />
end<br />
<br />
We also changed the values of the matrix accordingly as the chip “fell” down each column.<br />
<br />
One last thing we had to code for was making sure that if you clicked on a space that was already taken, you couldn’t change the color of the circle. Once again we used an if… then statement to test if that space had already been assigned a non-zero value; if it had then nothing would happen and the user would have another chance to go again.<br />
<br />
<br />
for p=1:j-1 % Creates a for... loop for value p of 1 to one below place you clicked<br />
if bval(i,j)~=0, % if you click on a already colored spot, then turn is skipped<br />
disp ('You are cheating. Go again.');<br />
break, end % terminates turn<br />
<br />
===Recognizing Four in a Row===<br />
<br />
The last thing we wanted our code to do was to recognize when there is a winner. In the game of connect four, someone wins by having putting four of their pieces in a row. <br />
<br />
Our first step in getting MATLAB to recognize four in a row, was to set up four different for loops, each iterating through all the possible combinations of four in a row horizontally, vertically, diagonally left to right going upwards and diagonally right to left going upwards respectively. For each combination of four, each of the four values of the matrix that represents the board are summed. Remember that we assigned a value of 1 to each red circle and a value of -1 to each black circle. So if the sum of the four values equaled four, MATLAB declared red the winner (by changing the axis title to ‘Red Wins’) and if the sum equaled negative four MATLAB declared black the winner (by changing the axis title to ‘Black Wins’).<br />
<br />
==Results==<br />
<br />
We succeeded in achieving the goals we set out for ourselves, namely: to make playable software for Connect Four using MATLAB that provides realistic graphics and gameplay, and accurately determines the winner. In terms of graphics, with Professor Cheever’s help we coded for an image that mostly matches the shape, color, and arrangement of the actual game board. The only difference comes in that rather than have a yellow board with circular spaces, our graphics provide for yellow circles that act as spaces. For gameplay, users are able to direct a cursor in order to select a single circle to insert a chip. Like the real game, a player cannot place their chip in a space already occupied. Additionally, even though the user selects a space anywhere on the board, the chip falls from the top of that column and rests in the space selected. Finally, a large section of our code is devoted to recognizing whether four chips of the same color form a line, successfully stopping the game and informing the users of a winner. In this aspect, our MATLAB version actually surpasses real-life play by taking the responsibility of ending the game from the players, and ensures that a four-in-a-row connection is not overlooked. The only aspect we have failed to make realistic has been clearing the board, but this was nonessential.<br />
<br />
=== Sample Video ===<br />
<br />
[[File:Connect4video.mov]]<br />
<br />
==Conclusion==<br />
<br />
MATLAB is well suited to support software for simple games such as Connect Four, and the project was manageable given the tools we’ve accrued throughout the semester. Understanding patch graphics, matrices, ginput, for loops, and if/else statements was essential for creating this game. Debugging was necessary throughout the coding process, but often the problems we encountered required only logic to understand how our code had room for misinterpretation, and with trial we made it hermetic. We could further improve the game by replacing redundant code for each turn with a function, and creating a method for clearing the board and playing again without re-running the script. However, the skills we gained in graphics and loops could support further work in creating game software using MATLAB, and perhaps for making visual models of processes relating to science and engineering.<br />
<br />
== Code ==<br />
<br />
[[File:Connect4script.m]]</div>Mheppe1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Rocket_ReportRocket Report2012-12-16T02:22:11Z<p>Cdrubin1: /* Links to Matlab Code */</p>
<hr />
<div>by [[User: Cdrubin1 | Casey Drubin]]<br />
[[User: Sfriske1 | Spencer Friske]]<br />
<br />
'''Table of Contents'''<br />
<br />
==Link to Word Document Writeup==<br />
[[File:Team_Rocket_Paper1.docx]]<br />
<br />
==Links to Matlab Code==<br />
<br />
The function rock_trajectory.m takes the user's input and calls all of the other functions.<br />
<br />
[[File:rock_trajectory.m]]<br />
[[File:Coriolispeed.m]]<br />
[[File:Dragspeed.m]]<br />
[[File:FindRadius.m]]<br />
[[File:FindvelR.m]]<br />
[[File:FindvelX.m]]<br />
[[File:FindX.m]]<br />
[[File:Gravspeed.m]]<br />
[[File:Thrustspeed.m]]</div>Cdrubin1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Koch%27s_Snowflake_on_Solidworks_ReportKoch's Snowflake on Solidworks Report2012-12-15T19:11:35Z<p>Ksun1: </p>
<hr />
<div>by [[User: Ksun1 | Kathy Sun]]<br />
<br />
'''Table of Contents'''<br />
<br />
==Abstract==<br />
For my project, I used Solidworks to design a 3-dimensional version of three iterations of Koch's Snowflake. I created tetrahedrons on Solidworks by drawing triangles and points and lofting them together. I then assembled the tetrahedrons together by mating the faces and moving the tetrahedrons into the right place.<br />
<br />
==Introduction==<br />
The goal of this project was to create Koch's Snowflake on Solidworks and to become more familiar with Solidworks. Because as a class we did not spend very much time using Solidworks, I thought it would be useful to become more familiar with the program. Creating Koch's Snowflake on the program seemed like a good way to accomplish this goal, because Koch's Snowflake has interesting properties - it has a finite area but an infinite perimeter - and is aesthetically pleasing.<br />
<br />
==Background/Theory==<br />
There were several technical details involved in this project. In Koch's snowflake, the side length of each smaller triangle is one third the side length of the previous iteration. Because I was trying to create a 3-dimensional version of Koch's Snowflake, I needed to create tetrahedrons. To do this I needed to know that the height of a tetrahedron is the square root of 6 multiplied by the side length of the triangular base divided by 3. Also, Solidworks allows its user to loft together two parts. This function creates faces connecting the two parts together. For example, for a tetrahedron, lofting creates the faces of the tetrahedron.<br />
<br />
==Completed Project Design==<br />
To create the first three iterations of Koch's Snowflake, I first sketched a triangle. Solidworks allows its users to sketch equilateral polygons with different numbers of sides. For a triangle, I simply sketched a polygon of three sides. I used smart dimensions to adjust the length of the triangle to nine inches. I then sketched a point above the triangle at a height (√6*length)/3 by using smart dimensions. After, I lofted the triangle and the point together to form a tetrahedron. I did this two more times. The second tetrahedron had a triangle base with a side length of 3 inches, and the third tetrahedron had a triangle base with a side length of 1 inch. To assemble the tetrahedrons together, I opened the largest tetrahedron and three of the second tetrahedron in assembly. I mated the faces of the tetrahedrons together. I then sketched lines from the vertices to the midpoints of the opposite sides of the mated faces to find the centers of the faces. I used these lines and centers to move the tetrahedrons into the proper place, which I simply eyeballed. I repeated this process for the third tetrahedron. For the third tetrahedron, though, I had to use nine of these tetrahedrons.<br />
<br />
==Results==<br />
I was successful in accomplishing my goals. I became more familiar with Solidworks; before this project I did not know what lofting was and did not know how to create a tetrahedron on Solidworks. I was also successful in creating three iterations of Koch's Snowflake on Solidworks, although my results were not as accurate as I would have liked because I had to eyeball the tetrahedrons into the right place.<br />
<br />
[[File:Kochs snowflake solidworks.jpg | 300 px]]<br />
<br />
==Discussion/Conclusion==<br />
The creation of the tetrahedrons worked well. My measurements were all very accurate. My main obstacle was assembling the tetrahedrons together. My method of assembly was not very accurate. Also, because I was not able to figure out how to do an infinite number of iterations, my representation of Koch's Snowflake is not entirely accurate as it only includes three iterations.</div>Ksun1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=Matlab_Blackjack_ReportMatlab Blackjack Report2012-12-12T22:09:08Z<p>Mhirsh1: /* Appendices */</p>
<hr />
<div>By: [[User:Msacks1 | Maxwell Sacks]] & [[User:Mhirsh1 | Matthew Hirsh]]<br />
<br />
'''Table of Contents'''<br />
== Abstract ==<br />
Blackjack is one of the most popular card games in the world with relatively simple rules. The player must try to beat the dealer by having a higher score without going over 21 points. In this project, are goal was to recreate a blackjack simulator. First we read about the casino rules for blackjack where the player is against the dealer. Next, we planned out our project by thinking of what programs we would need to make and implement. After we had written all the programs, we did many test and added more lines of code to make sure that everything was working properly.<br />
<br />
== Introduction ==<br />
Our main goal for this final project was to create an accurate Blackjack simulator. Understanding how to efficiently and effectively use Matlab was often frustrating through the year, so we wanted to use this final project as a way to get extra practice with the program. We wanted to better understand coding techniques and thought making a game like blackjack would be a fun way to do so. Since blackjack is a betting game, we thought it would be interesting to create a simulator where we can bet chips instead.<br />
<br />
== Background/Theory ==<br />
=== Extended Rules of Blackjack ===<br />
As briefly mentioned, in order to win blackjack against a dealer, the player must have more points than the dealer without going over 21 points. The player and dealer are both felt two cards but only one of the dealer's is faced up initially. Cards are worth their number value with jacks through kings also being ten points and aces can be eleven or one points depending on which works better. First, it it the player's turn and the user can decide to hit (get another card) or stand (end their turn). If the player goes over 21 points, he/she busts and automatically loses. Otherwise, it will then be the dealer's turn who will flip over his second card and must continue to hit until he either busts or has 17 points or greater. If neither the player or dealer bust, then the winner is the person with more points and that person will win the bet. It the player gets a blackjack, which is a ten-value card along with an ace, the player automatically wins 1.5 times his bet. If the player and dealer tie a round, then the bet is split and nobody loses or gains money.<br />
=== Programming Ideas ===<br />
After fully understanding the rules of blackjack, it immediately became clear than many if statements and while loops were going to be needed. If and else if statement will only execute if specific conditions are met, otherwise the program will skip that portion of the code. This is important because, for example, we would want the round to end right away if the player goes over 21 points because there would be no use in having the dealer go though his turn if that condition is met. While loops are indefinite loops that will continue to execute until certain conditions are changed. These were also important to the coding progress because, for example, when we ask the user to input a bet, a while loop will continue to ask the user for a valid bet until the bet is greater than the minimum bet but less than the total number of chips the player has.<br />
<br />
== Completed Project Design ==<br />
From the outermost level, the blackjack simulator we created is one giant while loop. The conditions for the while loop to end are if the user does not have enough chips to make the minimum bet, has over 1,000,000 chips, or if the user types in 0 for the bet. Each run through the while loop will execute one individual round of black jack. before this main while loop, the program will call an intro function which will inform the player about the rules for playing and will identify how many chips the player starts with. The first function inside the loop is a 'getbet' function. This function contains a while loop to ensure that the player inputs an appropriate bet. Next, the main code will call a 'getcard' function which will randomly choose a number between 1 and 52 and assign a card suit and number to that number. Next is the 'getvlaue' function which will convert a card into a point value so it can be tallied up. Once the player has two cards and the dealer has his one face-up card, the code runs through another while loop that will give the player another card until they stop inputting 'h' for hit. Each run through this loop will deal one more card and add up the player's total point value to make sure the player doesn't bust. If the player goes over 21, if statements are used to check if any of the cards were an ace, so that its value could be reassigned from an 11 to a 1. Using another if statement, if the user ends his or her turn without busting, then the dealer will receive his second card and goes through a similar while loop himself. The dealer must continue to hit and add to his total point value until he bust or has more than 17. Once again, if statements are used to check if an ace can be reassigned to a 1 if the dealer busts. If neither the player or dealer bust, then some final if and elseif statements are used to check if the dealer or player had more points and reassigns the chip total appropriately. Before the end of each run through the main while loop, a 'getwinloss' function is called which determines if the player has enough chips to continue playing or not. If the player has enough, the program will start another round of blackjack by returning to the beginning of this outermost loop. If not, the game will print a game over message and the program terminates.<br />
<br />
'''''See links at bottom of page to see the actual code with clear comments.'''''<br />
<br />
== Results ==<br />
As a whole, we were happy with the result of our blackjack simulator. We reached our goal of creating a blackjack game using Matlab and we were able to allow betting. All of the while loops worked well and the game continue to play smoothly until the user runs out of chips or types a '0' to exit. All of the betting seemed to work especially well. The program can accurately decide who wins each round and the total chips that the player has gets reassigned based on the result and how much was betted. Despite our successes, we realize that the simulator is not perfect. We could not get our 'getcard' function to work exactly how we wanted to. The function returns a random card found with a number between 1 and 52 every time it's called. This means that the function could potentially return the exact same card many times in a row. In normal blackjack, of you are felt and ace, it would be slightly less likely for your next card to also be an ace, but in our simulator the probability doesn't change. Also, with the time constraints, we were unable to add functions for double down or for splitting which are additionally rules for blackjack that are allowed at many casinos. However, we did successfully implement the standard rules of blackjack.<br />
<br />
== Conclusion ==<br />
When writing the blackjack simulator we had to stay organized and properly use the different programming techniques we have learned. Are implementation of while loops and if statements worked well, but when glancing at the code, everything looks jumbled and messy since there are multiple layers of loops and if/else statements. Maybe it would be better if we managed to make the code easier to look at. Also we found out that we had to be careful with variable names and stay consistent throughout. When we were debugging the program, we wasted a lot of time trying to find simple errors such as typing in variable names incorrectly. If we were to continue with this blackjack simulator, we would fix the 'get card' function so that once a card is chosen it would be removed from the deck and couldn't be chosen again. Some extensions we could make would be adding the options for double down and splitting, or allowing the player to to play multiple hands against the dealer at a time.<br />
<br />
== Appendices ==<br />
The code for the blackjack simulator and the functions can be found in this zip file. All of the code has comments.<br />
<br />
[[File:MATLABBLACKJACK.zip]]</div>Mhirsh1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=ServoCar_ReportServoCar Report2012-12-12T18:35:52Z<p>Pmaguir1: Created page with 'For our project we decided to design a Car out of solid works and make it run using the servo motors that were used in the robot arm project with code written in MATLAB. First we…'</p>
<hr />
<div>For our project we decided to design a Car out of solid works and make it run using the servo motors that were used in the robot arm project with code written in MATLAB. First we designed the body of the car in SolidWorks. We went with a hollow shell with two cutouts in the back for the servo motors and two axle sized holes for the front wheel axle. We also added a cutout on the top of the car to give the E5 shield a place to rest during the demo. The hollowed out design saved a lot time in the printing process as we printed the car in 3x5x1 dimensions. Because of the servo motors design, they only travel about 180 degrees, obviously not enough to be able to drive a car. Therefore, we had to remove a mechanical and an electrical stop from the motors to allow for 360 degrees of motion. We did this by simply taking players and removing the mechanical stop and then cutting off the current resistor and soldering our own new one on. This new resistor allowed for the motor to move continuously in one direction without stops. We put in two resistors that made it that when we told the motor to get to a certain pulse count it would constantly move at that speed in that direction. This is how we wrote the code that made the different speeds possible for the forward and backwards motion in the demo. Depending on the orientation of the motors the closer to a pulse count of either 0 or 250 would be full speed forward and the inverse would be full speed backwards, while the closer to 125 the slower the motors go. Finally, we contracted the car and tested the design. We ran into a few problems in the construction, including the difficulty of attaching the front wheels to the axle, the misprint of the axle diameter and the struggle of attaching the motors to the car. Despite these hiccups, the project went very well and the demo was successful.</div>Pmaguir1https://wikis.swarthmore.edu/ENGR005_2012/index.php?title=ServoCarServoCar2012-12-12T18:19:07Z<p>Pmaguir1: Created page with 'Our project is to design a very simplistic car on Solidworks. We are going to print four wheels, two axles, and a body for the car. We plan on then attaching it to two servo moto…'</p>
<hr />
<div>Our project is to design a very simplistic car on Solidworks. We are going to print four wheels, two axles, and a body for the car. We plan on then attaching it to two servo motors that will receive instruction from Matlab just as we did in the Robot Arm project, to run the car to preform simple tasks such as moving forward and backward. The servo motors have angle restrictions built into them, so one of the challenges of this project will be to solder the restrictions off of the motors so that the wheel will have a full range of motion and be able to move forward and backward farther than the available range of motion that the servo motors provide as is. Because the servo motors are not meant to be used like this, when we write the Matlab code we are going to have to tell the motor to get to a point just beyond the restriction so that the motor will constantly be trying to get to that point, thus rotating the wheel forward or backward.<br />
<br />
Other challenges we are going to face is finding the right size for the car. The wheels needs to be the right size to support the motors and be able to fit an axle, however small enough to be reasonable to print. The body needs to be big enough to support the motors weight and not fall backward while still fitting in the restraint of a reasonable print size.</div>Pmaguir1