I am going to revive this thread as this topic is still worth to have a look at. Due to Corona restrictions I found some time to work on this project and this is what I have got so far:
The headband:
(cut-off sleeping mask with some foam and hot glue, very basic for test purposes)
When wearing, the sensor is separated from the skin by a small tube to ensure that it has no direct contact to because otherwise, it would screw up the measurements.
Setup:
MLX90614 integrated
A four-line jack cable that connects the SDA/SCL/GND/VIN ports of the i2c temperature sensor to the Arduino
Arduino Nano
Sketch for the Arduino Nano:
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() {
mlx.begin();
Serial.begin(9600);
}
void loop() {
if(Serial.available() > 0) {
char incomingCharacter = Serial.read();
switch(incomingCharacter) {
case 'A':
Serial.print(mlx.readAmbientTempC());
Serial.print(";");
Serial.print(mlx.readObjectTempC());
Serial.print("\n");
}
}
}
Python script for the first trials:
import serial
import time as t
import seaborn as sns
import matplotlib.pyplot as plt
com = serial.Serial(port='//dev//ttyUSB0', baudrate=9600)
trial = "reading"
externals = []
internals = []
t0 = t.time()
for i in range(40000):
com.write(bytearray('A', 'ascii'))
com.flush()
line = com.readline()
ext = float(str(line)[:-3].split(';')[1])
inter = float(str(line)[2:-3].split(';')[0])
#print(ext, inter)
if ext < 100:
externals.append(ext)
internals.append(inter)
#t.sleep(0.05)
com.close()
t1 = t.time()
print(t1 - t0)
plt.figure()
sns.kdeplot(externals)
plt.savefig(trial + "_distribution.png")
plt.figure()
plt.plot(externals)
plt.savefig(trial + "_course.png")
The Arduino is configured to deliver the external and internal temperature separated by semicolon when an Ascii-encoded ‘A’ is sent via serial port. The Python script does exactly this for a defined amount of iterations, separates the temperature values and visualizes them in two plots. The first plot is a density plot which visualizes the distribution of all temperature values. The second plot shows the distinct temperature values for each iteration.
Before starting the trials, the sensor has to reach equilibrium. I believe this is mostly due to the forehead warming up because of the headband itself. This needs approximately 10 minutes.
Up until now, 2 (roughly 11 minutes) trials were conducted. In one of them I was just sitting on my computer chair with eyes closed and trying not to do something specific. The second trial was conducted while reading a book.
There are some differences in the courses of temperature values as well as the temperature distributions (ignoring one temperature outlier in the closed eyes trial). Whereas the eyes closed trial does not really show a trend in temperature values, the reading trial shows a tendency for the temperature to settle somewehere around 35.45 and 35.50. This is consistent with my subjective experience to be more immersed in the text.
The temperature distribution differs between these two trials in a shift towards the upper temperature range in the reading trial as opposed to the closed eye trial. The Max peak value is higher (around 66) for the closed eye trial but more evenly distributed in the reading trial. This has to be taken with a grain of salt, because there was only one trial for each experiment and the results should be validated by multiple trials to be meaningful.
thebrainstore stated that not the absolute temperature is of importance but more the rate of change in temperature. Someone who has difficulties in activating their prefrontal cortex should not be able to raise the temperature for very long. In order to create a feedback, the positive rate of change should be visualized in some way.
As you can see in the course plots, there is a lot of noise, i.e. jumping of temperature values between the distinct measurements. One way to handle this would be smoothening of the signal, which can by basically done by creating the average of a certain number (a window) of successive values. This would be the next step to implement. Further, I attached a datasheet of the used sensor. There are different types of the MLX90614, some of them are calibrated to deliver medical accuracy within the temperature range which is needed in scope of this project. What we are looking for is the MLX90614ESF-DXX-XXX-TU (X is a placeholder, the D the important part). I will have a look at that in time, hopefully.
I would be very happy about suggestions and ideas.
Best regards