Introduction: Light Sensor: Teach Photoreceptors

This instructable is designed to help a science teacher build a sensor that can be used to teach photoreceptors in the eyes.  It includes step-by-step instructions on the construction of the sensor as well as information on the principles it can be used to teach.  This video demonstrates the working sensor:

This following materials will be needed for construction of this sensor:

-piece of felt
-Sewing Needle
-Elmer's Glue
-conductive thread ($34.95-$39.95)
-3 LED lights (red, blue & green) (pack of 5 lights on one color, $4.95)
-LilyPad Simple Snap Protoboard ($9.95)
-LilyPad Arduino Simple Snap ($29.95)
-LilyPad Light Sensor ($7.95)

*Needles, scissors, Elmer's Glue and felt can all be purchased at a local craft store such as Hobby Lobby, JoAnn's, Michaels or WalMart
*LED lights, LilyPad Products & conductive thread can be purchased from
*To charge and program the LilyPad, you will also need to purchase a SparkFun USB Mini-B Cable ($3.95) and a LilyPad FTDI Basic Breakout-5V ($14.95)

Step 1: Layout

This sensor can be laid out in any way that you choose.  As long as the pieces are connected correctly, the layout will not matter.  The very first thing to do is to layout all of the pieces (the 3 LEDs, LilyPad Simple Snap Protoboard, and the light sensor) in the way that you want them arranged.  The picture above is a simple circuit diagram of this project.  

Just a few things to remember as you are choosing how you want your sensor to look:
-none of the stitches can cross
-all of positive sides of the LEDs need to be connected to a pin on the LilyPad Simple Snap (I chose A4, A3 & A2)
-all of the negatives of the LEDs need to attach to the negative pin on the LilyPad Simple Snap
-the positive pin on the light sensor needs to be attached to the positive pin on the LilyPad Simple Snap
-the negative pin on the light sensor needs to be attached to the negative pin on the LilyPad Simple Snap
-the S pin on the light sensor needs to be attached to a numbered pin (I chose 5)

Once you have a layout decided, it is time to begin sewing.

Step 2: Sewing the Light Sensor

Begin by using a needle threaded with the conductive thread to sew the light sensor to the pins on the LilyPad ProtoSnap that you have chosen.  The piece of felt will be used as the base to anchor all of the pieces to.  Sew the negative(-)  to the negative (-), positive (+) to positive (+), and the S to a numbered pin*.  When sewing you will need to start and end each section with a knot.  For example, sew through the negative pin on the LilyPad ProtoSnap three times to make sure you create a good connection and it is anchored securely, then stitch to the negative pin on the light sensor, sewing through that pin three times as well.  Then tie a knot and cut the string.  

*I found that while trying to sew the light sensor to the LilyPad ProtoSnap that it is very difficult to not cross the stitches because of the layout of the pins.  To make sure that no stitching crossed, I ended up having to sew underneath the light

Step 3: Sewing the LEDs

The next step involves sewing the LEDs to the ProtoSnap.  Using the same method of three times through, connect the positive (+) ends of the LEDs to the three individual pins that you selected.  The negative (-) sides of the LEDs can all be sewn on the same circuit.  Start at the negative (-) pin on the LilyPad ProtoSnap and then sew to the first LEDs negative (-), followed by the next LED and the third as well.  

Step 4: Programming

Now that the crafting of the sensor it complete, it's time to program it.  Attach the SimpleSnap to your ProtoBoard and then connect your sensor to the computer and open up Arduino to begin programming.  The programming will involve reading in a range and adjusting the range to make the different lights come on.    The following is code that I used, but tweaking will need to be done on the sensor values as well as to the pin numbers that the lights and light sensor are connected to.  

Open a session of Arduino and copy the following code into it.  Click verify to make sure that all of the code is correct and then upload the code to the sensor.  Open the serial monitor on the right side and watch the values that are displayed.  From these values choose the range that you want the sensor to cover and update the code accordingly.  This code has been remixed from  Also pieces came from Debbie Fields Craft Technology Class offered at Utah State University Spring 2013.

This sensor is very sensitive and will need to be adjusted to the location that it will be used it.  Depending on what type of light is in the room (artificial or natural), the ranges will vary.  For best results, test your sensor in the location you will be using it to see what the ranges are and adjust them as needed.

* LilyPad tutorial: sensing (sensors)
* Reads data from a LilyPad light sensor module and then sends that data to the computer so that you can see the sensor values

int GreenledPin = A2; // LED is connected to digital pin A2
int RedledPin = A3;  //LED is connected to digital pin A3
int BlueledPin = A4;  //LED is connected to digital pin A4
int sensorPin = 5; // light sensor is connected to analog pin 5
int sensorValue; // variable to store the value coming from the sensor

void setup() 

         pinMode(GreenledPin, OUTPUT); // sets the ledPin to be an output
         Serial.begin(9600); //initialize the serial port
         //digitalWrite(GreenledPin, HIGH); // turn the LED on
         pinMode(RedledPin, OUTPUT); // sets the ledPin to be an output
         Serial.begin(9600); //initialize the serial port
        // digitalWrite(RedledPin, HIGH); // turn the LED on
         pinMode(BlueledPin, OUTPUT); // sets the ledPin to be an output
         Serial.begin(9600); //initialize the serial port
        // digitalWrite(BlueledPin, HIGH); // turn the LED on

void loop() // run over and over again

          sensorValue = analogRead(sensorPin); // read the value from the sensor
          Serial.println(sensorValue); // send that value to the computer
          delay(500); // delay for 1/10 of a second
          if (sensorValue >= 100 && sensorValue <= 175)
          digitalWrite(GreenledPin, HIGH);
         delay (3000);
        digitalWrite (GreenledPin, LOW);
         else if (sensorValue > 175 && sensorValue <=250)
           digitalWrite(BlueledPin, HIGH);
         delay (3000);
        digitalWrite (BlueledPin, LOW);
         else if (sensorValue > 250)
          digitalWrite(RedledPin, HIGH);
          delay (3000);
          digitalWrite (RedledPin, LOW);


The code can be updated so that it reads in a range of values and then finds the average of those values.  This method will make the sensor less temperamental.  This is known as smoothing and example code can be found at  The smoothing code can be combined with the code above if you wish to make the sensor ranges more stable.

Step 5: Teaching With the Sensor

This sensor is to be used in conjunction of teaching the concept of photorecepetors and color vision in the eyes.  The image above is a graphic that is used to show the different wavelengths of the different colors the eyes sense.  The sensor is used to show how depending on the wavelength (range of light) reaching sensor will depend on which color our eye sees (color of light that is turned on).

"The colors we perceive are related to the wavelengths of light that are reflected, absorbed, or transmitted by the pigments in the objects of our visual world.  Color vision begins with activation of the photopigments in the cone receptor cells.  Human retinas have three kinds of cones, which contain red-, green-, or blue- sensitive photopigments.  As their names imply, these pigments absorb and hence respond optimally to light of different wavelengths."  (Human Physiology 7th Edition, Vander, Sherman, Luciano, pg 247)


About This Instructable




More by anipotts:Motion Sensor: Teach VestibularLight Sensor: Teach PhotoreceptorsForce Sensor: Teach Golgi Tendon Organ
Add instructable to: