# Hourglass effect

**URL:** <https://wled.discourse.group/t/hourglass-effect/11901>\
**Category:** Questions\
**Created:** [May 24, 2024, 12:45am UTC](https://wled.discourse.group/t/hourglass-effect/11901 "2024-05-24T00:45:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![George-Verboven](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/george-verboven/32/10501_2.png) [@George-Verboven](https://wled.discourse.group/u/George-Verboven)\
**Post date:** [May 24, 2024, 12:45am UTC](https://wled.discourse.group/t/hourglass-effect/11901/1 "2024-05-24T00:45:39Z")

</div>

First of all, my apologies if I am asking this question in the wrong place.

I have a vertical strip of, for example, 100 LEDs.  
Now I would like to create an hourglass effect, where the top 50 LEDs slowly decrease in number and the bottom 50 slowly increase in number.  
Ideally, I would like it to have the same effect as an hourglass.

I have tried everything, but I can’t get it to work.  
Can someone help me out?  
Thanks a lot in advance.

---

<div class="post-metadata">

**Author:** ![ALDIY](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/aldiy/32/2716_2.png) [@ALDIY](https://wled.discourse.group/u/ALDIY)\
**Post date:** [May 24, 2024, 1:25am UTC](https://wled.discourse.group/t/hourglass-effect/11901/2 "2024-05-24T01:25:39Z")

</div>

The closest i tested is a progress bar with wled , If you have 100 leds active and want to light one pixel at a time in an easy way use IX=~ with Percent effect , would look good on strips but I have none so it works also on a matrix .

Demo video is too big to upload in discourse , so link on discord

 ![image](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/0/0475b268d23433d9a449f5578f6a4dc1f12899ae.jpeg)

> **[Discord - A New Way to Chat with Friends & Communities](https://discord.com/channels/473448917040758787/801531333067014164/1143590913281634355)**
>
> Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

---

<div class="post-metadata">

**Author:** ![George-Verboven](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/george-verboven/32/10501_2.png) [@George-Verboven](https://wled.discourse.group/u/George-Verboven)\
**Post date:** [May 24, 2024, 2:40pm UTC](https://wled.discourse.group/t/hourglass-effect/11901/3 "2024-05-24T14:40:26Z")

</div>

**Hi ALDIY,**

Thank you for your response.  
I have tried various things with IX=~ with Percent effect, but I am not getting the desired effect.  
The effect I aim for is to symbolize the falling sand in an hourglass.  
So, in a strip of 100 LEDs, the first segment from 0-50 LEDs is the upper part of the hourglass, and the second segment from 51-100 is the lower part.

When starting, all LEDs in the first segment should be on, then LED 1 should turn off and with a kind of drip effect in the second segment, LED 100 should turn on (and stay on).  
Then the effect repeats: LED 2 off - drip effect in the second segment to then turn on LED 99 (and stay on together with LED 100).

Is it possible to make this with some kind of Map or API?

I don’t have much experience with Map or API, but I am persistent 😁 so any tips are welcome.  
I really hope there are experienced users who can help me solve this challenge.

_Have a great weekend to everyone who reads this._

---

<div class="post-metadata">

**Author:** ![ALDIY](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/aldiy/32/2716_2.png) [@ALDIY](https://wled.discourse.group/u/ALDIY)\
**Post date:** [May 25, 2024, 7:06am UTC](https://wled.discourse.group/t/hourglass-effect/11901/4 "2024-05-25T07:06:57Z")

</div>

The idea is that you would use the example I listed to explore and do the effect on your own , so that is just a way for you to fish . But sure wait for experienced users to hand that to you

---

<div class="post-metadata">

**Author:** ![George-Verboven](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/george-verboven/32/10501_2.png) [@George-Verboven](https://wled.discourse.group/u/George-Verboven)\
**Post date:** [May 25, 2024, 9:54am UTC](https://wled.discourse.group/t/hourglass-effect/11901/5 "2024-05-25T09:54:16Z")

</div>

I appreciated the example you provided and understood that it was meant to be a challenge for me to further explore how I could achieve the intended effect.  
I tried everything within my power and researched extensively, but unfortunately, I couldn’t make any progress.  
That’s why I’m asking for additional help. Not because I expect a ready-made answer, but because I genuinely couldn’t continue despite my efforts.

I find it regrettable and unnecessary that you chose to end your response with a sour and sarcastic remark. It’s completely uncalled for and does not encourage further requests for help.

---

<div class="post-metadata">

**Author:** ![ALDIY](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/aldiy/32/2716_2.png) [@ALDIY](https://wled.discourse.group/u/ALDIY)\
**Post date:** [May 25, 2024, 12:48pm UTC](https://wled.discourse.group/t/hourglass-effect/11901/6 "2024-05-25T12:48:04Z")

</div>

I am not really "experienced " as you implied but i do explore on my own so that is the open source way to explore , i did not see any details from your post to actually indicate you have tried . And please cool down and do not be sensitive or try to also watch your word carefully if you do not like such reply

---

<div class="post-metadata">

**Author:** ![Magig\_Wled](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@Magig\_Wled](https://wled.discourse.group/u/Magig_Wled)\
**Post date:** [May 25, 2024, 6:05pm UTC](https://wled.discourse.group/t/hourglass-effect/11901/7 "2024-05-25T18:05:17Z")

</div>

If you only need this in a single projekt why diont you just usa a ARDUINO  
Preferd a UNO Board for safty reason  
hook up the Stripe to 5V on the Board MAX200LED’s  
GND to GND  
and PIN 4 via a 1k Resistor to Stripe DATA IN ;

use this CODE

```auto
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> 
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 4 

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 30

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
//counters
int up = 0;
int down = NUMPIXELS;

//color
uint32_t black = pixels.Color(0, 0,0);
static uint32_t green = pixels.Color(0, 255,0);
//timing
long previousMillis; // will store last time pixel was updated
unsigned long currentMillis; 
const long interval = 1000; // Länge der Pause in ms

void setup() {
 pixels.begin(); // INITIALIZE NeoPixel pixels object (REQUIRED)
 pixels.setBrightness(25);
 pixels.clear(); 
 for(int i=NUMPIXELS/2 ;i<NUMPIXELS+1;i++){
      pixels.setPixelColor(i,green);
      }
 pixels.show();
}

void loop() 
{
   currentMillis = millis();
  //wait Blink
  if (currentMillis - previousMillis >= interval) { 
     previousMillis = currentMillis; // Zeitpunkt der letzten Schaltung wird festgehalten 
    if (up > NUMPIXELS/2){up=0;
    pixels.clear(); 
    }
    if (down< NUMPIXELS/2){down=NUMPIXELS;
    for(int i=NUMPIXELS/2 ;i<NUMPIXELS;i++){
      pixels.setPixelColor(i,green);
      }
    
    }

    pixels.setPixelColor(up,green);
    pixels.setPixelColor(down,black);
    up++;
    down--;
    pixels.show();
  }

}

```

and it does what you wnat with some timing  
and all extrras you like to do  
@ALDIY@George-Verboven

VIDEO of Running LED’s

[![](https://global.discourse-cdn.com/free1/uploads/wled/original/2X/5/54f884f74abc13a3c5d1c4482abc69eb6f9c1a3a.jpeg "Arduino Hourglas WS2812b Effect") ](https://www.youtube.com/watch?v=YzPbLqN8zLY)

---

<div class="post-metadata">

**Author:** ![ALDIY](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/aldiy/32/2716_2.png) [@ALDIY](https://wled.discourse.group/u/ALDIY)\
**Post date:** [May 26, 2024, 1:30am UTC](https://wled.discourse.group/t/hourglass-effect/11901/8 "2024-05-26T01:30:55Z")

</div>

I do runs some ardunio projects from time to time but not for something as simple as that as you would be missing the other things in wled but I guess if one is not willing to explore

---

<div class="post-metadata">

**Author:** ![George-Verboven](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/george-verboven/32/10501_2.png) [@George-Verboven](https://wled.discourse.group/u/George-Verboven)\
**Post date:** [May 26, 2024, 12:58pm UTC](https://wled.discourse.group/t/hourglass-effect/11901/9 "2024-05-26T12:58:02Z")

</div>

Thanks Magig\_Wled,

With a lot op help from Koepel on Discord, he visualized the effect with nano-uno and sketch.

> **[Grains of sand falling in a hourglass. - Wokwi ESP32, STM32, Arduino Simulator](https://wokwi.com/projects/398910812136791041)**
>
> Run IoT and embedded projects in your browser: ESP32, STM32, Arduino, Pi Pico, and more. No installation required!

---

<div class="post-metadata">

**Author:** ![Magig\_Wled](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@Magig\_Wled](https://wled.discourse.group/u/Magig_Wled)\
**Post date:** [May 26, 2024, 5:27pm UTC](https://wled.discourse.group/t/hourglass-effect/11901/10 "2024-05-26T17:27:21Z")

</div>

@George-Verboven YOU Can use also your TERMINAL  
Direct API command via CURL senidng

```auto
curl -X POST "http://192.168.2.100/json/state" -d '{"on":true, "bri":25, "seg":{"i":[
        0,15,[0,0,0],14,30,[0,255,0]]}}' -H "Content-Type: application/json"

```

THIS puts on the LED 15-30 UPPER SIDE  
then i use jq and a For command to get the Effect

```auto
led=1;for x in {0..14..1}; do r=$(jq -cn --arg led "$led" '($led|tonumber) as $led | {on:true,bri:25,seg:{i:[0,$led,[0,255,0],30-$led,[0,0,0]]}}'); curl -X POST "http://192.168.2.100/json/state" -d $r -H "Content-Type: application/json";echo "nummer $led"; sleep 1;((led++)); done 

```

this is quite a chalenche but it does weork also in the homeNET

---

<div class="post-metadata">

**Author:** ![dedehai](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/dedehai/32/7265_2.png) [@dedehai](https://wled.discourse.group/u/dedehai)\
**Post date:** [June 11, 2024, 8:31pm UTC](https://wled.discourse.group/t/hourglass-effect/11901/11 "2024-06-11T20:31:41Z")

</div>

I took this topic for inspiration and made an hourglass effect.  
posted a demo here on WLED discord: [Discord](https://discord.com/channels/473448917040758787/706623245935444088/1250185093478092840)
