Fast audible thermal probe

For a demo visiting a school, I hacked up a fast audible thermal probe. It whistles, with the pitch corresponding to the temperature of what it is pointed at. Useful for finding air leaks in an air conditioned room.

Sensor was one of the MLX90614 variants (see SEN-09570, AF-1747 or AF-1748 or PL-1061). Board was a Magpie Arduino Uno. Speaker was a bare piezo I had lying around. Wired using the Adafruit tutorial for the sensor, and the speaker attached to pin A0.

The sketch below just reads the data without using the library, converts to millidegrees celcius, then converts to a tone in Hz, where 25C is 1kHz. Repeats every hundredth of a second, although it sounds to me like the sensor generates a new reading less often, which the datasheet isn’t clear about, though it does mention a 0.15 second delay before first reading is available.

Warning: may irritate people. :grin: Consider headphones.

#include <Wire.h>

void setup() {
  Wire.begin();
}

void loop() {
  Wire.beginTransmission(0x5a);
  Wire.write(7);
  Wire.endTransmission(false);
  Wire.requestFrom(0x5a, 3);
  uint16_t ret = Wire.read() | (Wire.read() << 8);
  uint8_t pec = Wire.read();
  uint32_t temp = ret * 20L - 273150L; 
  tone(A0, temp/25);
  delay(10);
}
1 Like