How to Make a Stuffed Bat Night Light With a Light Sensor Using Lilypad Arduino

Introduction: How to Make a Stuffed Bat Night Light With a Light Sensor Using Lilypad Arduino

About: Current high school student

In my computer programming class we got to choose what we wanted to do for our project. My group decided we wanted to make something using the arduino lilypad board which can be sewn into fabric using conductive thread to make a circuit. We chose to use lilypad for our projects because we all enjoyed sewing and the projects we had seen using lilypad looked really cool. Then we needed to decide what we wanted to make. We threw around the idea of making a light up dress but decided it would be almost impossible to agree on who would get to keep it after we finished. We ended up deciding to do stuffed animals with different sensors so we could all make one to have. I decided to do a bat because it was near Halloween when I started the project and bats are adorable. I also decided to add a light sensor to my project because my idea was to have a stuffed animal that worked like a night light that had a light sensor so it was only turned on when it was dark enough. This project was ment to take 3-4 weeks but ended up taking almost the whole semester. This is mostly because we had to learn everything from scratch and the coding took a while to figure out. However just putting together the project without having to write the code should take a lot less time.

Step 1: Supplies

1 lilypad arduino simple board

1 lilypad light sensor

1 lilypad basic breakout

6 led's in a color of your choice

alligator clips (for testing your circuit)

1 conductive thread bobbin (you might need more depending on how much you use)

1 e-textile battery

Any color fleece (I got a yard but you could do this with a half yard maybe less. I had a lot of extra)

accent fabric (can be any color or pattern you want)

fabric for lineing

sewing needles

fabric scissors

thread that matches your felt

Sewing machine (optional)

Pattern (I used this one by BreeZeeArt on etsy I highly recommend it. It also comes with sewing instructions. I had to size up the pattern to fit the lilypad)

Step 2: Testing Your Circuit

First you need to make sure everything works. You will need to download Arduino IDE here. This is where you will put your code. You will need to connect your lilypad to your computer so you can download code to it. Here is the code that I wrote. It will make the led's fade in and out when the light gets low enough. You can edit this code to do whatever you want


LilyPad Light Sensor Trigger - Automatic Night Light

Daria Burback

This code reads the input from a LilyPad Light Sensor compares it to a set threshold named 'dark'. If the light reading is below the threshold, an LED will turn on and fade in and out.

Light Sensor connections:

* S pin to A3

* + pin to A5

* - to -

Connect an LED to pin 5 or use the built-in LED on pin 13


// The dark variable determines when we turn the LEDs on or off.

// Set higher or lower to adjust sensitivity. const int darkLevel = 50;

// Create a variable to hold the readings from the light sensor. int lightValue;

// Set which pin the Signal output from the light sensor is connected to

// If using the LilyPad Development Board, change this to A6 int sensorPin = A3;

// Set which pin the LED is connected to.

// Set to 13 if you'd rather use the LilyPad Arduino's built-in LED.

//array of LEDs

int ledpin = 5;

int ledpin2 = 6;

int ledpin3 = 9 ;

int ledpin4 = 10 ;

int ledpin5 = 11 ;

int ledpin6 = 16 ;

void setup() {

// Set sensorPin as an INPUT

pinMode(sensorPin, INPUT);

// Set LED as outputs

pinMode(ledpin, OUTPUT);

// Set pin A5 to use as a power pin for the light sensor

// If using the LilyPad Development Board, comment out these lines of code

pinMode(A5, OUTPUT);

digitalWrite(A5, HIGH);

// Initialize Serial, set the baud rate to 9600 bps.

Serial.begin(9600); }

