LMT87 Temp sensor

The LMT87 Temp sensor is a 3 pin device that I suspect might be represented by the analog-sensor. There is a rather complicated mapping (for tight tolerances) and a rough formula (for low tolerance) to interpret the output to an understood value. If I am to use the analog-sensor, how am I to enter the mapping or the formula? If not, can this node be created?

I can also imagine that an LMT87 node can be created from the analog-sensor. Is this the path that is usually followed?

1 Like

Hi @stedenis,

A good starting point is the official guide to creating nodes for analog sensors:

You can use the XOD math nodes to implement your mapping/formula.

If you get stuck, post your XOD patch here and I’m sure someone will point you in the right direction.

1 Like
  1. Arduino Analog Read node reads in fraction of the bit precision (10-bits = 1023 for Arduino) of the voltage range (5V for Arduino Uno). So you have to first divide to value by the bits (1023), then multiply by the 5V. They do like that to allow flexibility in the physical system, like using a different range of voltage. As Wayland says, below, the XOD node reports the fraction of 5V.
  2. If the equation map is complicated (like it’s non-linear over a big range), then you can chop out the part that you’re interested in and fit it, in Excel for example, to a linear or quadratic curve over the region of interest, and just use basic math nodes to program that in XOD. If it’s linear, then the MAP node will work, easily.

While the analogRead function in the Arduino IDE returns a value in the range 0 to 1023, XOD’s analog-read node outputs a value in the range 0.0 to 1.0. This means that if you’re using an Arduino Uno, you simply need to multiply the output from the analog-read node by five to get the voltage.

Wayland, I understand. This is not foreign to me.

Per the LMT87 datasheet, “Although the LMT87 is very linear, the response does have a slight umbrella parabolic shape.” My needs require the ability across most of the full range. While there is a mapping (they call it a transfer table), I need the granularity between lookup elements. That means a formula is needed.

I have the formula. Now, I need to make it work. If I get this to work as a standard Arduino library, how well do libraries translate in XOD?

The developers have made it easy to wrap class-based Arduino libraries, see:

However, for your project it may be simpler to place all of the code for your formula inside a not-implemented-in-xod node, see:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.