Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: wireless SSR?

  1. #11
    Join Date
    Dec 2011
    Location
    Dubois, PA
    Posts
    200
    Post Thanks / Like

    Default Re: wireless SSR?

    I think my best option is to buy a few Renard SS24's and run them wireless with a PI3
    2015 - (4) E6804's, (2) E6802's, (2) Renard 64's all loaded with blinky flashies

  2. #12
    Join Date
    Dec 2011
    Location
    Northern California
    Posts
    1,060
    Post Thanks / Like

    Default Re: wireless SSR?

    Quote Originally Posted by Barnabybear View Post
    Hi, it should be possible to use an ESP to switch a few channels, the fun bit is doing it without interrupts and not missing the new packet or the zero cross pulse.... I don't have a H11A1 on the bench so I'll have to simulate the high pulse this with another device. Can someone confirm the real world spec for this pulse please. I’ll work on 100uS until this is confirmed.
    I would like to hear more about your thought on this, perhaps in another thread so as not to hijack this one. There seem to be several challenges in doing this without a hardware timer and with interrupt limitations - while needing to yield() frequently enough and for long enough to keep the wireless stack happy, and fetching/interpreting received packets.

  3. #13
    Join Date
    Dec 2011
    Location
    UK S80 postcode
    Posts
    1,411
    Post Thanks / Like

    Default Re: wireless SSR?

    Hi, mainly @ Zeph but feel free to comment. @ dstokesdubois, if this is distracting from the thread I'm happy to move it and just leave a link.

    I got a couple of hours this evening to have a play and this looks very possible. I’ve posted my first attempt development code below which went far better than I had expected. It captures the E1.31 packets, triggers on a simulated zero cross signal and combines the two to generate output triggers for triacs.

    Problems / to-dos:
    Some of the timing needs adjusting but mainly because it wasn’t worth doing until the next problem is sorted.

    The e1.31.parsePacket needs speeding up or splitting up as causes a 1mS delay in the output when a packet arrives. This means that a 255 high output to the triac which should last about 8mS only lasts 7mS, more like a 223. At 40FPS or 25mS timing this means you end up with 223, 255, 255, 223, 255, 255 instead of 255,255,255,255,255,255. TBH I’m not sure this would be noticeable to most people as it’s at the high end of the light output where it has least visual impact. If I can’t improve the speed and this is noticeable I can always apply a derating so the maximum is 223, this would result in a 12% reduction in light output (compared to maximum), but given various post where people have commented that they can reduce the output to nearly 50% without noticing a difference it shouldn’t be a problem. It would only really affect floods.

    Anyway below: Screen grab of four outputs (255 value) with an RGB chase input. Screen grab of the 1mS delay when we parsePacket. The first attempt at code.
    AC_SSR_dev1_1.jpg
    AC_SSR_dev1_2.jpg
    Code:
    #include <ESP8266WiFi.h>
    #include <E131.h>
    
    // set the pin numbers of the in / outputs
    int output_1 = 12; // pin number of output 1 to triac
    int output_2 = 13; // pin number of output 2 to triac
    int output_3 = 14; // pin number of output 3 to triac
    int output_4 = 15; // pin number of output 4 to triac
    int input_zc = 4; // pin number of zero cross input
    
    // variables for the DMX value
    int channel_value_1;
    int channel_value_2;
    int channel_value_3;
    int channel_value_4;
    
    // general variables
    long int num_channels; // number of E1.31 values in packet
    int loop_number; // keeps track of number of times looped
    unsigned int step_ends; // single loop timer
    unsigned int step_delay = 30; // delay for 60Hz
    
    // E1.31 setup
    const char ssid[] = "<YOUR_SSID>"; // AP SSID
    const char passphrase[] = "<YOUR_PASSWORD>"; // AP password
    const int universe = 1; // universe number
    const int channel = 0; // start channel
    E131 e131;
    
    void setup() {
    // set the function & state of the in / output pins
      pinMode(input_zc, INPUT); // set pin as output
      pinMode(output_1, OUTPUT); // set pin as output
      pinMode(output_2, OUTPUT); // set pin as output
      pinMode(output_3, OUTPUT); // set pin as output
      pinMode(output_4, OUTPUT); // set pin as output
      digitalWrite(output_1, LOW);  // set output low / off
      digitalWrite(output_2, LOW);  // set output low / off
      digitalWrite(output_3, LOW);  // set output low / off
      digitalWrite(output_4, LOW);  // set output low / off
      // select unicast or multicast - one must be commented out
      //e131.begin(ssid, passphrase); // unicast 
      e131.beginMulticast(ssid, passphrase, universe); // multicast 
    }
    
    void loop() {
      while (digitalRead(input_zc) == 0) { // loop untill zero cross
        step_ends = micros(); // time in micros now
      }
         num_channels = e131.parsePacket();
      if (num_channels) {
        channel_value_1 = (e131.data[channel + 0]);
        channel_value_2 = (e131.data[channel + 1]);
        channel_value_3 = (e131.data[channel + 2]);
        channel_value_4 = (e131.data[channel + 3]);
      }
    
      do {
        // switch on output / triac if we have waited long enough
        if (loop_number == channel_value_1)
          digitalWrite(output_1, HIGH);   // set output high / on
        if (loop_number == channel_value_2)
          digitalWrite(output_2, HIGH);   // set output high / on
        if (loop_number == channel_value_3)
          digitalWrite(output_3, HIGH);   // set output high / on
        if (loop_number == channel_value_4)
          digitalWrite(output_4, HIGH);   // set output high / on
    
        step_ends += step_delay;          // add delay to time to get end time
        while (micros() < step_ends);     // check time now against end time & wait
        loop_number--;                    // reduce loop counter by 1
      } while (loop_number > 10);         // 'do' it all again unless ==0
    
      digitalWrite(output_1, LOW);        // set output low / off
      digitalWrite(output_2, LOW);        // set output low / off
      digitalWrite(output_3, LOW);        // set output low / off
      digitalWrite(output_4, LOW);        // set output low / off
      loop_number = 255;                  // start value for loop counter
    }
    Last edited by Barnabybear; 02-01-2017 at 03:23 AM.

  4. #14
    Join Date
    Dec 2010
    Location
    Griswold, Connecticut
    Posts
    307
    Post Thanks / Like

    Default Re: wireless SSR?

    @Barnabybear Sounds promising, looking forward to your results.


    Sent from my iPad using Tapatalk

Page 2 of 2 FirstFirst 12

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
  •