Hi, I'm trying to design a Lucid Dreaming Machine, that detects Rapid Eye Movements. During sleep, your brain is active, and while your sleeping, your eyes are moving while the rest of the body is paralyzed. So i was thinking of a machine that can use infrared sensors such as the QTR-1RC,
Can i use the reflectance to count 20 movements??? Or some sort of difference between 2 sensors??
Here's my code so far.. How would i go for this sort of sketch??? Any ideas are welcome. I picked the QTR-1RC to avoid a ADC
#include <PololuQTRSensors.h>
// Six Analog Pins can be commonly referenced as:
// analog 0 - Reference as: Pin 14
// analog 1 - Reference as: Pin 15
// analog 2 - Reference as: Pin 16
// analog 3 - Reference as: Pin 17
// analog 4 - Reference as: Pin 18
// analog 5 - Reference as: Pin 19
unsigned long time;
int ledPin = 10;
PololuQTRSensorsRC qtr((unsigned char[]) {3},1);
void setup()
{
pinMode(ledPin, OUTPUT);
// then start calibration phase and move the sensors over both
// reflectance extremes they will encounter in your application:
int i;
for (i = 0; i < 250; i++) // make the calibration take about 5 seconds
{
qtr.calibrate();
delay(20);
}
Serial.begin(9600);
}
void loop()
{
unsigned int sensors[1];
int EYE = qtr.readLine(sensors);
//Output to Serial
Serial.print(sensors[1]);
Serial.print(" Reflectance ");
Serial.print("0 (Full Reflectance) to 1000 (no Reflectance)");
Serial.print("Time Elapsed: ");
time = millis();
//prints time since program started
Serial.println(time);
// wait a second so as not to send massive amounts of data
delay(1000);
Serial.println();
if (sensors[0] == 0)
{
digitalWrite(ledPin, HIGH);
}
// Turn off the LED if we have a Low Reflectance.
else digitalWrite(ledPin, LOW);
}