Monday, June 8, 2009

Final Update of Final project




It is finished, My plans for WORLD DOMINATION!! But I digress, Here are a few pictures of my Robo-Fish. From top to bottom we have:

The Workstation:
This is where the Masterminding Happens. And no that is not a plate of eaten food, It is a plate of wet napkins that I used in lieu of a sponge to clean the soldering iron.

Bottom tier beta:
This is the main power and motor tier. Here lies the Power regulator to decrease voltage from input power of 9V to 3V for powering the motors. The resistor core seen in this picture functioned to burn off the excess power from the zener diode. Once the zener diode burned out,
I switched to using an adjustable power supply(not seen in photo). This tier also houses the Capacitors that keep the energy for when the robot isn't connected. It also has the motor and its controller which I controlled through simple serial commands. The aluminum posts and the three pin header to the right of the motor controller are used to communicate and transfer power between the two tiers. The electrical tape wrapped around the lower left tier is used to prevent other wires from touching it. It is the only shaft that is tied to 9v as the other ones are tied to ground. The three pin header transfers 5v from the microcontroller, Serial data and the reset pin connection.

Top tier:
Here we can see the Basic stamp 2 connector, the reset button, ir transmitter and ir reciever. The ir transmitter is the large black post on the right side. The ir receiver is located on the left side of the basic stamp and it is capable of detecing how far an object is away from the ir transmitter/reciever combination. The pair is capable of detecting 5 distances and responds in a increasingly nervous recation for each tier.

Finalization:
This is the completed project. Aluminum foil was originally used as the ground conductor but due to its soft nature it would deform and the robot would get stuck. I made the ground into a copper plate and it works very well now. The resistor fisherman in the background is seen fishing for the robot, which is wearing the aluminum foil hat. The hat is used to provide power to the robot.

A video of thhe robot can be seen at
http://www.youtube.com/watch?v=9X4pfTDldhA

This is the code I used for the robot: Pleaase forgive if it has a few redundencys
' {$STAMP BS2}
' {$PBASIC 2.5}


jitter VAR Byte
speed1 VAR Byte
speed2 VAR Byte
i VAR Byte
dist VAR Byte
irdet VAR Byte
irfreq VAR Word
freqsel VAR Nib



start:
LOW 0
PAUSE 2
HIGH 0
PAUSE 100
SEROUT 1, 84 , [$80,2,2]
PAUSE 2
LOW 0
PAUSE 2
HIGH 0
PAUSE 100
SEROUT 1, 84 , [$80,0,(4 ), 100]
SEROUT 1, 84 , [$80,0,(6 + 1), 100]
PAUSE 100
SEROUT 1, 84 , [$80,0,(4 ), 0]
SEROUT 1, 84 , [$80,0,(6 + 1), 0]

Main:
DO
dist=0

FOR freqsel = 0 TO 4
LOOKUP freqsel,[37500,38250,39500,40500,41500], irfreq

FREQOUT 14,1,irfreq
irdet = IN2
dist = dist+irdet
PAUSE 1
NEXT
DEBUG DEC dist

GOTO Control

LOOP ' repeat forever
END

Control:
RANDOM jitter
IF dist = 5 THEN
speed1 = jitter & 011111
ELSEIF dist =4 THEN
speed1 = jitter & 011111
ELSEIF dist =3 THEN
speed1 = jitter & 0111111
ELSEIF dist =2 THEN
speed1 = jitter & 0111111
ELSEIF dist =1 THEN
speed1 = jitter & 111111
speed1 = speed1 | 100000
ELSEIF dist =0 THEN
speed1 = jitter & %01111111
speed1 = speed1 | %01000000
ENDIF
RANDOM jitter
IF dist = 5 THEN
speed2 = jitter & 011111
ELSEIF dist =4 THEN
speed2 = jitter & 011111
ELSEIF dist =3 THEN
speed2 = jitter & 0111111
ELSEIF dist =2 THEN
speed2 = jitter & 0111111
ELSEIF dist =1 THEN
speed2 = jitter & 111111
speed2 = speed2 | 100000
ELSEIF dist =0 THEN
speed2 = jitter & %01111111
speed2 = speed2 | %01000000
ENDIF
SEROUT 1, 84 , [$80,0,(4 + (jitter >> 7)), speed1]
SEROUT 1, 84 , [$80,0,(6 + (jitter >> 7)), speed2]
PAUSE 100*dist
GOTO Main

No comments:

Post a Comment