LEGO Mindstorms

Over 15 years ago LEGO introduced a product known as Mindstorms. Basically it was a programmable computer and some sensors and motors. Combined with the LEGO Technic style construction pieces, people could easily create rather complex inventions like robots. Unfortunately it was originally provided with an impossibly simple programming language. Almost immediately, a hacker community sprung up to reverse engineer both the software and hardware to improve the system.

I primarily worked on the hardware by developing sensors for sound and color as well as ways to connect more inputs. The flurry of activity attracted the attention of the folks at MIT who had been involved with Mindstorms prototypes. The word Mindstorms is actually borrowed from the work of MIT professor Seymour Papert (See: Mindstorms: Children, Computers, And Powerful Ideas) who pioneered the use of computers in education.

An event called Mindfest was hosted at MIT in October 1999 to physically bring together the innovative individuals who had been collaborating across the internet. I was asked to be a member of a discussion panel and to also lead some homebrew sensor workshops. These experiences lead to my writing several books (See: Extreme NXT: Extending the LEGO MINDSTORMS NXT to the Next Level, Second Edition (Technology in Action) on enhancing the stock Mindstorms product. While I was at Mindfest, I heard an interesting discussion by students Karen Wilkinson and Mike Petrich (See: The Art of Tinkering) who were using a number of sensors to monitor humans. One of the sensors basically measured the subject’s skin resistance which varies with emotion among other things. This idea turns out to be quite an old concept. Even the earliest electrical experimenters over 100 years ago noticed that skin resistance varied over time. The effect is actually utilized as one of the many, hence the poly in polygraph, measurements combined in a lie detector. Turns out it is an easy thing for the LEGO Mindstorms computer to measure as well. 
You can’t get more simple than the LEGO NXT Galvanic Skin Response GSR sensor. It is just a cut 9V LEGO motor wire and some aluminum foil wrapped around your fingers with tape. The Media Lab at MIT has a program called the Affective Computing Research Project that also uses this type sensor.

NXT Conversion Cable

Below is a very simple NXT program that produces a tone whose frequency corresponds to skin resistance. The greater the skin resistance, the greater the RAW sensor value. Higher skin resistance indicates a more relaxed condition, so this produces a lower frequency tone. Sweating lowers the skin resistance and in turn produces a lower RAW sensor value. This then produces a higher frequency tone. If the electrodes are not connected, the RAW value is 1023 which results in a negative frequency and the NXT produces no sound. Click HERE to download a more complex version that displays the RAW sensor value and allows you to turn the sound on and off

Simple NXT GSR program

I also wrote a simple data logging program that just records the RAW sensor value every 10 seconds into a file. The file is then uploaded from the NXT to the PC and plotted using Excel. Below is a graph of my GSR while playing an intense video game. Lower values indicate lower skin resistance and hence higher stress. Near the end I was trapped in a dark room and was being munched to death by aliens. The rapid drop in skin resistance reflects the increased tension of being killed. I kept recording for a few minutes after the game to capture the emotional recovery.