Skip to content

Commit 85de129

Browse files
authored
Merge pull request #33 from caternuson/iss32_emis_set
Examples update for emissivity
2 parents 912d940 + 630b172 commit 85de129

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* See app note:
3+
* https://www.melexis.com/en/documents/documentation/application-notes/application-note-mlx90614-changing-emissivity-setting
4+
*
5+
* 1. Write 0x0000 to address 0x04 (erase the EEPROM cell)
6+
* 2. Write the new value to address 0x04
7+
* 3. Read the value in address 0x04 in order to check that the correct value is stored
8+
* 4. Restart the module
9+
*
10+
*/
11+
12+
#include <Adafruit_MLX90614.h>
13+
14+
//== CHANGE THIS ============
15+
double new_emissivity = 0.95;
16+
//===========================
17+
18+
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
19+
20+
void setup() {
21+
Serial.begin(9600);
22+
while (!Serial);
23+
24+
Serial.println("Adafruit MLX90614 Emissivity Setter.\n");
25+
26+
// init sensor
27+
if (!mlx.begin()) {
28+
Serial.println("Error connecting to MLX sensor. Check wiring.");
29+
while (1);
30+
};
31+
32+
// read current emissivity
33+
Serial.print("Current emissivity = "); Serial.println(mlx.readEmissivity());
34+
35+
// set new emissivity
36+
Serial.print("Setting emissivity = "); Serial.println(new_emissivity);
37+
mlx.writeEmissivity(new_emissivity); // this does the 0x0000 erase write
38+
39+
// read back
40+
Serial.print("New emissivity = "); Serial.println(mlx.readEmissivity());
41+
42+
// done
43+
Serial.print("DONE. Restart the module.");
44+
}
45+
46+
void loop() {
47+
}

examples/mlxtest/mlxtest.ino

+4
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ Adafruit_MLX90614 mlx = Adafruit_MLX90614();
2222

2323
void setup() {
2424
Serial.begin(9600);
25+
while (!Serial);
2526

2627
Serial.println("Adafruit MLX90614 test");
2728

2829
if (!mlx.begin()) {
2930
Serial.println("Error connecting to MLX sensor. Check wiring.");
3031
while (1);
3132
};
33+
34+
Serial.print("Emissivity = "); Serial.println(mlx.readEmissivity());
35+
Serial.println("================================================");
3236
}
3337

3438
void loop() {

0 commit comments

Comments
 (0)