# Ultrasonic Transducer

Page in progress... Description and results coming soon!

Page in progress... Description and more pictures coming soon!

- The barrel jack polarity should be reversed to follow the the centre-positive convention (not centre negative).
- The ultrasonic sensor could be placed underneath the board to save space.
- If I choose to create a case, a wider perimeter should be left around the PCB.

Taking distance measurements with an ultrasonic sensor requires one to multiply the ultrasonic wave's return time with the speed of sound in air (d=v*t). I created a Speed of Sound library written in C++ to provide a method for approximating the speed of sound in air based on a variety of environmental factors. It is intended to be used by low-power microprocessors where computing the speed of sound in air at a high frequency is too computationally expensive.

- Computes the speed of sound in air based on temperature, humidity, pressure, and carbon dioxide mole fraction.
- Speed of sound algorithm runtime reduced by 67.7% through the use of calculus linear approximations.
- Approximation maintains precision of at least 0.05% with environmental factors varying up to 20%.

This library builds on the work I did in a previous post in hopes that the method will become more accessible to other developers. The algorithm is based on Owen Cramer's research:

J. Acoust. Soc. Am. 93, 2510 (1993); http://dx.doi.org/10.1121/1.405827

Test are written using Google's C++ GoogleTest framework. To ensure the methods are correct (especially the partial derivatives) each equation was determined using two different methods. The equation was first computed by hand and computed a second time using Mathematica. To verify that the equations arrive at the same value, constants were plugged in to each version of the function. If both evaluated to the same number, it is reasonable to assume that the functions are correct. Otherwise, a mistake was made computing one (or possibly both) of the equations. It's important to note that the methods were determined (and corrected) independently without cross-contamination. In other words, Mathematica's result was not directly compared to the result determined by hand and vice-versa. This ensures that mistakes in one equation do not carry over to the other. Tests were also written to verify the functionality of the Speed of Sound class and assert the accuracy claims made above.

Eleven microSD cards and adapters arrived in the mail and now it's time to test them! Each card's true capacity, read speed and write speed was verified using the H2testw storage test. Results are summarized below where the red line drawn on each box plot indicates the threshold. A potential speed bias caused by slow adapters was eliminated using the Surface Pro 3's built-in microSD port and adapters were tested separately by copying a 2.3 MB file of random text from a computer to a functional card using the adapter.