HARDWARE

Thermometer is connected to phone by using standard 4 pole audio jack as seen on Figure 1. There are two types of connectors using in phones depend on type. Fortunately sensor works on both variants and no matter how MIC and GROUND pinouts are attached.

Figure 1


Sensor used in thermometer is MAX6577 which operates from +2.7V to +5.5V supply voltage . This voltage we obtain from audio signal generated by phone. Because this signal is too small we needed to increase it by transformer 1:20. To maximizes phone voltage amplitude we use two inverted signals Figure 2 to get double amplitude. Here are articles about harvesting power from headphone output if you are interested in. [1] [2]

Figure 2


On Figure 3 you can see device schematics. We used the resistor R3 to make the transformer impedance matched to the output of the headphones. When we have enough AC voltage next step is rectify it to DC. On stabilization voltage we used 3V low drop voltage regulator U1. The MAX6577 converts the temperature into a square wave with a frequency proportional to absolute temperature.

Figure 3

The frequency range of the output signal can be selected by hard-wiring the two time-select pins (TS0, TS1) to either Vdd od GND. I choose multiplier 4 and output frequency at 24 °C from sensor can by calculated as follows.

Frequency = multiplier * T (°K) = 4 * (24 + 273.15) = 1188 Hz

TS1 TS0 MULTIPLIER
GND GND 4
GND Vdd 1
Vdd GND 1/4
Vdd Vdd 1/16

SOFTWARE

Phone application is written in Android studio. It's quite simple. After launch apk will turn on play inverted two channel 18kHz sinus signal in loop. This track was generated by free audio studio Audacity [3] and imported into project as MP3 file. It's necessary to set the output volume on maximal level otherwise we don't get enough voltage to power sensor. It's possible that some phones don't work because they have weak output signal. I tested it on Samsung S7, HTC One, LG G7, LG Nexus 4 and they were all right. Now we need to know frequency of input square signal generated by sensor. Frequency counter works as you seen on Figure 4. Using zero crossing method determine number of whole periods (Np) of measured signal and samples (Ns) within during 0.1 sec. Sampling frequency is set by device to Fs = 44100Hz. Then frequency can by calculated using a formula below.

Frequency counter = (Fs* Np) / Ns = (44100 / 120) / 441 = 1200

Input frequency = 1200 Hz

Ns = 44100 / 0.1 =441

Np = 1200 / 0.1 = 120


Once we know input signal frequency, temperature value can by calculated as follows.

Temperature = (frequency/multiplier) - 273.15 = 1188/4 - 273.15 = 24 °C


Figure 4

Settings menu in apk allow you simple calibration by specifying temperature offset. Entered value is than added or subtracted from temperature depending on sign. It's also possible to switch between units and display frequency counter value.

[1] http://bioee.ucsd.edu/papers/Efficient Power Harvesting from the Mobile Phone Audio Jack for mHealth Peripherals.pdf

[2] http://www.instructables.com/id/How-to-Harvest-Power-from-an-Audio-Jack/

[3] http://http://www.audacityteam.org/