Results 1 to 4 of 4

Thread: NodeMcu 12E - 12 canaux digitaux

  1. #1
    Join Date
    Dec 2019
    Location
    Switzerland, Bern region
    Posts
    4
    Post Thanks / Like

    Default NodeMcu 12E - 12 canaux digitaux

    Afin d'organiser mes show de manière regionale (zones), de nécessiter un minimum de câblage et d'être flexible pour changer facilement d'emplacements, j'ai voulu obtenir le maximum de canaux avec le NodeMCU 12 E.
    J'ai pu obtenir 12 canaux digitaux, dont la plupart peuvent être utilisé en PWM.
    Il s'agit des PIN D0 - D8; RX et TX; et SDD 3.

    Le sketch ARDUINO se base sur le programme proposé èpar Barnabybear dans le post 5 " Potential E1.31 / WiFi mod for dumb strips & floods "
    Code:

    // NodeMCU 12E E1.31 - 12 canaux digitaux.
    // Sur la base du sketch développé par Barnabybear

    #include <ESP8266WiFi.h>
    #include <E131.h> // Copyright (c) 2015 Shelby Merrick http://www.forkineye.com
    static const uint8_t D12 = 10; // transforms SDD3 into GPIO D12

    // ***** USER SETUP STUFF *****
    const char ssid[] = "SSID"; // replace with your SSID.
    const char passphrase[] = "PASSWORD"; // replace with your PASSWORD.
    const int universe = 1; // this sets the universe number you are using (multicast).

    // this sets the channel number used by the output.
    const int channel_1 = 1; // the channel number to link to output 1
    const int channel_2 = 2; // the channel number to link to output 2
    const int channel_3 = 3; // the channel number to link to output 3
    const int channel_4 = 4; // the channel number to link to output 4
    const int channel_5 = 5; // the channel number to link to output 5
    const int channel_6 = 6; // the channel number to link to output 6
    const int channel_7 = 7; // the channel number to link to output 7
    const int channel_8 = 8; // the channel number to link to output 8
    const int channel_9 = 9; // the channel number to link to output 9
    const int channel_10 = 10; // the channel number to link to output 10
    const int channel_11 = 11; // the channel number to link to output 11
    const int channel_12 = 12; // the channel number to link to output 12

    // this sets the pin numbers to use as outputs.
    const int output_1 = D0; // the pin to use as output D0
    const int output_2 = D1; // the pin to use as output D1
    const int output_3 = D2; // the pin to use as output D2
    const int output_4 = D3; // the pin to use as output D3
    const int output_5 = D4; // the pin to use as output D4
    const int output_6 = D5; // the pin to use as output D5
    const int output_7 = D6; // the pin to use as output D6
    const int output_8 = D7; // the pin to use as output D7
    const int output_9 = D8; // the pin to use as output D8
    const int output_10 = 3; // the pin to use as output D9 (RX)
    const int output_11 = 1; // the pin to use as output D10 (TX)
    const int output_12 = D12; // the pin to use as output D12 (SDD3)

    E131 e131;

    void setup() {
    //********** CHANGE PIN FUNCTION TO GPIO **********
    //GPIO 1 (TX) swap the pin to a GPIO.
    pinMode(1, FUNCTION_3);
    //GPIO 3 (RX) swap the pin to a GPIO.
    pinMode(3, FUNCTION_3);
    //**************************************************
    // Serial.begin(115200);

    // set the pins chosen above as outputs.
    pinMode(output_1, OUTPUT);
    pinMode(output_2, OUTPUT);
    pinMode(output_3, OUTPUT);
    pinMode(output_4, OUTPUT);
    pinMode(output_5, OUTPUT);
    pinMode(output_6, OUTPUT);
    pinMode(output_7, OUTPUT);
    pinMode(output_8, OUTPUT);
    pinMode(output_9, OUTPUT);
    pinMode(output_10, OUTPUT);
    pinMode(output_11, OUTPUT);
    pinMode(output_12, OUTPUT);

    // set the pins chosen above to low / off.

    digitalWrite(output_1, 0);
    digitalWrite(output_2, 0);
    digitalWrite(output_3, 0);
    digitalWrite(output_4, 0);
    digitalWrite(output_5, 0);
    digitalWrite(output_6, 0);
    digitalWrite(output_7, 0);
    digitalWrite(output_8, 0);
    digitalWrite(output_9, 0);
    digitalWrite(output_10, 0);
    digitalWrite(output_11, 0);
    digitalWrite(output_12, 0);

    /* Choose one to begin listening for E1.31 data */
    e131.begin(ssid, passphrase); /* via Unicast on the default port */
    //e131.beginMulticast(ssid, passphrase, universe); /* via Multicast for Universe 1 */
    }

    void loop() {
    /* Parse a packet */
    uint16_t num_channels = e131.parsePacket();

    /* Process channel data if we have it */
    if (num_channels) {
    // set the outputs to the data value.
    digitalWrite(output_1, e131.data[channel_1 -1] );
    digitalWrite(output_2, e131.data[channel_2 -1] );
    digitalWrite(output_3, e131.data[channel_3 -1] );
    digitalWrite(output_4, e131.data[channel_4 -1] );
    digitalWrite(output_5, e131.data[channel_5 -1] );
    digitalWrite(output_6, e131.data[channel_6 -1] );
    digitalWrite(output_7, e131.data[channel_7 -1] );
    digitalWrite(output_8, e131.data[channel_8 -1] );
    digitalWrite(output_9, e131.data[channel_9 -1] );
    digitalWrite(output_10, e131.data[channel_10 -1] );
    digitalWrite(output_11, e131.data[channel_11 -1] );
    digitalWrite(output_12, e131.data[channel_12 -1] );

    }
    }
    Attached Images Attached Images
    Last edited by blackbird.0360; 10-18-2020 at 01:19 PM.

  2. #2
    Join Date
    Dec 2019
    Location
    Switzerland, Bern region
    Posts
    4
    Post Thanks / Like

    Default Re: NodeMcu 12E - 12 canaux digitaux

    Pour l'interface, j'ai simplement développé une petite carte avec deux ULN 2803; ce qui rend le montage assez universel (compatible pour des sorties digitales mais aussi pour des sorties PWM). le circuit ULN 2803 permet un courant de 0,5 A sous une tension adaptée aux besoins.

    PCB_Nodemcu.JPG

    Le circuit est dessiné avec Kicad et je le mets volontiers à disposition si quelqu'un en a besoin.

  3. #3
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    1,451
    Post Thanks / Like

    Default Re: NodeMcu 12E - 12 canaux digitaux

    Are you documenting a build? Looks like 12 output on/off low current output relay board of some sort?

  4. #4
    Join Date
    Dec 2019
    Location
    Switzerland, Bern region
    Posts
    4
    Post Thanks / Like

    Default Re: NodeMcu 12E - 12 canaux digitaux

    Bonjour Mikekrebs,
    en fait, si vous connaissez les circuits ULN2803, vous comprenez tout de suite la flexibilité de ce montage très simple car ses sorties peuvent directement piloter des relais, des SSR ou même des bandes RGB (dum ou PWM). chaque sortie est limité à 0,5 A.
    Je joins le schema de la carte. Il est difficile de faire plus simple.

    Schema.JPG

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •