Viewing 11 reply threads
  • Author
    Posts
    • #4545
      Dirk SchäferDirk Schäfer
      Participant

      Hi everybody,

      I managed to set up the MTC4BT successfully for the three different kinds of configurations of my locos:
      1. one PU-Hub with one motor
      2. one PU-Hub with two motors
      3. two PU-Hubs, each with one motor

      I started to try the lights on the third configuration, but nothing happens (neither automatic light during driving nor manual light by Rocrail functions). The serial monitor of VSC gives the following message when the F0 button is clicked:
      “[1] MQTT: Received ‘fn’ command’ but couldn’t read ‘fnchangedstate’ attribute.”

      Below is the controller_config.json I am using at the moment. I have tried to delete the “espPins” and “fn” sections, but this had no effect. What am I missing?

      Thanks for your help.

      Kind regards
      Dirk

      {
      “name”: “MTC4BT_60052”,
      “espPins”: [
      {
      “pin”: 5,
      “inverted”: false,
      “attachedDevice”: “light”
      },
      {
      “pin”: 23,
      “inverted”: false,
      “attachedDevice”: “light”
      }
      ],
      “fn”: [
      {
      “name”: “status”,
      “device”: “espPin”,
      “pin”: 23
      }
      ],
      “locos”: [
      {
      “address”: 16052,
      “name”: “L60052”,
      “speedStep”: 10,
      “brakeStep”: 20,
      “bleHubs”: [
      {
      “type”: “PU”,
      “address”: “90:84:2b:03:45:0b”,
      “channels”: [
      {
      “channel”: “A”,
      “attachedDevice”: “motor”,
      “direction”: “forward”
      },
      {
      “channel”: “B”,
      “attachedDevice”: “light”,
      “direction”: “forward”
      }
      ]
      },
      {

      “type”: “PU”,
      “address”: “90:84:2b:15:f3:94”,
      “channels”: [
      {
      “channel”: “A”,
      “attachedDevice”: “motor”,
      “direction”: “reward”
      },
      {
      “channel”: “B”,
      “attachedDevice”: “light”,
      “direction”: “forward”
      }
      ]
      }
      ],
      “fn”: [
      {
      “name”: “f0”,
      “device”: “bleHub”,
      “address”: “90:84:2b:03:45:0b”,
      “channel”: “B”
      },
      {
      “name”: “f1”,
      “device”: “bleHub”,
      “address”: “90:84:2b:15:f3:94”,
      “channel”: “B”
      }
      ]
      }
      ]
      }

    • #4647
      Raymond BrinkRay
      Keymaster

      Hi Dirk,

      Nice to hear you have trains running on MTC4BT! Have you uploaded this configuration to the controller and tested it? The second PU has a bad direction value for channel A. It says “reward” where you probably mean “reverse”? It will probably have the effect that that motor runs in “forward” mode, as that’s the default.

      Other than that your config itself looks fine. And obviously that doesn’t resolve the lights issue. I need to look into that some more.

    • #4648
      Dirk SchäferDirk Schäfer
      Participant

      Hi Raymond,

      thank you for your answer.

      Yes, I uploaded and tested the configuration and it worked well for the motors (both engines running in the same direction). But your right, it should be “reverse” and not “reward”. I think I mixed this up during the testing. I will correct that in the config file and check what happens.

      Meanwhile, I tested it for onl one locomotive with PU and one motor and one light, but the result was the same. Do I have to configure something other than the address of the locomotive in ROCRAIL?

    • #4649
      Raymond BrinkRay
      Keymaster

      There is nothing else to configure in Rocrail for functions to work, accept for the loco address.

    • #4678
      Dirk SchäferDirk Schäfer
      Participant

      Hi everybody,

      in the meantime I tried another ESP32 I previously used as a MTC4PU (AZDelivery ESP32 NodeMCU Module WLAN WiFi Dev Kit C) and programmed it with the MTC4BT firmware and the config-file above including the correct direction. The result was the same as before (motors running, but no light).

      Then I connected the ESP32 to my standard power supply (5V, 3A) and connected two LEDs to pins 0 and 23. Pin 23 is already assigned to the status LED in the config file. Additionally, I assigned pin 0 of the ESP32 to function F3 and I changed the functions of the lights of the PU-Hubs to F1 and F2. This means that functions F1, F2 and F3 are assigned. This resulted in the following:

      1. With functions F1 and F2 the lights attached to the PU Hubs can be activated manually.
      2. No lights are activated while driving.
      3. Activating function F3 has no effect on the LED at ESP-Pin 0.
      4. When I accidentially activated function F0 the following message in the serial monitor appeared:
      “[1] MQTT: Received ‘fn’ command’ but couldn’t read ‘fnchangedstate’ attribute.”

      This is a progress as I can now activate the lights on the trains and the problem is reduced to the function F0 and the autolights while driving.

      May the fact that I am using an older version of ROCRAIL server (v2.1.1332 of January 2021) have an effect on this?

      Kind regards,
      Dirk

    • #4694
      Raymond BrinkRay
      Keymaster

      Hi Dirk,

      I don’t think the ESP or the Rocrail version has anything to do with it. Last night I found a bug in de code that stopped f0 from working when assigned to a light on a hub. You already verified f1 (or higher) does work, right? If so, this bug (f0 not working) will be fixed with the next release of the firmware.

      Cheers,
      Ray

      • This reply was modified 2 years, 3 months ago by Raymond BrinkRay.
    • #4701
      Dirk SchäferDirk Schäfer
      Participant

      Hi Ray,

      that sounds great. Thank you.

      Yes, f1 or higher works. It is f0 and autolights while driving that are not working. I tested it with several AZDelivery ESP32 NodeMCUs and three different PU hubs where the result was always the same.

      Cheers,
      Ray

    • #4702
      Raymond BrinkRay
      Keymaster

      We do know auto-lights is not working. That’s a known issue we hope to fix in the next firmware release as well.

    • #6257
      R. v/d MeulenR. v/d Meulen
      Participant

      Hello everbody,

      I have a problem with the lights of the trains. Light are not working, while using the latest firmware version. Train motors are working well. Trying to use the functions in rocrail for the lights of the train, but aren’t responding. What could be the problem while the lights are configured and also the f2 function is configured for the lights. Is this related with the settings in rocrail or something else. Thanks in advance if someone could help me with it.

      R. v/d Meulen

      Here is a part of my controller_config.json file.
      {
      “name”: “MTC4BT_1”,
      “locos”: [{
      “address”: 1,
      “name”: “OrangePasFront”,
      “bleHubs”: [{
      “type”: “SBrick”,
      “address”: “d0:cf:5e:52:be:3b”,
      “channels”: [{
      “channel”: “A”,
      “attachedDevice”: “motor”,
      “direction”: “forward”
      },
      {
      “channel”: “B”,
      “attachedDevice”: “motor”,
      “direction”: “forward”
      },
      {
      “channel”: “C”,
      “attachedDevice”: “light”
      }
      ]
      }
      ]
      },
      {
      “address”: 2,
      “name”: “OrangePasBack”,
      “bleHubs”: [{
      “type”: “SBrick”,
      “address”: “d0:cf:5e:53:99:e0”,
      “channels”: [{
      “channel”: “A”,
      “attachedDevice”: “motor”,
      “direction”: “backward”
      },
      {
      “channel”: “B”,
      “attachedDevice”: “motor”,
      “direction”: “backward”
      },
      {
      “channel”: “C”,
      “ättachedDdevice”: “light”
      }
      ]
      }],
      “fn”: [{
      “name”: “f2”,
      “device”: “bleHub”,
      “address”: “d0:cf:5e:53:99:e0”,
      “channel”: “C”
      }]
      },
      {
      “address”: 3,
      “name”: “GreenPasFront”,
      “bleHubs”: [{
      “type”: “SBrick”,
      “address”: “68:0a:e2:af:1b:8d”,
      “channels”: [{
      “channel”: “B”,
      “attachedDevice”: “motor”,
      “direction”: “forward”
      },
      {
      “channel”: “C”,
      “attachedDevice”: “light”,
      “direction”: “forward”
      }
      ]
      }]

      },
      {
      “address”: 4,
      “name”: “GreenPasBack”,
      “bleHubs”: [{
      “type”: “SBrick”,
      “address”: “d0:cf:5e:52:b7:f9”,
      “channels”: [{
      “channel”: “B”,
      “attachedDevice”: “motor”,
      “direction”: “backward”
      },
      {
      “channel”: “D”,
      “attachedDevice”: “light”,
      “direction”: “forward”
      }
      ]
      }]

      },
      {
      “address”: 5,
      “name”: “Maersk”,
      “bleHubs”: [{
      “type”: “SBrick”,
      “address”: “d0:cf:5e:52:be:70”,
      “channels”: [{
      “channel”: “A”,
      “attachedDevice”: “motor”,
      “direction”: “forward”
      },
      {
      “channel”: “C”,
      “attachedDevice”: “motor”,
      “direction”: “backward”
      }
      ]
      }]

      }
      ]
      }

    • #6258
      Raymond BrinkRay
      Keymaster

      Hi R. v/d Meulen,

      With the latest MTC4BT firmware the direct fn function configuration is no longer supported. You should use the new and more flexible event driven configuration. You can check the options and syntax here:

      MattzoTrainController for Bluetooth (MTC4BT)

      Cheers,
      Raymond

    • #6278
      R. v/d MeulenR. v/d Meulen
      Participant

      Hello everbody, I tried to use the the new configuration for the trains including lights. I have put all the information in the controller config file and the lights are working. After exceeding the 4k limit for the files. I tried to put the loco configuration in different files. Controller.config file look like this: {
      “name”: “MTC4BT_1”,
      “pwrIncStep”:10,
      “pwrDecStep”:10,
      “locoConfigs”: [
      “/loco_HEFront.json”
      ]
      }

      And the loco_HEFront file like this:

      {
      “address”:1,
      “name”: “OrangePasFront”,
      “bleHubs”: [
      {
      “type”: “SBrick”,
      “address”: “d0:cf:5e:52:be:3b”,
      “channels”: [
      {
      “channel”: “A”,
      “attachedDevice”: “motor”,
      “direction”: “forward”
      },
      {
      “channel”: “B”,
      “attachedDevice”: “motor”,
      “direction”: “forward”
      },
      {
      “channel”: “C”,
      “attachedDevice”: “light”,
      “direction”: “forward”
      }
      ]
      }],
      “events”: [
      {
      “triggers”: [
      {
      “source”: “rr”,
      “eventType”: “fnchanged”,
      “identifier”: “f1”,
      “value”: “on”
      },
      {
      “source”: “loco”,
      “eventType”: “dirchanged”,
      “value”: “forward”
      },
      {
      “source”: “loco”,
      “eventType”: “dirchanged”,
      “value”: “backward”
      }
      ],
      “actions”: [
      {
      “channel”: “C”,
      “pwrPerc”: 80
      }
      ]
      },
      {
      “triggers”: [
      {
      “source”: “rr”,
      “eventType”: “fnchanged”,
      “identifier”: “f1”,
      “value”: “off”
      },
      {
      “source”: “loco”,
      “eventType”: “dirchanged”,
      “value”: “stopped”
      }
      ],
      “actions”: [
      {
      “channel”: “C”,
      “pwrPerc”: 0
      }
      ]
      }
      ]
      }

      After installing the files on the esp32. I get the message that 0 locos have been discovered. What am I missing?

      R. v/d Meulen

      • #6279
        Raymond BrinkRay
        Keymaster

        Hi R. v/d Meulen,

        Your config files look valid by me, so I’m thinking that’s not the issue.

        At controller startup a message is displayed stating:
        Setup: Number of locos to discover hubs for: 3

        In this case the controller has found three loco’s in the (combined) controller configuration files.
        What does your controller output to serial/logging at startup?

        Cheers,
        Ray

    • #6280
      R. v/d MeulenR. v/d Meulen
      Participant

      The output is as follows:
      1] Setup: Starting MattzoTrainController for BLE…
      [1] Setup: Loading network configuration…
      Syslog: Server:
      Syslog: Hostname: MTC4BT_1
      Syslog: Appname: MTC4BT_1
      [0000] [1] Logging: Configured.
      [0001] [1] Setup: Loading controller configuration…
      [0002] [1] Config: Read controller name: MTC4BT_1
      [0003] [1] Config: Read ESP pin configuration (0).
      [0004] [1] Config: Read loco configuration (0).
      [0005] [1] CTRL: Local channels initialized.
      [0006] [1] Setup: Initializing BLE…
      [0007] [1] Setup: Controller configuration completed.
      E (3390) wifi_init_default: netstack cb reg failed with 12289
      [1] Wifi: Connecting [1] MQTT: Connecting to
      [0009] [1] Setup: MattzoTrainController for BLE running.
      [0010] [1] Setup: Number of locos to discover hubs for: 0
      [0011] [1] Minutes uptime: 0.00
      [0012] [1] Messages in queue: 0
      [0013] [1] Memory Heap free: 129472 max alloc: 108532 min free: 129048
      [0014] [1] Ticker started
      [0015] [0] Wifi: Connected
      [0016] [0] OTA: Initialized.
      [0017] [0] MQTT: Subscriber configuring last will…
      [ 2626][E][WiFiUdp.cpp:183] endPacket(): could not send data: 12

      It seems that sonmthing goes wrong with the wifi connection.

      Kind regards,

      R. v/d Meulen

Viewing 11 reply threads
  • You must be logged in to reply to this topic.