logo elektroda
logo elektroda
X
logo elektroda

How to integrate ESP32 with WS2812b controlling via WIFI, BT and touch + DS18b20?

qwerty411 645 5
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17821576
    qwerty411
    Level 2  
    Hello Friends!
    I've made myself some balcony lights based on WS2812b (300 pcs), controlled by Arduino nano, coding for FASTLED, and everything is working fine. However, I would like to expand on this a little, namely:
    1. control via ESP32
    2. Bluetoth with a smartphone for changing effects and switching
    3) WIFI from a desktop computer for the same functions.
    4. if ESP32, I would like to use the possibility of touch "keys" for manual control
    5. temperature measurement (DS18b20 ?) (why!!!)
    What I am asking you and what doubts I have ? ( my knowledge rather poor):
    I mean a kind of "roadmap" and determination of feasibility.
    1 . Will the use of the above functionalities not block the transmission to the leds (interrupts!), because this must be very fast (SPI?)?
    2 . can I configure WIFI access via Bluetoth?
    3. so technically: do I have to "extinguish" the touch keys with capacitors.

    I am very much counting on your help . At the same time please take my little knowledge :) ))
    Greetings

    The code I am using:

    #include "FastLED.h"
    #define LED_COUNT 300
    #define LED_PIN 11
    struct CRGB leds[LED_COUNT];
    //================================================

    uint8_t hue = 32;
    byte idex = 255;
    byte meteorLength = 47;

    void setup() {

    delay(2000);
    LEDS.addLeds<WS2812, LED_PIN, GBR>(leds, LED_COUNT);
    LEDS.setBrightness(250);
    }

    void loop(){

    meteorShower();
    }

    void meteorShower(){

    memmove8( &leds[1], &leds[0], (LED_COUNT - 1) * 3 );


    idex++;

    if ( idex > meteorLength ) {
    idex = 0;

    hue += 34;
    }

    /
    switch ( idex ) {
    case 0:
    leds[0] = CRGB(200,200,200);
    break;
    case 1:
    leds[0] = CHSV((hue - 15), 255,180);
    break;
    case 2:
    leds[0] = CHSV((hue - 18), 255, 170);
    break;
    case 3:
    leds[0] = CHSV((hue - 20), 255, 160);
    break;
    case 4:
    leds[0] = CHSV((hue - 22), 255, 150);
    break;
    case 5:
    leds[0] = CHSV((hue - 24), 255, 140);
    break;
    case 6:
    leds[0] = CHSV((hue - 29), 160, 130);
    break;
    case 7:
    leds[0] = CHSV((hue - 30), 140, 120);
    break;
    case 8:
    leds[0] = CHSV((hue - 31), 120, 110);
    break;
    case 9:
    leds[0] = CHSV((hue - 32), 100, 100);
    break;
    case 10:
    leds[0] = CHSV((hue - 33), 90, 90);
    break;
    case 11:
    leds[0] = CHSV((hue - 34), 80, 80);
    break;
    case 12:
    leds[0] = CHSV((hue - 35), 70, 70);
    break;
    case 13:
    leds[0] = CHSV((hue - 36), 60, 60);
    break;
    case 14:
    leds[0] = CHSV((hue - 34), 50, 50);
    break;
    case 15:
    leds[0] = CHSV((hue - 35), 40, 40);
    break;
    default:
    leds[0] = CRGB::Black;
    }


    FastLED.show();

    delay(60);
    }
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • #2 17821668
    piterek-23
    Level 33  
    When inserting the code, use the tags "SYNTAX"
  • ADVERTISEMENT
  • #3 17821680
    qwerty411
    Level 2  
    I actually put the code in the wrong way . I will correct myself :) ))))
  • ADVERTISEMENT
  • #4 17821691
    xury
    Automation specialist
    1. the ESP32 has two cores. You can flip some of the tasks to the second core. I haven't done this myself yet, but I've seen that it can be done.
    2. if you write for yourself. You'll have that.
    3) I don't know, I haven't done it.
  • ADVERTISEMENT
  • #5 17822169
    khoam
    Level 42  
    qwerty411 wrote:
    1 . Will not the use of the above functionalities block the transmission to the leds (interrupts!), because this one must be very fast (SPI?)?
    2. can I configure WIFI access via Bluetoth?
    3. so technically: do I have to "extinguish" the touch keys with capacitors.
    .

    1. the WiFi and IP stack handling tasks are performed on one core of the ESP32, your program will run on the other, so there should be no problem, as long as you don't force your own tasks to run on two cores (this is possible). Interrupt handling executes independently in both cores.

    And as for the SPI handling itself (with or without DMA) there is information about it here .

    2 And how do you conceptualise this? Theoretically, once you have created a BT connection to the ESP32, you can run the WiFi login routines. However, such a mechanism you would have to write yourself.

    3. it depends on the specific ones you have, usually you don't need to do this - I have ones, for example, where the built-in electronics already take care of this.
  • #6 17822254
    LChucki
    Level 31  
    a55f488888ba Wouldn't the use of the above functionalities result in blocking the transmission to the leds (interrupts!), as this must be very fast (SPI?)?
    .
    Use DMA.
  • ADVERTISEMENT