Reads data from the thermocouple amplifier MAX31855.
var tessel = require('tessel');
var thermocouplelib = require('thermocouple-max31855');
var sensor = thermocouplelib.use(tessel.port['GPIO'], {
cs: 0,
poll: 10
});
sensor.on('measurement', function (data) {
console.log(data);
})
To install the library:
npm install thermocouple-max31855
To include it in your code:
var thermocouplelib = require('thermocouple-max31855');
var sensor = thermocouplelib.use(port, { /* options */ });
# sensor.read( function (err, data) )
Create a measurement reading from the thermocouple. Returns data of this structure:
{
fault : 0,
fahrenheit : 86.9,
shortVCC : 0,
celsius : 30.5,
internal : 22.0625,
openCircuit : 0,
shortGND : 0
}
# sensor.on( 'measurement' )
Every time a reading is made (using the .read()
function or through the .poll
option) this event is emitted. See .read()
for its data structure.
The thermocouple talks over SPI, so we need to connect chip select, clock, and data, as well as power and ground.
From the thermocouple amplifier to Tessel's GPIO bank:
- Vin > 3.3V (power)
- 3Vo > nothing, we don't need this one
- GND > GND (ground)
- DO > MISO (this is data from the thermocouple coming in to Tessel)
- CS > TX/G1 (chip select– we're using a digital GPIO pin to tell the amplifier when we're talking to it)
- CLK > SCK (different names for the clock pin)
From the thermocouple amplifier to Tessel's Port bank:
- Vin > 3.3V (power)
- 3Vo > nothing, we don't need this one
- GND > GND (ground)
- DO > 3
- CS > 5
- CLK > 2
Note: These connections are in the same location as they are on the Tessel 1. You can also see the original labels on the underside of the T2.
MIT