Skip to content

TinyLily LEDs Blinking & Fading

Use your TinyLily LEDs in projects with the ability to blink and fade them!

If you haven't already, go through the setup tutorial for the TinyLily Processor Board you plan to use with this tutorial.


So you want the smallest possible sewable LED for your project? Try out the TinyLily LED 0402 which sports a total size of just 6.5mm x 2.5mm! Yet this tiny little guy still includes standard TinyLily sewtabs and a current limiting resistor, so you don’t have to worry about blowing it up or adding an external resistor. Available with Red, Green and Amber LED color options.

Try the TinyLily LED that's tiny, but a little bigger than the 0402, in the 1206 size of 10.2mm x 4mm!

Technical Details
  • Washable
  • Two Sewtabs – 1.2mm in diameter, easy to use with standard conductive thread and needles
  • Robust Gold Finish – makes soldering easy and is non-corrosive

    Power Requirements

    • Voltage: 3.0V - 5.5V 
    • Current:
      • 1.5mA per LED (3.0V)
      • 5.0mA per LED (5.0V)

    Dimensions 0402

    • 6.5mm x 2.5mm (0.26 inches x 0.1 inches)
    • Max Height: 1.11mm (0.044 inches)
    • Ultra-thin 0.61mm (0.024 inches) PCB
    • Weight: .02 grams (0.0007 ounces) 

    Dimensions 1206

    • Dimensions: 10.2mm x 4mm (0.40 inches x 0.18 inches)
    • Max Height: 1.44mm (0.057 inches)
    • Ultra-thin 0.61mm (0.024 inches) PCB
    • Weight: .06 grams (0.002 ounces) 

    To learn more about the TinyDuino Platform, click here


    Hardware materials




    • Fabric material
    • (Optional) Embroidery Hoop - helps keep material taut, making it easier to work with

    To blink or fade an LED using TinyLily, there are a few simple steps to guarantee success:

    1. Pick which pin(s) you'll be using
    2. Write up the arduino logic
    3. Connect LEDs to the selected pin(s)
    4. Upload the program to the TinyLily

    1. Picking Pins

    The TinyLily has sewing tabs for pins 0, 1, 2, 3, A0, A1, A4, A5. Following this diagram, you can see that all of these pins are digital pins and can be used for the purpose of blinking an LED.

    TinyLily pinout

    To fade an LED, the pin used must be able to use PWM. As seen in the diagram, the only pin capable of PWM is pin 3.

    2a. Blinking an LED

    To blink an LED, HIGH and LOW signals are sent to the pin where the LED is connected in order to turn the LED on and off. All you have to do before sending these signals is set the pin to output.

    To do this in the Arduino Sketch:

    // Toggles an LED on and off 
    void blinkLED() {
      digitalWrite(blinkPin, HIGH);
      digitalWrite(blinkPin, LOW);

    Where the blinkPin is initialized to the number of the pin attached to the LEDs.

    If you wanted to keep the LED(s) on, you would use digitalWrite(blinkPin, HIGH); and use LOW to keep the LED(s) off.

    2b. Fade LED with PWM

    To fade an LED, you need a pin that is capable of pulse width modulation (PWM). A pin with pulse width modulation is one that can control the amount of time the signal is high and low. The signal sent to these pins can only be high or low as a value, but with PWM you are able to change the frequency the signal is high and low.

    You can think about PWM like pressing the gas pedal in a car at different frequencies. The more you press the gas pedal, the faster you'll go. In the same way, the higher the PWM, the brighter an LED will be. We can adjust this frequency over time in order to create a fading effect.

    Looking at the code for how to do this:

    // Fades an LED between on and off 
    void fadeLED() {
      // Set the brightness of the fade pin
      analogWrite(fadePin, brightness); 
      // Change brightness during each function call
      brightness += fadeAmount;  
      // Reverse fading direction
      if(brightness <= 0 || brightness >= 255) {
         fadeAmount = -fadeAmount;
      delay(15); // Can increase to make fading last longer, or vice versa 

    The LED is given a fading effect by sending increasing and decreasing amounts of brightness with a timed delay in between to make the effect noticeable to the human eye.

    The only pin capable of PWM on the TinyLily is pin 3, so make sure to keep this pin open in case you want to fade LEDs!

    3. LED Connection

    LEDs have an important polarity convention to follow. Meaning there is one side that is negative, and one side that is positive. The negative side should be attached to one of the ground (GND) tabs available on the TinyLily. The positive side will be the one accepting voltage, so it needs to be attached the the pin that you use in the Arduino Sketch so that the signals are sent to this pin.

    4. Upload Program

    This program uses pin 3 to faded LEDs attached to it, and to blink LEDs attached to pin A4. The pin to blink LEDs can be edited at the top of the program.

    Download the example program .zip file under the Software section, and then upload it to your TinyLily using the following Tools selections:

    Tools Selections: COM## will likely differ

    Once the program is uploaded, you should see your LEDs display the pattern shown below:

    Ye Olde Blink & Fade

    How many LEDs?

    Note that since I used two LEDs per pin, my LEDs are dimmer than a single LED would be. The max amount of LEDs with resistors intact attached to a pin should be kept to 3 as they get much dimmer as more LEDs are added

    What if I want more LEDs?

    If you want to connect several LEDs to one pin, you can remove the resistors after the first LED. Once these resistors are removed, you should not connect them directly to any of the TinyLily pins without a resistor! The amount of current supplied without the resistor would likely overpower and burn the sensitive components.


    Contact Us

    If you have any questions or feedback, feel free to email us or make a post on our forum. Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it.

    Thanks for making with us!