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.