void loop() {

// Read the light sensor's value and store in 'lightValue'

lightValue = analogRead(sensorPin);

// Print some descriptive text and then the value from the sensor

Serial.print("Light value is:");


// Compare "lightValue" to the "dark" variable

if (lightValue <= darkLevel) // If the reading is less then 'darkLevel'


{ for (int i=0; i<=50; i++)


analogWrite (ledpin,i);

analogWrite (ledpin2,i);

analogWrite (ledpin3,i);

analogWrite (ledpin4,i);

analogWrite (ledpin5,i);

analogWrite (ledpin6,i);

Serial.println (i);

Serial.println ("fade up");

delay (60);


for (int i=50; i>=0; i--)


analogWrite (ledpin,i);

analogWrite (ledpin2,i);

analogWrite (ledpin3,i);

analogWrite (ledpin4,i);

analogWrite (ledpin5,i);

analogWrite (ledpin6,i);

Serial.println (i);

Serial.println ("fade down");

delay (60);


// digitalWrite(ledPin, HIGH); // Turn on LED


else // Otherwise, if "lightValue" is greater than "dark"


digitalWrite(ledpin, LOW); // Turn off LED


// Delay so that the text doesn't scroll to fast on the Serial Monitor.

// Adjust to a larger number for a slower scroll.



Now take your leds (If you are using an led like this you are going to have to take a pair of needle nose pliers to curl the wires in so you can attach the conductive thread. Just make sure you can tell which one is negative and positive.) Attach the positive to the correct pin and attach the negative on the led to the negative on the board. Also add the light sensor to the correct pins. At the top of the code it tells you where to connect. Now run the code and see what happens. Make sure you are covering the light senor with your hand or the room you are in is dark enough so the leds can turn on. Test out different levels of light and edit the variables in the code until you have the light sensitivity you want. You can also change the delay on the fade of the led's to whatever you want. One you get the code to work how you want it is time to start sewing!

Step 3: Sewing

I would recommend doing a mock up of the bat without putting in the lilypad before you use your actual fabric. You can use old sheets as fabric for your mock up. Print and cut out your pattern (if you are using the breezeeart pattern I would recommend sizing it up. I put the pattern into Photoshop and sized them all up at the same time so the wing could be as big as possible while still fitting on a single piece of paper.) and use the pattern pieces to cut out your fabric making sure you give yourself enough seem allowance. Pay attention to what pieces need to be cut twice and which need to be cut on a fold. If you are using the breezeeart you can follow the directions given to make your bat. This step is especially important if you are newer to sewing. Especially if you are using a sewing machine since all the curves can be difficult.

Once you feel somewhat comfortable with the pattern it is time to cut out your final fabrics and starting to essemble your bat. If you dont want to be able to see the conductive thread on the outside of the bat you are going to need to add in a lining. Cut out the body pieces, the head pieces excluding the head gusset, and 2 wings out of the lining fabric. Use a basting stitch (learn how to here) attach the lining to the different pieces. Start by sewing the ears first and attaching them to the head pieces per 1 and 2 on the breezeeart pattern. You can also put together the rest of the head making sure you can still turn it inside out. Don't worry about the eyes yet we will be adding led's as eyes later.

Now we need to get the body ready. Sew the darts on the front and back body pieces. I also added a slit from the top of the pack piece to about 2/3 down that I will add buttons to so once the bat is done I can access the lilypad if I need to. This also helps because we can sew everything internally and then turn it out so the outside is out. Then sew the wings made out of the accent fabric to the front of the body and the normal fabric wings to the back of the body. Now it is time to start adding in the lilypad!

Step 4: Sewing in the Lilypad and Led's

Before you start sewing in led's you are going to want to draw out where you want the led's to go and how you are going to arrange the conductive thread. It is important to make sure your conductive thread doesn't end up touching or you could short out your led or your sensor (I did that and needed to get a new sensor). I put 2 led's on each wing and used 2 led's for the eyes. You can have more or less led's depending on the size of your lilypad but remember that you need to keep 2 pins free for your light sensor. You also need to pay attention to how you orient the lilypad so the pins for the light sensor are facing up. That way you can put the sensor in the middle of the bat's chest.

The first led's I sewed in were the ones for the wings. I placed the the lilypad in the middle of the inside of the front body. I made sure that the pins a3 and a5 were facing up since those are the pins assigned to the light sensor. Then thread a needle with the conductive thread. Since the thread is fairly thick I recommending using a larger needle and putting a bit of wax on the end of the end of the thread. If you are using a lining for your bat make sure when you are sewing the lilypad in you only sewing on the lining and that the thread isn't visible on the outside. Sew around the pin a couple times connecting it to the lining to make sure it is secure and that there is a good connection. Then do a simple running stitch until you get to the point where you want the led. If you are using led's like this then you want to put the led on the outside of the wing. If you are using these type of led's pock a small hole in the fabric to stick the light through and make sure you wrapped up the wires. Sew through the fabric and around the + pin a couple times like you did with the lilypad pin. Do that to all the led's on the wings making sure none of the thread can touch. Once you have the positives you have to add the negative. Sew the negative pin on the lilypad a couple times and then sew around the edge of where the wing led's are and sew onto all of the - pins. You can connect all of the led's negatives together. Once you have the wing led's done you can sew the back of the bat to the front but do not turn the bat right side out yet.

If you added a slit in the back of the bat you can sew the head completely on at this point since you can still turn the bat right side out. Then do what you did with the wing led's with the with the eyes, again being careful to not cross the thread. At this point the thread will probably start to get crowded. Make sure you save room for the sensor.

To add the sensor I did basically the same thing as the led's. If you dont want the whole sensor on the outside you can cute a small hole in the fabric so that the little sensor can see the light levels outside. I also glued the fabric down to the sensor to ensure the fabric would not cover the sensor. At this point you can add in the battery, turn the bat right side out, and add stuffing.

Step 5: Done!

And you are done! Make sure you test it a bit in different light levels to make sure it works. And if you added the back slit you can still edit and re upload your code if you want. This would make a great gifts for kids who are maybe a bit older and can be more careful with the fragile lilypad. Or you can keep it for yourself!

Step 6: What I Learned/What I Would Change

I learned so much during this project. This was my first coding project and my first experience with arduino. I learned how to code, how to find good resources online, and how to put together simple circuits. I am very happy with the final product but there are a few things I would change. For one I would probably edit the code so it has to be darker for the led's to turn on. Also if I was doing this project again I would probably use my sewing machine more so that way the bat looked cleaner.In general the project was a lot of fun and a great introduction into arduino.

Lights Contest 2017

Participated in the
Lights Contest 2017

Be the First to Share


    • Make It Bridge

      Make It Bridge
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • For the Home Contest

      For the Home Contest



    5 years ago

    This is absolutely adorable! What a cute idea :)