Electric Fish Electric Organ Discharge Generator
The goal of this project was to build a field-portable EOD generator.
The EOD generator will be used to electrically "simulate" fish.
We used an
STK-200 development board with an AT90s8515
flash-programmable microcontroller (mcu) on-board. Communications to the
host PC were handled by the 8515 UART. A port of the mcu was used to
drive an 8-bit digital-to-analog converter (Analog Devices AD557). Another
port was used to detect a button push. The button starts playback of the
currently stored waveform. If no wavefrom has been loaded from the PC,
then a button push causes a calibration waveform to be played.
A third port was used to run two
LEDS. One LED lights during playback, the other lights during data download
from the PC.
- The generator has to be able to download waveforms from a PC.
- Playback waveforms of up to 256 samples at 100kHz sample rate. The
sample rate is programmable.
- Low power. Current from a 12 volt battery should be a few milliamps.
- Play an EOD under PC control, or by a button push.
- Peak output voltage of 10 volts.
- Analog bandwidth of 50 KHz.
- Play repeated bursts of waveforms as programmable intervals for
programmable total duration.
There are four processes which run on the microcontroller:
- The main program loop detects a button push and sets up the
playback. The RESET entry point initializes the ports and times, then
puts a calibration waveform into memory.
- The timer one compare-match ISR (interrupt service routine)
outputs a sample at the sample rate,
then turns itself off after 256 samples. Because of the high interrupt
density, no other interrupts should occur during playback. The timer zero
interrupt is guarenteed not to tick because the waveform is shorter than
10 mSec. If the rs232 interrupt occurs, palyback is stopped.
- The timer zero overflow ISR ticks at 5 mSec. This ISR keeps track
of the time between playbacks and the total number of waves played.
When it is time to play a wave, this ISR enables timer one.
- The RXdone ISR detects incoming characters on the rs232 line. it kills
playback when it gets a 0x00 character, then enters a small state-machine
which parses the sample rate, number of waves, delay between waves, and 256
samples. The state machine expects 519 bytes. If it hangs, it can be reset
by resending a 0x00. All numbers (except the start byte)
are sent as two characters: (upper-nibble)+32 followed by (lower-nibble)+32.
this encoding scheme ensures that the characters don't get eaten by DOS.
AVR assembler code. is the program running
on the mcu.
The waveforms were recorded and stored as standard ASCII formated numbers.
To communicate with the mcu, the waveform had to be encoded as explained above.
A MATLAB program which performs the encoding is
There are two separate circuits which were built, the EOD generator and
an amplifier to boost the voltage level and current drive.
switch is shown in the normal (unpushed) position. When pushed, it reduces
the bandwidth of the amplifier to less than one Hz. This allows transient-free
switching of the source.
Amp and EOD generator.