A method comprising: lowering a sensor unit in a tank, the tank capable of receiving a material; transmitting wireless signals using the sensor unit; compensating for a change in one or more properties of a medium within the tank using wireless signals that are reflected by a reference finger (602, 624), the reference finger disposed at a known distance from an emitting surface of the sensor unit; determining a first distance between the material and the sensor unit using wireless signals that are reflected off the material; determining a second distance between the sensor unit and a main unit that lowers the sensor unit; determining a level of the material in the tank using the first and second distances; raising, by the main unit, the sensor unit as the tank is filled; and controlling a flow of the material into the tank based on the level of the material in the tank; wherein determining the first distance comprises: filtering electrical signals representing the wireless signals reflected off the material using a filter; amplifying an output of the filter using an amplifier; filtering an output of the amplifier based on a strength of the output of the amplifier using an envelope filter; buffering an output of the envelope filter using a buffer; determining a derivative of an output of the buffer; detecting zero crossings in the output of the buffer using the derivative of the output, the zero crossings detected using a zero detector, wherein consecutive zero crossings define a measuring window; generating a counter value using a counter, wherein starting and stopping of the counter is based on the zero crossings; determining a time difference between when the wireless signals are transmitted and received using the counter value; and determining the distance between the sensor unit and the material based on the time difference. lowering a sensor unit in a tank, the tank capable of receiving a material; transmitting wireless signals using the sensor unit; compensating for a change in one or more properties of a medium within the tank using wireless signals that are reflected by a reference finger (602, 624), the reference finger disposed at a known distance from an emitting surface of the sensor unit; determining a first distance between the material and the sensor unit using wireless signals that are reflected off the material; determining a second distance between the sensor unit and a main unit that lowers the sensor unit; determining a level of the material in the tank using the first and second distances; raising, by the main unit, the sensor unit as the tank is filled; and controlling a flow of the material into the tank based on the level of the material in the tank; wherein determining the first distance comprises: filtering electrical signals representing the wireless signals reflected off the material using a filter; amplifying an output of the filter using an amplifier; filtering an output of the amplifier based on a strength of the output of the amplifier using an envelope filter; buffering an output of the envelope filter using a buffer; determining a derivative of an output of the buffer; detecting zero crossings in the output of the buffer using the derivative of the output, the zero crossings detected using a zero detector, wherein consecutive zero crossings define a measuring window; generating a counter value using a counter, wherein starting and stopping of the counter is based on the zero crossings; determining a time difference between when the wireless signals are transmitted and received using the counter value; and determining the distance between the sensor unit and the material based on the time difference. filtering electrical signals representing the wireless signals reflected off the material using a filter; amplifying an output of the filter using an amplifier; filtering an output of the amplifier based on a strength of the output of the amplifier using an envelope filter; buffering an output of the envelope filter using a buffer; determining a derivative of an output of the buffer; detecting zero crossings in the output of the buffer using the derivative of the output, the zero crossings detected using a zero detector, wherein consecutive zero crossings define a measuring window; generating a counter value using a counter, wherein starting and stopping of the counter is based on the zero crossings; determining a time difference between when the wireless signals are transmitted and received using the counter value; and determining the distance between the sensor unit and the material based on the time difference.