Archive for June 22nd, 2017
A strip of NXP (née Philips plus Freescale, including the part of Motorola that didn’t become ON) LM75A I²C temperature sensors arrived from beyond the horizon. To see if they worked, I soldered thin wires directly to the SO-8 pins, entombed it in Kapton tape to prevent spitzensparken, and jammed it under the foam insulation atop the AD9850 DDS module:
This turns out to be easier than screwing around with thermistors, because the chip reports the temperature directly in Celcius with ⅛ °C resolution. Classic LM75 chips from National (now absorbed by TI) had ½ °C resolution, but the datasheet shows the bits have an easily extensible format:
Huh. Fixed-point data, split neatly on a byte boundary. Who’d’a thunk it?
There’s a standard Arduino library using, naturally enough, floating point numbers, but I already have big fixed point numbers lying around and, with the I²C hardware up & running from the X axis DAC and OLED display, this was straightforward:
Wire.requestFrom(LM75_ADDR,2); Temp.fx_32.high = Wire.read(); Temp.fx_32.low = (uint32_t)Wire.read() << 24; PrintFixedPtRounded(Buffer,Temp,3); u8x8.drawString(0,ln,"DDS C "); u8x8.drawString(16-strlen(Buffer),ln,Buffer); printf(",%s",Buffer); ln += 1;
The next-to-last line squirts the temperature through the serial port to make those nice plots.
Casually ignoring all I²C bus error conditions will eventually lead to heartache and confusion. In particular, the Basement Laboratory temperature must never fall below 0 °C, because I just plunk the two’s-complement temperature data into an unsigned fixed point number.
Which produces the next-to-bottom line:
Alas, the u8x8 font doesn’t include a degree symbol.
Given sufficient motivation, I can now calibrate the DDS output against the GPS-locked 10 MHz standard to get a (most likely) linear equation for the oscillator frequency offset as a function of temperature. The DDS module includes a comparator to square up its sine wave, so an XOR phase detector or something based on filtering the output of an analog switch might be feasible.