Sunday 7 November 2010

Lie Detector

The box at the end is a mock up for an idea but the circuit above is working as of this afternoon.
I've been trying to build my own lie detector - perhaps as an interface to a narrative building system. Anyway it works! At least it is measuring the amount of resistance my fingers supply to the circuit, enough to decide whether to flash a red light or a green light. Of course it isn't really a lie detector, but it is reading fluctuations in my body. I've just ordered '30 Arduino Projects for The Evil Genius' because its got a much more interesting circuit..
This is my ultra simple Arduino Code, a variation on Tom Igoe's Analog Input example:
http://arduino.cc/en/Tutorial/AnalogInput */int liePin = 8; int sensorPin = 0; // select the input pin for the potentiometerint ledPin = 13; // select the pin for the LEDint sensorValue = 0; // variable to store the value coming from the sensor
void setup() { Serial.begin(9600); // declare the ledPin as an OUTPUT: pinMode(ledPin, OUTPUT); pinMode(liePin, OUTPUT); }
void loop() { // read the value from the sensor: sensorValue = analogRead(sensorPin); // turn the ledPin on //digitalWrite(ledPin, sensorValue); // stop the program for milliseconds:
// turn the ledPin off: digitalWrite(ledPin, LOW); // stop the program for for milliseconds: Serial.println(sensorValue); if(sensorValue >800){ digitalWrite(ledPin, HIGH); digitalWrite(liePin, LOW); } if(sensorValue <500){>

No comments:

Post a Comment