Automated Fish Refuge
James Cooper - ME
Chris Ryan - BME
The weakly electric knifefish prefers to hide in tight spaces rather than to swim in the open. The fish will attempt to stay within an enclosure if the enclosure is moved. This provides a unique opportunity to study behavior and the control of its unique ribbon fin locomotion. The goal of this project was to build a device that moves a box under computer control for Professor MacIver's lab. During operation, the box can oscillate back and forth in one degree of freedom. Unlike most fish, the ribbon fin allows the knifefish to move forward, backward, up, and down. Our device is manually adjustable (for reliability) so that the angle of oscillation and the angle of the enclosure can be set independently, each by steps of 10 degrees.
How To Adjust Setup
How To Control
Once you have the setup orientated in the desired position, all you need to do to start having your refuge movie is send the PIC the control commands from MATLAB. In this section, we will go over how to create the array that contains the control parameters, and then how to send it to the PIC. We separated this into two function calls to allow the user to have complete control over the original path selected, and then allow the sending function to check to make sure the path selected is valid.
The user has 5 different way to generate the path. We created a MATLAB function to generate a square wave, a triangle wave, and a sin wave. We also created a function that allows the user to put in a function handle, and then get out the path from that. The final option is for the user to create their own without the assistance of any of the function we wrote.
The path is an array of delay times in between steps sent to the stepper motor. The way the stepper motor work is you send a pulse to the motor every time you want it to take a step. Each step on the stepper motor is 1.8 degrees rotation. The diameter of the pulley attached to the shaft of the motor is 45.2882 mm, which means the distance per step is 0.7114 mm. The array of delay times is the amount of time in between each step in microseconds (10^-6 seconds). The sign of the delay time states which direction it is going in. Positive for forward, and negative for backward.
For the square wave generator, all you need to do is enter the forward velocity (mm/s), the backward velocity (mm/s), and how far it travels (mm). The square wave generator will first have the refuge go forward, before it goes backward.
[time_array]=square_to_delay(vel1,vel2,length) time_array is the outputted array of delay times vel1 is forward velocity (mm/s) vel2 is backward velocity (mm/s) length is length traveled (mm)
For the triangle wave generator, all you need to do is enter the peak forward velocity (mm/s), the peak backward velocity (mm/s), and how far it travels (mm). The triangle wave generator will first have the refuge go forward, before it goes backward.
[time_array]=triangle_to_delay(vmax1,vmax2,length) time_array is the outputted array of delay times vmax1 is forward peak velocity (mm/s) vmax2 is backward peak velocity (mm/s) length is length traveled (mm)
The circuit design and building is minimal for this project. The only necessary circuitry is to connect the unipolar stepper motor with the pic, and connect the RS232 cable to the pic. Please see the pages for the Unipolar Stepper Motor Driver Circuit and the PIC RS232 cable for more information on how they work and how to set them up.
Pin D0 is connected to Clock Pin D1 is connected to DIR
RS232 Cable Connections
Orange Wire to RC6 Ground to Ground
[[Media:fish stuff ]]== Mechanical Design ==