The Electric Fish Piano

A DIY set-up to listen to, record, and manipulate the electrical tones produced by weakly electric fish!

Similar projects worth following
A specialized electric organ in the weakly electric fish discharges rhythmically to generate a constant electric field. This electric field encapsulates the fish, aiding it in navigation and communication. This organ fires at a steady rate, generally between the range of 250 to 2000 Hz. However, if two fish firing at a similar frequency meet, they will effectively jam each other's signals. To resolve this problem, either fish will shift its discharge frequency -- known as the Jamming Avoidance Response (JAR).

I will develop a DIY set-up to replicate the experiment that discovered the JAR (Watanabe and Takeda 1963) in order to listen to, record, and manipulate the electrical tones of these fish. By taking advantage of the JAR through artificial stimuli, I will have the power to tune the frequencies of each fish. My end product will include a responsive interface to play back these tones -- effectively creating the world's first Electric Fish Piano.


Weakly electric fish have a specialized electric organ, typically located in the tail, that generate electric discharges. These weak bioelectric signals are known as Electric Organ Discharges (EODs), typically at a magnitude of just a few millivolts. These EODs are used to help navigate and communicate with other electric fish. Meanwhile, what separates weakly electric fish from strongly electric fish is the EOD strength -- the EODs of electric eels and rays can reach hundreds of volts which they use to stun prey and protect themselves.

Eigenmmania virescens – glass knifefish
Photo: Nadia Milani

The EOD frequencies of weakly electric fish vary between species and individual fishes -- the majority of which range from 250 Hz to 2000 Hz. When in close contact with another fish emitting a similar frequency, both fish are effectively blinded. Depending on the species, either one or both fish will adjust their EOD frequencies to increase the difference between signals. This behavior, discovered by Watanabe and Takeda in 1963, is known as the Jamming Avoidance Response (JAR).

Electric Organ Discharge?

For example, if two fish emit signal frequencies of 400 Hz and 402 Hz, the beat frequency (2 Hz) will cause interference between the fish. In this case, the fish with the lower frequency might push its frequency down to 392 Hz while the other pushes its frequency up to 410 Hz, resulting in a more ideal beat frequency of 18 Hz.

To demonstrate beat frequency, listen to the following links one at a time. Then play both at the same time. The oscillations in volume represent the beat frequency, which can be calculated by taking the absolute value of the difference between the two frequencies -- in this case, the beat frequency is 15 Hz. If you try listening to other paired frequencies, you will be able to tell that the beat frequency equals the number of oscillations you hear.

For my project, I plan to replicate and expand upon Akira Watanabe and Kimihisa Takeda's 1963 paper, " The Change of Discharge Frequency by A.C. Stimulus in a Weakly Electric Fish" in a DIY fashion.

Original Set-up

Watanabe and Takeda's experiment used a set-up that greatly immobilized the fish. In the diagram below, the fish is sandwiched between blocks of wax (B) and the openings are sealed at either end with cotton (C). Silver stimulating electrode plates (S) and silver wire recording electrodes (R) were used.

A square-pulse generator was used for stimulation while an oscilloscope was used to visualize the changes in frequency.

New Set-up

With my set-up, I hope to reduce the amount of invasive preparation that goes into monitoring the fish. For example, I will take advantage of an innate behavior of these fish, known as refuge tracking. Weakly electric fish enjoy hiding in small enclosures and it can be difficult to get them out. Even if you were to move their surroundings, they can use their electric sense to follow immediately. For this reason, I will provide PVC pipes as hiding places which will double as recording sites.

I want to replace the expensive equipment that the original researchers had to use. For example, I would like to use an Arduino Zero and Backyard Brains Muscle SpikerShield in place of the signal generator and oscilloscope. If I am successful, the end result should be a challenging and interesting DIY project that anyone can replicate. Neuroscience research is too often stunted by expensive machinery and materials but I want to demonstrate that this does not have to be the case.

My Goals

I intend to replicate Watanabe and Takeda's experiment using affordable materials and readily accessible equipment such as Arduino and open-source software. I hope to better characterize the Jamming Avoidance Response across various species and to apply this knowledge in a fun and interesting manner -- by creating the world's first Electric Fish Piano.

MPEG-4 Video - 11.96 MB - 07/11/2016 at 13:48


6_24_16-803 Hz.m4a

