Velocity Sensor v2
This is documentation for the version 2 of the in water velocity sensor
The main changes made are:
1. SAMD21G18 microcontroller used instead of the ATMega328P (both Arduino based).
2. Removed external 12bit ADC as SAMD21 has internal one.
3. Added 5v source from DC-DC boost converter used for the mixer and transducer signal.
4. Added Instrumentation Amplifier to amplify mixer output from 2mV-pp to ADC range of 0v to 1v (gain = ???).
5. Added Opamps for DC-biasing and generating more powerful transducer signal.
The motivation for these changes are discussed in more detail
SAMD21G18 microcontroller
The SAMD21G18 microcontroller is a much more modern processor than the ATMega series. It runs on 3.3v at low power, has 48MHz processor, 256kB of flash memory, 32kB of SRAM memory, and an inbuilt real-time clock. All this and more for only $3 a piece! A crucial factor is its support with the Arduino development environment and community. There is a family of boards, based around the Arduino Zero which uses this chip. This means it has support in the Arduino IDE and with their libraries, very important for using our existing code and other sensors. However, while the Arduino Zero (SAMD21G18) board is Arduino based, its code is not entirely compatible with Arduino Uno (ATMega328p). Most big libraries such as OneWire, FFT, etc, have SAMD21 implementations. The extent of code modification to port Uno code to the SAMD21 is not clear yet.
Another benefit of the SAMD21 is a fast internal 12-bit ADC. The ADC is supposedly accurate at sample times of <20uS which is fast enough for the velocity sensor application, however this has not been tested in practice yet. This removes the need / expense of using an external 12-bit ADC.
Instrumentation Amplifier
This change comes from an issue with the v1 velocity sensor where the input analog signal to the ADC was very weak (2mV pp) and therefore had only a few bits of resolution and was susceptible to noise. Instead of directly measuring the signal, we first amplify it ???x and then measure the result using the full ADC range.
Instrumentation amplifiers are designed specifically for this application and their output can be biased so that the mean voltage is 0.5V. This was designed so the output signal varies from 0v to 1v to avoid using negative voltages and also to match the full range of the ADC in the SAMD21. The aim of this circuit is to give a much higher resolution signal so the final FFT data is of better quality.
Op Amps and 5v
A 5v boost converter was added to the board. This converts from 3.3V to 5V which is used to power the mixer and the transducers. As we found with the v1 velocity sensor, the transducers give better data if they are driven at 5V instead of 3.3V. An op amp circuit with DC bias is used to amplify the clock signal to a 0v to 5v signal, which is used to drive the transducers.
The frequency mixer is also not rated to run on 3.3v, which is an issue that is fixed with the v1 sensor.
FFT (Fourier Transform) A major motivation for switching to the SAMD21 is its 16x increase in available SRAM. This allows for much larger FFT's to be performed, using more sample points so there is a higher resolution in the time domain analysis and we avoid having to mess with different sampling rates as with the v1 board.
The SAMD21 can perform an FFT on up to 2048 sample points which has been tested and executes quickly in <1s. With a sample period of 200uS/sample, this will give a time domain signal up to 5000Hz with a resolution of 2Hz??.