- KEYWORDS: Module,I2C,MCP9808,temperature,sensor
This is a module that makes it easy to connect to a MCP9808 Precision [[I2C]] Temperature sensor.
The MCP9808 is a precision [[I2C]] temperature sensor from Microchip between -20°C and +100°C with +- 0.25°C / +- 0.5°C (typical/maximum) accuracy. This module makes it easy to connect this sensor with an espruino board.
Use the MCP9808 module for it.
Pin | Espruino |
---|---|
GND | GND |
VCC | 3.3v |
SDA | B7 |
SCL | B6 |
ALERT | Open-Drain-Output |
A2 | GND or 3.3v |
A1 | GND or 3.3v |
A0 | GND or 3.3v |
How to use the module:
I2C1.setup({scl:B6,sda:B7, bitrate: 60000});
var mcp = require("MCP9808").connect(I2C1, 0b000); // 0b000 means A2 = A2 = A1 = GND
var temperature = mcp.getTemperature();
console.log("Temperature: " + temperature + " C");
The sensor can handle bitrates up to 400000 but I had stability problems with this.
- APPEND_JSDOC: MCP9808.js