The Black Ghost Knife fish emitting a 803 Hz tone.

x-m4a - 247.52 kB - 06/27/2016 at 19:31



The Black Ghost Knife fish emitting a 860 Hz tone.

x-m4a - 247.07 kB - 06/27/2016 at 19:31


View all 3 files

  • 1 × Arduino Zero
  • 1 × Muscle SpikerShield Backyard Brains
  • 1 × 40 gallon fish tank
  • 1 × 10 gallon fish tank
  • 4 × Black Ghost Knife Fish
  • 2 × Air pump
  • 2 × Water filter
  • 2 × Underwater heater
  • 4 × Carbon electrode rods
  • 2 × Feet PVC pipe 1.5 inches inner diameter

  • Analog-to-Digital Converter (ADC)

    Davis Catolico07/08/2016 at 20:09 0 comments

    The next goal was to record the fish frequency using the Arduino Zero. In my previous setup, I used the function generator and the SpikeRecorder app. In my data collection project log, I explain that you can approximate the fish's frequency by referencing the beat frequency.

    The new method I want to implement is analog to digital conversion (ADC), using the Arduino Zero and the Muscle SpikerShield. The code I used for the ADC can be found here. Essentially, the code repeatedly takes thousands of samples of the voltage of the fish every second and determines the frequency based off the number of times the voltage switches from negative to positive, relative to an averaged value. This number roughly corresponds to the fish's frequency. Since we won't perfectly capture a sinusoidal signal in each sampling session, I include a way to include the endpoints of the signal to calculate a more precise frequency.

  • Digital-to-Analog Converter (DAC)

    Davis Catolico07/03/2016 at 16:12 0 comments

    As I previously mentioned, I would be transitioning from the function generator to an Arduino Zero. The Arduino Zero has a digital to analog converter (DAC) which makes this possible. An Instructables article by ForceTronics explains more about what this means and how we can use the DAC to make a pseudo waveform generator. I modified the example code because I don't expect to work much with signals over 1000 Hz. My changes include changing the sample count to a set number (100), and allowing the user to simply type in the desired frequency (range from 100 - 1000).

    With an oscilloscope, you can confirm that the frequency you input is actually being transmitted. The next step is to mimic the fish signal's voltage. The Arduino Zero emits a 3.3 V signal and the weakly electric fish typically emit signals closer to 10 mV. To attenuate the Arduino Zero's signal to this level, you can use a simple voltage divider.

  • Preliminary Experiments

    Davis Catolico06/27/2016 at 03:17 0 comments

    In attempts to characterize the Jamming Avoidance Response, I ran various tests on the fish.


    I wanted to make sure that in the absence of other fish or artificial stimuli that the fish in testing would stay at a constant frequency. To do this, I simply recorded the frequency of the fish over a period of 30 minutes. After the recording, I checked the frequency at regular intervals and confirmed that the fish maintains a steady frequency over time.

    Frequency chasing:

    As per the Watanabe and Takeda paper, the Eigenmannia species can be "chased" to the outer limits of their frequency ranges. This is done by slowly following the direction of the fish's frequency changes with the stimulus frequency. This ensures that the stimulus frequency is always close enough to elicit the JAR behavior.

    I attempted a similar experiment with the Apteronotus Albifrons (Black Ghost Knife Fish). So far, I've only been able to chase the frequency downwards.

    Long Term Frequency Elevation:

    Other research on the weakly electric fish indicates that a stimulus frequency that persists can cause the effects of the JAR to persist as well. I simply left the function generator on at a set frequency for 2 hours and observed the results. I was able to modulate the frequency of the Black Ghost Knife Fish by over 40 Hz.

  • Collecting Data

    Davis Catolico06/27/2016 at 03:07 0 comments

    I adopted a similar "beat method" used by Watanabe and Takeda to observe the effects of stimuli on the frequencies of the fish. This method takes advantage of wave interference. When two waves of slightly different frequencies interact, they will produce an alternating constructive and destructive interference pattern -- with sound waves, this is interpreted as alternating loud and soft sounds. Each of these fluctuations is known as a beat and the number of beats that occur in a second is known as the beat frequency.

    Beat frequencies can be easily calculated -- it is simply the absolute value of the difference between the two waves. For example, if I stimulate the water with 850 Hz and the fish's resting electric organ discharge frequency is 860 Hz, the beat frequency would be 10 Hz.

    Now, to visualize the beat frequency as well, I used the Backyard Brains Spike Recorder application found on their website. To start, I used the recording electrodes as input into the SpikerBox. After turning it on, I could estimate the fish's resting frequency.

    Next, I turned on the function generator, setting it 5 Hz below the fish's resting frequency -- this resulted in a beat frequency of 5 Hz. The recording electrodes now pick up the wave interference caused by the stimulation frequency. On the Spike Recorder display, the beat frequency shows up as rhythmic bumps. This relates back to the idea of alternating constructive and destructive interference with the peaks being "loud sounds" and the troughs as "soft sounds".

    Using the Spike Recorder, I can now record and watch the effects of certain stimuli on the fish's electric discharge frequency over time.

  • The Set-up

    Davis Catolico06/23/2016 at 05:06 0 comments

    The first phase of my project was to establish my workstation.

    To start, I prepared two freshwater fish tanks -- a 40-gallon tank for the fish to live in and a 10-gallon tank for experimentation. These tanks included fixed heaters, water filters, and air pumps. These fish are comfortable between 73 and 80 degrees Fahrenheit and pH levels of 6.0 to 7.5. Consequently, conditions were held constantly at a temperature of 75 degrees Fahrenheit and a pH of 7.0. I fed the fish daily with frozen blood worms.

    The fish tanks with PVC pipes, heaters, water filters, and air pumps.

    Knife fish especially enjoy hiding in small enclosures so I purchased PVC pipes, 1.5 inches in diameter. These PVC pipes doubled as a recording chambers because the fish will voluntarily stay inside for hours on end. For my recording equipment, I placed carbon electrode rods on either side of the PVC pipe. I then used alligator clips to connect them to my Backyard Brains SpikerBox. Using the Spike Recorder application found on the Backyard Brains website, I could visualize the frequencies of the electric fish. I used a RadioShack speaker-amplifier to listen to the tones as well.

    A Black Ghost Knife Fish relaxing in the recording chamber.

    In order to stimulate the electric fish, I drilled a hole through both sides of the PVC pipe. I placed two more carbon electrode rods by these holes and clipped them to a function generator. For proof of concept, I wanted to start with a professional function generator to ensure clean data collection. I plan to use an alternative stimulation source in the future -- perhaps using the Arduino Zero's DAC.

    I taped all the wires to a medium-sized wooden block for stability.

    The final set-up for the recording chamber

