Announcement

Collapse
No announcement yet.

Slave response header timeout errors using PES-2401 with PHPoC Blue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Slave response header timeout errors using PES-2401 with PHPoC Blue

    I've been trying to create a small program using a WebSocket to control 3 PES-2401 relay boards with the PHPoC blue and having issues.

    Everything runs fine for a few seconds or even minutes and then it errors.

    Output:
    spc_request: set 0 output low - 1/4 slave timeout
    spc_request: set 1 output low - 1/4 slave timeout
    spc_request: set 2 output low - 1/4 slave timeout
    spc_request: set 3 output low - 1/4 slave timeout
    spc_request: set 2 output high - 1/4 slave timeout

    Log:
    [0116:16:17:25.922] php: run next relay_control.php
    [0116:16:17:25.973] spc: start reset T1
    [0116:16:17:25.980] spc: start reset T2
    [0116:16:17:26.480] spc: reset completed
    [0116:16:17:26.480] spc: start sync T1
    [0116:16:17:26.484] spc: start sync T2
    [0116:16:17:26.582] spc: restart sync T2 <== This doesn't look right
    [0116:16:17:26.684] spc: restart sync T2 <==
    [0116:16:17:32.492] php start index.php RUN
    [0116:16:17:32.637] http_ws: http13 80 192.168.0.52 /relay csv.phpoc


    The initial setup in PHP is:

    <?php

    if(_SERVER("REQUEST_METHOD"))
    exit; // avoid php execution via http request

    include "/lib/sd_340.php";
    include "/lib/sn_tcp_ws.php";
    include "/lib/sd_spc.php";

    spc_reset();
    spc_sync_baud();
    $sid_one = 1;
    $sid_two = 2;
    $sid_three = 3;​


    When the error occurs the STS LED on the board stops blinking. I've tried swapping the boards around in the event I got a bad one but they all seem to do the same even with only two boards installed. Does anyone have any ideas? I initially thought wireless strength might be the issue but the signal is good and it looks like the PHPoC blue just stops talking to one or more of the relay boards since the STS LED goes dark.​​

    Thank you,

    Dave

  • #2
    Hi there,

    Seems like you are trying to control 3 x 4 = 12 relays at the same time, so the power supply is not enough for the job.
    You may try to supply power to PHPoC Blue via a 5V DC power adapter instead of USB.
    You can also verify this by sending request commands to the relays at different times (using some small random delays, etc.,).

    Cheers​

    Comment


    • #3
      Sorry that I posted this in the debugger heading. I tried to correct it but couldn't.

      I am using a 10A power supply direct to the PHPoC board and not USB power. I call the below function before enabling a relay so that all are turned off before energizing a new one. At most I only have two relays energized at the same time so I don't think it's a power issue.

      // Deactivate relays before enabling another
      function deactivate_relays() {
      for ($sidloop = 1; $sidloop <=2; $sidloop++) {
      usleep (250000);
      for ($relay = 0; $relay <=3; $relay++) {
      usleep (250000);
      spc_request_dev($sidloop, "set $relay output low");
      }
      }

      }​


      I just loaded a new program with just a scan of the hardware.

      <?php
      include "/lib/sd_spc.php";
      $count = 0;
      spc_reset();
      spc_sync_baud();
      $count = spc_scan(1, 14, true);
      echo "$count smart expansion baord(s) has(have) been detected!\r\n";
      ?>


      Log:
      [0117:12:36:35.688] spc: start reset T1
      [0117:12:36:35.699] spc: start reset T2
      [0117:12:36:36.199] spc: reset completed
      [0117:12:36:36.199] spc: start sync T1
      [0117:12:36:36.301] spc: start sync T2
      [0117:12:36:37.301] spc: restart sync T2
      [0117:12:36:38.301] spc: restart sync T2
      [0117:12:36:39.383] spc: slave response header timeout
      [0117:12:36:39.414] spc: slave response header timeout
      [0117:12:36:39.445] spc: slave response header timeout
      [0117:12:36:39.477] spc: slave response header timeout
      [0117:12:36:39.508] spc: slave response header timeout
      [0117:12:36:39.543] spc: slave response header timeout
      [0117:12:36:39.574] spc: slave response header timeout
      [0117:12:36:39.605] spc: slave response header timeout
      [0117:12:36:39.637] spc: slave response header timeout
      [0117:12:36:39.668] spc: slave response header timeout
      [0117:12:36:39.699] spc: slave response header timeout
      [0117:12:36:39.730] spc: slave response header timeout​

      ​Output:
      sid01: PES-2401 780c0b0d1805
      sid02: PES-2401 780c0b0d1e19
      2 smart expansion baord(s) has(have) been detected!​
      Last edited by kdcarlso; 01-18-2023, 02:40 AM.

      Comment


      • #4
        Hello,

        PHPoC Blue works well with DC 5V (±0.5V) - 1.5A from the DC jack. It is recommended to choose the power supply accordingly.
        Make sure you set the SIDs correctly, and that all the hardware parts are stably connected.

        Is there any problem when you use only one PES-2401 board?
        I think we can step by step rule out the possible reason by verifying this.

        Cheers

        Comment


        • #5
          I confirmed that the power supply is at 5.2V and does not fluctuate under load. I even tried another bench power supply to to make sure. I tried using only one board at a time and verified the issue with each one so I think it's safe to say it is not a bad relay board. Addressing is correct and the code will initiate the relays but then stops working.

          I tried the following. With only one board connected and running just the scan code:

          <?php
          include "/lib/sd_spc.php";
          $count = 0;
          spc_reset();
          spc_sync_baud();
          $count = spc_scan(1, 14, true);
          echo "$count smart expansion baord(s) has(have) been detected!\r\n";
          ?>


          Output:
          sid01: PES-2401 780c0b0d1032
          1 smart expansion baord(s) has(have) been detected!


          Log:
          [0118:09:59:02.348] php start init.php RUN
          [0118:09:59:02.348] php: run next scan_boards.php
          [0118:09:59:02.359] spc: start reset T1
          [0118:09:59:02.367] spc: start reset T2
          [0118:09:59:02.867] spc: reset completed
          [0118:09:59:02.871] spc: start sync T1
          [0118:09:59:02.871] spc: start sync T2
          [0118:09:59:02.969] spc: restart sync T2
          [0118:09:59:03.070] spc: restart sync T2
          [0118:09:59:03.219] spc: slave response header timeout
          [0118:09:59:03.250] spc: slave response header timeout
          [0118:09:59:03.281] spc: slave response header timeout
          [0118:09:59:03.313] spc: slave response header timeout
          [0118:09:59:03.344] spc: slave response header timeout
          [0118:09:59:03.379] spc: slave response header timeout
          [0118:09:59:03.410] spc: slave response header timeout
          [0118:09:59:03.441] spc: slave response header timeout
          [0118:09:59:03.473] spc: slave response header timeout
          [0118:09:59:03.504] spc: slave response header timeout
          [0118:09:59:03.535] spc: slave response header timeout
          [0118:09:59:03.566] spc: slave response header timeout
          [0118:09:59:03.598] spc: slave response header timeout

          I have tried all three relay boards and get the same result. What is T2? Whatever it is might be the issue since it has to try to sync three times...

          Even with no relay board connected I see the following in the log.

          [0118:10:18:44.168] php start init.php RUN
          [0118:10:18:44.168] php: run next relay_control.php
          [0118:10:18:44.215] spc: start reset T1
          [0118:10:18:44.227] spc: start reset T2
          [0118:10:18:44.727] spc: reset completed
          [0118:10:18:44.727] spc: start sync T1
          [0118:10:18:44.727] spc: start sync T2
          [0118:10:18:44.828] spc: restart sync T2
          [0118:10:18:44.926] spc: restart sync T2​​

          Comment


          • #6
            Hello, could you please check if there is not ID conflict among all of expansion boards? Or show a picture of the expansion board ID you set?

            Comment


            • #7
              I am currently using just the one board and still having the issue. What is T1 and T2 and why does T2 re-sync even with no add on boards attached?
              Attached are photos of the relay boards

              Comment

              Working...
              X