<!--  
 * by Gautier Creutzer and Frédéric Bouquet, La Physique Autrement, Laboratoire de Physique des Solides, Université Paris-Saclay
 * Check our other projects in English and French: www.physicsreimagined.com
 
 * Changes in v1.1 & v1.2 by Sebastian J. Spicker and Frédéric Bouquet: added German translation, adapted units/views/axis labeling etc. to original phyphox experiments for consistency and standardization, other small changes. 
 
 * informations on how to use this file (French and English) : www.physicsreimagined.com (look for "nano")
 * informations on how to use this file (German) : https://astro-lab.app/arduino-und-phyphox/
 
 * This work is based on the phyphox Arduino library developed by the phyphox team at the RWTH Aachen University, which is released under the GNU Lesser General Public Licence v3.0 (or newer).
 * This work is released under the GNU Lesser General Public Licence v3.0 (or newer).
 -->
<phyphox version="1.7" locale="en">
    <title>Speed of Sound</title>
    <category>Arduino Nano 33 BLE Sense</category>
    <description>An experiment to determine the speed of sound as measured by the Arduino Nano Sense 33 BLE onboard sensors and an external ultrasonic sensor.</description>
    <icon format="base64">iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAmySURBVHic7d1drBxlHcfx359SKGChhJeKMUJMbzBCwRuCvGjBGESKKCRyuABNCFFjYkJsAbnBSJA2imgwRiMJkKiAKS++EPRCkCLGoAFaRA0lGBqtBctbgZaW8vNilni6Z85zZndm9pk9+/0k56Izs8/z3838tvPM7DwjAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJiHouqGtg+RtKzFWoBR2RQRr1TZcN8BGj1d0i+GqwfolHMl/bLKhvu0XAgw1ggIkEBAgAQCAiQMMkgvs1vS0iYKAVqyVdLCYV9cNyCKiJfqtgG0xXat19cOCOqzfZCkg/oWvx4Rr+eoB//HGKQbVqk4FJj+typrRZBEQIAkAgIkEBAggYAACQQESCAgGdkO28slHVey+jjby21XviUBGdle6Zl25a5r3PRCcabt79veX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ra6PtBU3WjPFje0FvX5ju4hrt7SrZb1dWfX3O/0Eu6vv3ByUdn6MQdMrxKvaF6fr3lZHJGZCDKi7DZOnUfsEgfQC295d0cu46angmIjbnLmKcEJDBLJX0QO4ialgl6Vu5ixgnXCgEEggIkEBAgATGIIPZqfGeKYQB+oAIyAAi4nlJH81dB0aHQywggYAACQQESCAgQAKD9ApsL5R0bO46KngqIt7KXcR8QkCqOUrSE7mLqOA9krbkLmI+4RALSCAgQAIBARIYg1SzS9LG3EVUsDt3AfNN1wJyn+1RnYXZLel+SV/uPQhnVhHxH03g7cC9OYhvknSWpIUj6rZT+2SnipG0eMT9XSzpDUlfHHG/42Ktis9oYjEGkU7PXUCHTfxnQ0Ckx3MX0GET/9lMekAekHR57iI67HKN9z34teUcg5yduf+dEbEjY/+dFxFbJZ1h+wBJizKWku3nM9l20LnOHHWB7fdKejp3HS26MiK+O9dGvS+Sifwy6dpZrK7ZR3m/Ods2qlO3Y2vSxyBAEgEBEggIkMAYJG2zpANzF9Eifrs1BwKSEBHWhJ69QYFDLCCBgAAJBARIICBAQu1Buu1DmygE6KK6AVko6cUmCgG6iEMsIIGAAAkEBEggIEBCVN3Q9iGSlrVYCzAqmyLildxFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjmf0bHMpJ8IpSMAAAAAElFTkSuQmCC</icon> 
	<color>009297</color> 
    <data-containers>
	    <container size="0" static="false" init="">CH1</container>
	    <container size="0" static="false" init="">CH2</container>
	    <container size="0" static="false" init="">CH3</container>
	    <container size="0" static="false" init="">CH4</container>
	    <container size="0" static="false" init="">CH5</container>
	    <container size="0" static="false" init="">CH0</container>
		<container size="0" static="false" init="">speed_of_sound</container>
		<container size="0" static="false" init="">speed_of_sound_theo</container>
		<container size="0" static="false" init="">distance</container>
		<container size="0">binStart</container>
		<container size="0">binCount</container>
		<container size="1">average</container>
		<container size="1">deviation</container>
		<container size="1">count</container>
        <container size="1">binSize</container>
        <container size="0">temp1</container>
		<container size="0">temp2</container>
        <container size="1">minX</container>
        <container size="1">maxX</container>
        <container size="500">gaussianX</container>
        <container size="500">gaussian</container>
    </data-containers>
    <input>
        <bluetooth mode="notification" subscribeOnStart="false" id="Sense">
            <output char="cddf1002-30f7-4671-8b43-5e40ba53514a" conversion="float32LittleEndian" offset="0">CH1</output>
            <output char="cddf1002-30f7-4671-8b43-5e40ba53514a" conversion="float32LittleEndian" offset="4">CH2</output>
            <output char="cddf1002-30f7-4671-8b43-5e40ba53514a" conversion="float32LittleEndian" offset="8">CH3</output>
            <output char="cddf1002-30f7-4671-8b43-5e40ba53514a" conversion="float32LittleEndian" offset="12">CH4</output>
            <output char="cddf1002-30f7-4671-8b43-5e40ba53514a" conversion="float32LittleEndian" offset="16">CH5</output>
            <output char="cddf1002-30f7-4671-8b43-5e40ba53514a" extra="time">CH0</output>
        </bluetooth>
    </input>
    <views>
		<view label="Main">
			<value label="Speed of sound (exp)" size="2" precision="2" unit="m/s" color="orange">
                <input>speed_of_sound</input>
            </value>
			<value label="Ping duration" size="2" precision="2" unit="μs" color="orange">
                <input>CH2</input>
            </value>
			<separator height="2"/>
			<edit label="Enter the distance between hypersonic sensor and reflective surface" size="1" decimal="true" unit="cm" default="50" min="1" >
			<output>distance</output>
			</edit>
			<separator height="2"/>
			<value label="Speed of sound (theo)" size="2" precision="2" unit="m/s" color="orange">
                <input>speed_of_sound_theo</input>
            </value>
			<value label="Temperature" size="2" precision="2" unit="°C" color="orange">
                <input>CH3</input>
            </value>
			<value label="Humidity" size="2" precision="2" unit="%" color="orange">
                <input>CH4</input>
            </value>
			<separator height="2"/>
			<info label="Formulae:"/>
			<separator height="1"/>
			<info label="Speed of sound (exp): c_exp = 2*d/t"/>
			<info label="Speed of sound (theo): c_theo = 331.4 + 0.6*T + 0.0124*rH"/>
			<separator height="1"/>
			<info label="d = distance"/>
			<info label="t = ping duration"/>
			<info label="T = Temperature"/>
			<info label="rH = Humidity"/>
        </view>
		<view label="Histogram">
			<graph label="Histogram" labelX="Speed of sound (exp)" labelY="Count" partialUpdate="false">
                <input axis="x">gaussianX</input>
                <input axis="y" style="lines" lineWidth="2">gaussian</input>
                <input axis="x">binStart</input>
                <input axis="y" style="vbars" color="E0E040" lineWidth="0.9">binCount</input>
            </graph>
            <edit label="Bin size" unit="m/s" default="0.1" signed="false">
                <output>binSize</output>
            </edit>
            <value label="Average Speed of Sound" precision="2" scientific="false" unit="m/s" factor="1">
                <input>average</input>
            </value>
            <value label="Standard deviation" precision="0" scientific="false" unit="m/s" factor="1">
                <input>deviation</input>
            </value>
            <value label="Count" precision="0" scientific="false" unit="" factor="1">
                <input>count</input>
            </value>
		</view>
        <view label="Graphs">
			<graph label="Speed of sound: experiment vs theory" aspectRatio="2.5" style="lines" lineWidth="1" color="orange" partialUpdate="false" history="1" labelX="t" labelY="c" labelZ="" unitX="s" unitY="m/s" unitZ="" logX="false" logY="false" logZ="false" xPrecision="3" yPrecision="5" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0">
                <input axis="x">CH1</input>
                <input axis="y">speed_of_sound</input>
				<input axis="x" color="white" lineWidth="2">CH1</input>
                <input axis="y">speed_of_sound_theo</input>
            </graph>
			<value label="Speed of sound (exp)" size="2" precision="2" unit="m/s" color="orange">
                <input>speed_of_sound</input>
            </value>
			<value label="Speed of sound (theo)" size="2" precision="2" unit="m/s" color="white">
                <input>speed_of_sound_theo</input>
            </value>
			<separator height="2"/>
			<graph label="Temperature" aspectRatio="2.5" style="lines" lineWidth="1" color="orange" partialUpdate="false" history="1" labelX="t" labelY="T" labelZ="" unitX="s" unitY="°C" unitZ="" logX="false" logY="false" logZ="false" xPrecision="3" yPrecision="4" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0">
                <input axis="x">CH1</input>
                <input axis="y">CH3</input>
            </graph>
			<graph label="Humidity" aspectRatio="2.5" style="lines" lineWidth="1" color="orange" partialUpdate="false" history="1" labelX="t" labelY="rH" labelZ="" unitX="s" unitY="%" unitZ="" logX="false" logY="false" logZ="false" xPrecision="3" yPrecision="4" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0">
                <input axis="x">CH1</input>
                <input axis="y">CH4</input>
            </graph>
		</view>
		<view label="Scatterplots">
		<graph label="Speed of sound: experiment vs theory" aspectRatio="2.5" style="dots" lineWidth="1" color="orange" partialUpdate="false" history="1" labelX="c_theo" labelY="c_exp" labelZ="" unitX="m/s" unitY="m/s" unitZ="" logX="false" logY="false" logZ="false" xPrecision="5" yPrecision="5" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0">
                <input axis="x">speed_of_sound_theo</input>
                <input axis="y">speed_of_sound</input>
            </graph>
			<separator height="2"/>
			<graph label="Speed of sound vs Temperature" aspectRatio="2.5" style="dots" lineWidth="1" color="orange" partialUpdate="false" history="1" labelX="T" labelY="c" labelZ="" unitX="°C" unitY="m/s" unitZ="" logX="false" logY="false" logZ="false" xPrecision="4" yPrecision="5" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0">
                <input axis="x">CH3</input>
                <input axis="y">speed_of_sound</input>
            </graph>
			<separator height="2"/>
			<graph label="Speed of sound vs Humidity" aspectRatio="2.5" style="dots" lineWidth="1" color="orange" partialUpdate="false" history="1" labelX="rH" labelY="c" labelZ="" unitX="%" unitY="m/s" unitZ="" logX="false" logY="false" logZ="false" xPrecision="4" yPrecision="5" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0">
                <input axis="x">CH4</input>
                <input axis="y">speed_of_sound</input>
            </graph>
        </view>
    </views>
    <analysis sleep="0" onUserInput="false">
		<formula formula="2*[2]/[1_]*10000">
			<input clear="false">CH2</input>
			<input clear="false">distance</input>
            <output>speed_of_sound</output>
        </formula>
		<formula formula="331.4+0.6*[1_]+0.0124*[2_]">
			<input clear="false">CH3</input>
            <input clear="false">CH4</input>
            <output>speed_of_sound_theo</output>
        </formula>
		<binning>
            <input clear="false">speed_of_sound</input>
            <input as="dx" clear="false">binSize</input>
            <output clear="true">binStart</output>
			<output clear="true">binCount</output>
        </binning>
        <average>
            <input clear="false">speed_of_sound</input>
            <output as="average">average</output>
            <output as="stddev">deviation</output>
        </average>
        <count>
            <input clear="false">speed_of_sound</input>
            <output as="count">count</output>
        </count>
        <subrange>
            <input clear="false">binStart</input>
            <input as="from" type="value">0</input>
            <input as="length" type="value">1</input>
            <output>minX</output>
        </subrange>
        <append>
            <input clear="false">binStart</input>
            <output>temp1</output>
        </append>
        <add>
            <input>temp1</input>
            <input clear="false">binSize</input>
            <output>maxX</output>
        </add>
        <ramp>
            <input as="start" clear="false">minX</input>
            <input as="stop" clear="false">maxX</input>
            <output>gaussianX</output>
        </ramp>
        <subtract>
            <input clear="false">gaussianX</input>
            <input clear="false">average</input>
            <output>temp1</output>
        </subtract>
        <multiply>
            <input clear="false">temp1</input>
            <input>temp1</input>
            <output>temp2</output>
        </multiply>
        <divide>
            <input>temp2</input>
            <input type="value">-2</input>
            <input clear="false">deviation</input>
            <input clear="false">deviation</input>
            <output>temp1</output>
        </divide>
        <power>
            <input as="base" type="value">2.7182818284</input>
            <input as="exponent">temp1</input>
            <output>temp2</output>
        </power>
        <divide>
            <input>temp2</input>
            <input type="value">2.506628275</input>
            <input clear="false">deviation</input>
			<output>temp1</output>
        </divide>
        <multiply>
            <input>temp1</input>
            <input clear="false">binSize</input>
            <input clear="false">count</input>
            <output>gaussian</output>
        </multiply>
    </analysis>
    <export>
        <set name="Raw data">
			<data name="Time t (s)">CH0</data>
            <data name="Time t (s)">CH1</data>
            <data name="Ping duration (μs)">CH2</data>
			<data name="Temperature (°C)">CH3</data>
			<data name="Humidity (%)">CH4</data>
        </set>
    </export>
</phyphox>