View all 5 project logs

  • 1

    Set up your fish tank:

    Prepare fish tanks:
    40+ gallon - Normal home
    10 gallon - Experimentation
    Air pumps
    Water filters
    Submersible heaters
    PVC pipe (fish like to hide in these)

    Treat the water:
    Dechlorinator (I recommend Tetra's AquaSafe plus)
    pH between 6.0 - 8.0
    Temperature between 75 - 80 degrees Fahrenheit

    Make sure to complete these steps before you buy your fish. Once the water conditions are right, you may introduce your fish to their new home.

    Choosing the right fish:
    For this experiment, I used the Black Ghost Knife Fish (Apteronotus Albifrons) and the Glass Knife Fish (Eigenmannia virescens).
    You may also try the Brown Ghost Knife Fish (Apteronotus leptorhynchus).

  • 2

    Gather materials:

    Muscle SpikerShield and accompanying cables
    Arduino Zero
    Carbon electrode rods (4)
    Jumper cables
    RadioShack Mini-amplifier speaker
    LCD screen (3.3 V)

    Function Generator

  • 3

    Record the fish's resting frequency:

    First, we should record the frequency of the fish at rest. To do this, upload the ADC (Analog-to-Digital Converter) code to the Arduino. Stack the Arduino and the Muscle SpikerShield and plug in the respective cables. The orange cable plugs into the orange port on the Muscle SpikerShield and the micro USB plugs into the programming port on the Arduino.

    Place the fish in the PVC pipe -- an easy way to do this is to hold the pipe near the fish until it swims in. Position the pipe relatively close to the surface of the water.

    Attach electrode rods to the red alligator clips and place the grounding clip in the water. Place the electrodes on at the ends of the PVC pipe, near the head and tail.

    Finally, open the serial monitor to the baud rate of 115200 -- the second number that appears is the fish's frequency!

View all 6 instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates