Light-sensitive Bookmark with EagLED

Difficulty
Moderate
Steps
10

The EagLED includes multiple LEDs and it also comes with a light sensor. 

In this guide, we'll combine both and build a light-sensitive bookmark that will automatically light up in darkness. We will also use a coin cell battery holder, a CR2032 coin cell battery and felt fabric.

Complete this guide to build your own felt fabric bookmark with a stitched-in LED light that lights up in low light or in the dark.

The parts

For this guide, you'll need:

  • EagLED - Little bird E-Textile Snappable board. The EagLED is our E-textile wearable development board that makes this all possible! We'll be using:
    • The main board
    • We'll be using multiple LEDs
    • Light sensor
    • The coin cell battery holder and a CR2032 coin cell battery
  •  Alligator test leads 
    • This will only be used in the prototyping process
  • Conductive Thread and a sewing needle
    • We'll then sew the components using conductive thread
  • Fabric of your choice
    • Pink and blue felt fabric is used here to create the bookmark
  • Fabric scissors

Step 1  Prototype with alligator clips

First, connect the light sensor to the EagLED main board:

  • Connect '+' to '3.3V' on EagLED
  • Connect '-' to 'GND'
  • Connect 'o' to '#9

Next, connect one of the LEDs to the EagLED main board:

  • Connect '+' to '#10'
  • Then attach '-' to 'GND'

Step 2  Arduino sketch for one LED


              int heartPin = 10;
int lightSensor = A9;
int sensorVal = 0;
int threshold = 30;

void setup()
{
  pinMode(heartPin, OUTPUT);
  pinMode(lightSensor, INPUT);
  Serial.begin(9600);                 //initialize the serial port
}

void loop()                         // run over and over again
{
  sensorVal = analogRead(lightSensor);
  if (sensorVal < threshold) {
    digitalWrite(heartPin, HIGH);
  }
  else {
    digitalWrite(heartPin, LOW);
  }
  Serial.println(sensorVal);
}
            
  • Connect the EagLED to the computer via a microUSB cable. 
  • Then upload this code to the EagLED! 
  • Click on Tools > Serial Monitor in the Arduino IDE to view the sensor values.
  • Try covering the light sensor with your hands, the LED should light up. You can also adjust the variable, 'threshold' to increase or decrease the light level it takes for the LED to light up.

Note: The brighter it is, the larger the light sensor's analog value will be. 

Step 3  Cut out felt fabric

With the prototype finished, it's time to make the bookmark. Cut out a rectangular piece of felt fabric, ideally stiff felt fabric. In this example, we've cut out two pieces of felt fabric of different colours and stitched them together.

Alternatively, you can use fabric glue instead.

Step 4  Connect coin cell battery holder to EagLED

First, let's connect the coin cell battery holder to the EagLED:

  • '-' to 'GND' 
  • '+' to '3.3V'

Step 5  Connect light sensor to EagLED

Next, connect the light sensor to the EagLED:

  • '+' to '3.3V'
  • '-' to 'GND'
  • 'o' to '#9'

Step 6  Connect an LED to EagLED

Connect an LED to the EagLED:

  • '+' to '#10'
  • '-' to 'GND'

Step 7  The finished bookmark

Once complete, insert a CR2032 coin cell battery into the coin cell battery holder. 

Then flick the switch on the EagLED and coin cell battery holder to 'ON'. 

Now when the light level goes under the threshold level, the LED should light up!

Step 8  Arduino sketch for using multiple LEDs


              int ledPins[] = {
  3, 6, 10, 12
};
int lightSensor = A9;
int sensorVal = 0;
int pinCount = 4; //the number of pins used (i.e. the length of the array)

void setup()
{
  for (int thisPin = 0; thisPin < pinCount; thisPin++) {
    pinMode(ledPins[thisPin], OUTPUT);
  }
  pinMode(lightSensor, INPUT);
  Serial.begin(9600);                 //initialize the serial port
}

void loop()                         // run over and over again
{
  sensorVal = analogRead(lightSensor);
  if (sensorVal < 30) {
    for (int thisPin = 0; thisPin < pinCount; thisPin++) {
      digitalWrite(ledPins[thisPin], HIGH);
    }

  }
  else {
    for (int thisPin = 0; thisPin < pinCount; thisPin++) {
      digitalWrite(ledPins[thisPin], LOW);
    }

  }
  Serial.println(sensorVal);
}

            

If you'd like to add more LEDs to the bookmark, upload this Arduino sketch to the EagLED!

Step 9  Connect more LEDs to EagLED

To add more LEDs, follow these steps.

There are three 'GND' sew tabs on the EagLED, and four LEDs as well as a light sensor that will be connected to the EagLED. Connect the '-' on the two heart-shaped LEDs together. 

  • Do the same for the star-shaped LEDs. 
  • Connect each pair to 'GND' sew tabs. 
  • Previously, we have used one 'GND' sew tab for the light sensor, so leave it as is.
  • In the Arduino sketch from before, the pins 3, 6, 10 and 12 were used. So connect the '+' of the remaining three LEDs like this: '+' of one LED to '#3', another to '#6' and another to '#12'.