The idea for a drawbridge came from dinner with a non engineering major. While initially skeptical, we soon agreed that the idea was doable and, more importantly, interesting.
We will be constructing and programming a plywood drawbridge using Matlab. It will be capable of detecting motion through use of a photoelectric sensor and lifting the two halves of the bridge as a response. It will use servos to wind up strings attached to the ends of the halves to lift them.
- 4 servos
- duct tape
- metal rods
- photoelectric sensor
Our first design decision was how to raise the bridge, i.e. where exactly we would place the servos and in what configuration. Initially we planned to raise the bridge by attaching the servos to the bridge halves. Upon further consideration we decided upon a more indirect approach and implemented a drawbridge design where the servos would wind up strings attached to the end of the bridges. We figured that this design was more interesting and it would be easier for the servos to support the weight.
Additionally, we added an additioanl component by "robotizing" the bridge. We automated the bridge by triggering it with a light sensor. When an object blocked light from the sensor, the computer would recognize the dip in dispelled electrons and send a signal to the servos to turn and raise the bridge.
We began designing for construction by specifying rough dimensions of the bridge and of the individual parts. We decided that a 2.5 ft by 1 ft bridge was a substantial but convenient size to work with. From those dimensions we based the size of the rest of our parts. We had to take into account multiple considerations: 1. The height at which we suspended the servos, because it had to be tall enough to raise the bridge half (the half could not be significantly longer than the height of the pillars) and 2. The weight the bridge half would be, because that would affect the stability of the whole system.
Construction was done in the Swarthmore machine shop by Jared and Alan. We started by selecting wood pieces close to the sizes we wanted (as shown in our schematics drawn during the design process). Machinist Grant Smith assisted us in the cutting to produce specific wood pieces.
We then screwed the servos, in their respective metal frames, into wooden pillars. We then put the aluminum rod into the servo and attached the other end of the rod into another wooden pillar. The pillars were then screwed into the bases and the bases were finalized by screwing wooden supports beneath them.
We attached the bridge to the base with two pieces of duct tape and attached the bridge to the rod with two strings tied to the bridge's far end. The string was attached with black electrical tape.
We repeated the construction twice to produce two ends of the bridge.
The photoelectric sensor was used to robotize the bridge and add another dimension to our project. The sensor was essentially a resistor in an electric circuit. Photons from light would hit the sensor and scatter electrons. When an object covered the sensor, however, this would simulate a boat approaching the bridge. The object would block light from reaching sensor so less electrons would be scattered and this would raise the resistance of the resistor in the circuit because the electrons would not be flowing as easily. Then, the voltage change this event necessitated was read and sent to the computer which then sent a signal to the Servos to spin and raise the bridge, allowing the object to pass.
Programming was done in MATLAB by Shiv and Kevin. The initial code written was untestable since the bridge was not complete, but testing revealed the lack of a "loop." This prevented MATLAB from receiving more than a single voltage value, which caused a timeout error. The final, working code is shown below.
s=instrfind; %Find any serial links (we can have only 1) delete(s); %... and delete.
%Create a new serial communications link - don't worry about details, %ask professor Cheever if you would like details. s=serial('COM1','Baudrate',115200,'Terminator','CR'); fopen(s); %... and open it
%in order to test which values correspond to a boat passing
fprintf(s,'#1P1525#5P1525T10'); for i=1:50,
fprintf(s,'VD'); %Inquire from connection "d" lw=fread(s,1) %Read light sensor value.
if (lw>127) disp('up'); fprintf(s,'#1P2500#5P500T10'); pause(2); disp('stop'); fprintf(s,'#1P1525#5P1525T10'); pause(2); disp('down'); fprintf(s,'#1P500#5P2500T10'); pause(2); disp('done'); end fprintf(s,'#1P1525#5P1525T10');
Back to Final Project