BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Voice controlled LED strip with Google Assistant, IFTTT and Blynk


#1

What’s up everyone, I’m here to share my recent project with Blynk and ask for some opinions.
First, here’s a little demo video I made:


The reason I say “stop all effects” is because of the way I implemented the effects, which can be seen below.
I’m using a NodeMCU connected to my ws2811 LED strip.
Thanks to the Blynk community, it was quite easy to integrate the Google Assistant part, as it is just a few applets that triggers different Webhooks on IFTTT.
For libraries I’m using Tzapu’s WiFiManager, Adafruit Neopixels and Blynk of course.

Here is part of my code, I omitted the WiFiManager part and the Neopixels effects functions.

char blynk_token[34] = "BLYNK_TOKEN";

int arcoiro = 0; //effect select
int timer_id; //timer id to call for effects
int R = 0; 
int G = 0;
int B = 0;
int deepSleep = 0; //toggle deepsleep
int wait_time = 10; //effects delay

#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
BlynkTimer timer_blynk;

#define NUMPIXELS 23
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, D9, NEO_RGB + NEO_KHZ800);

void setup()
{
//Long Tzapu WifiManager Code
//...
  Blynk.config(blynk_token);
  Blynk.connect();
  timer_id = timer_blynk.setInterval(1000L, effectsTimer);
  timer_blynk.disable(timer_id);
  strip.begin();
  strip.show();
  
}

//call the effects every second
void effectsTimer()
{
  switch (arcoiro)
  {
    case 1: rainbowCycle(wait_time); break;
    case 2: rainbow(wait_time); break;
    case 3: snakeBounce(wait_time); break;
    case 4: snakeBounceHalf(wait_time);
  }

}

//Step H, effect selector 
BLYNK_WRITE(V1)
{
  arcoiro = param.asInt();
  if(arcoiro >= 1)
  {
    timer_blynk.enable(timer_id);
    timer_blynk.restartTimer(timer_id);
    switch (arcoiro)
    {
      case 1: Blynk.setProperty(V1,"label","Rainbow Cycle"); break;
      case 2: Blynk.setProperty(V1,"label","Rainbow"); break;
      case 3: Blynk.setProperty(V1,"label","Snake Bounce"); break;
      case 4: Blynk.setProperty(V1,"label","Snake Bounce 2"); break;
    }
  }else
  {
    Blynk.setProperty(V1,"label","Sem Efeito");
    timer_blynk.disable(timer_id);
  }
}

//State sync because of DeepSleep
BLYNK_CONNECTED() {
    Blynk.syncAll();
}

//DeepSleep for 20s, so the dev board will keep cool
BLYNK_WRITE(V0)
{
  deepSleep = param.asInt();
  if(deepSleep == 1)
  ESP.deepSleep(20000000);
}

//Changes led strip color with zeRGBra
BLYNK_WRITE(V2)
{
  R = param[0].asInt();
  G = param[1].asInt();
  B = param[2].asInt();
  
  for(int i=0;i<NUMPIXELS;i++){
    strip.setPixelColor(i, strip.Color(R,G,B)); 
    strip.show(); 
  }

}

//Change the delay time for the effects, 10-50 works fine
BLYNK_WRITE(V3)
{
  wait_time = param.asInt();
}



  void loop()
{
  Blynk.run(); // Initiates Blynk
  timer_blynk.run();
}

One of the things I want to improve is that if an effect is currently on, there is a little delay when switching off the effect due to the delay function needed to be able to visualize the effect. I wonder if it is possible to have a second timer with a faster period to act as an interrupt for any effect currently on.

Also there is probably an easier/smarter way to toggle the virtual pins with IFTTT, as the way I’m doing I have to create 2 applets for turning on and off something.

I’m currently trying to change the color of the LED strip by saying the RGB values, but not quite there yet.

Well that’s it, thanks for the Blynk community for the awesome tutorials, it is always a great help.


#2

Will please explain total workflow?
Step by step coding procedure
Step by step circuit diagram connections
That would be helpful, i’m looking forward to implement this in my new house.


#3

@Sanket_Gangurde Welcome to Blynk. However, your first and only post is on a 1+ year old project and you start off by asking for everything laid out for you on a platter. Kinda goes against out forum pollices.

Please take some time to learn how blynk works, then you can build something on your own.

Documentation, Help Files and Example links are at the top of this page… scroll up to see them.


#4