Welcome to MattzoBricks Forums MattzoTrainController for Bluetooth (MTC4BT) Cannot find ControllerID in new MTC4BT

Viewing 8 reply threads
  • Author
    Posts
    • #7815
      Dave GDave G
      Participant

      Hi all,

      Now the layout is finished, hoping to progress onto automatic trains powered via MTC4BT rather than manual only driving. I have an AZ Dev4 board and followed the instructions on the main webpage but cannot locate a ControllerID in serial monitors in VS. Comparing to the examples on the website, it’s almost as if there is a line missing to show the ControllerID which I presume I need to address the locos correctly in Rocrail. Here is my serial output currently:

      — More details at https://bit.ly/pio-monitor-filters
      — Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
      ets Jul 29 2019 12:21:46

      rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
      configsip: 0, SPIWP:0xee
      clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
      mode:DIO, clock div:2
      load:0x3fff0030,len:1184
      load:0x40078000,len:13192
      load:0x40080400,len:3028
      entry 0x400805e4

      [1] Setup: Starting MattzoTrainController for BLE…
      [1] Setup: Loading network configuration…
      Syslog: Server: 192.168.1.100:514
      Syslog: Hostname: mtc4bt
      Syslog: Appname: MTC4BT
      [0000] [1] Logging: Configured.
      [0001] [1] Setup: Loading controller configuration…
      Config: Failed to read config file: deserializeJson() failed with code InvalidInput
      [0002] [1] Config: Read controller name: Test 3
      [0003] [1] Config: Read ESP pin configuration (2).
      [0004] [1] CTRL: Local channels initialized.
      [0005] [1] Setup: Initializing BLE…
      [0006] [1] Setup: Controller configuration completed.
      E (3453) wifi_init_default: netstack cb reg failed with 12289
      [0007] [0] BLE : Scanning for 1 hub(s)…
      [1] Wifi: Connecting to GC.[0008] [0] BLE : Discovered unknown device: (38:e9:26:88:aa:c4).
      ….[0009] [0] BLE : Scanning for 1 hub(s) aborted.
      ..
      [0010] [1] MQTT: Connecting to 192.168.1.100:1883…
      [0011] [1] Setup: MattzoTrainController for BLE running.
      [0012] [1] Setup: Number of locos to discover hubs for: 1
      [0013] [0] MQTT: Subscriber configuring last will…
      [0014] [1] Setup: Number of locos to discover hubs for: 1
      [0015] [0] MQTT: Subscriber attempting to connect…
      [0016] [0] MQTT: Subscriber connected
      [0017] [0] MQTT: Subscriber subscribed to topic ‘rocrail/service/command’
      [0018] [0] BLE : Scanning for 1 hub(s)…
      [0019] [0] BLE : Scanning for 1 hub(s) aborted.
      [0020] [0] BLE : Discovered hub: (90:84:2b:03:fb:14).
      [0021] [0] BLE : Scanning for 1 hub(s) aborted.
      [0022] [0] BLE : Connecting to hub ’90:84:2b:03:fb:14’…
      [0023] [0] BLE : Connected to hub ’90:84:2b:03:fb:14′.
      [0024] [0] BLE : Watchdog timeout not set for PU hubs
      [0025] [0] PU : Found integrated RGB LED at port 32
      [0026] [0] Loop: Connected to all hubs of loco ‘Boxxy’.
      [0027] [1] Ctrl: Received lc command for loco address ‘1’, speed 0.
      [0028] [1] Ctrl: Received lc command for loco address ‘1’, speed 38.

      Any help greatly appreciated!

      Dave

    • #7816
      Hilbert BHilbert B
      Keymaster

      Hi,

      The line
      Config: Failed to read config file: deserializeJson() failed with code InvalidInput
      indicates that there is something wrong with your controller_config.json.

      This should be fixed first, before anything else!

      Hilbert

    • #7817
      Dave GDave G
      Participant

      Thanks Hilbert, to avoid any confusion, I have just freshly downloaded the latest Firmware and the serial no longer has that line, but neither does it have an ID? Here is the current serial and all I did this time was copy/paste the example controller_config into my own data folder. Apart from changing the name, nothing different to the example controller_config this time around. Have also double checked that the board (AZ Dev4) and Platform (espressif32) are current and correct.

      — Terminal on COM3 | 115200 8-N-1
      — Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
      — More details at https://bit.ly/pio-monitor-filters
      — Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H

      [1] Setup: Starting MattzoTrainController for BLE…
      [1] Setup: Loading network configuration…
      [0000] [1] Logging: Configured.
      [0001] [1] Setup: Loading controller configuration…
      [0002] [1] Config: Read controller name: TestMTC
      [0003] [1] Config: Read ESP pin configuration (2).
      [0004] [1] CTRL: Local channels initialized.
      [0005] [1] Setup: Initializing BLE…
      [0006] [1] Setup: Controller configuration completed.
      [1] Wifi: Connecting to GC.[0007] [0] BLE : Scanning for 3 hub(s)…
      [0008] [0] BLE : Discovered unknown device: (11:76:b8:fa:c2:f1).
      .
      [0009] [1] MQTT: Connecting to 192.168.1.100:1883…
      [0010] [1] Setup: MattzoTrainController for BLE running.
      [0011] [1] Setup: Number of locos to discover hubs for: 3
      [0012] [1] Setup: Number of locos to discover hubs for: 3
      [0013] [1] MQTT: Subscriber configuring last will…
      [0014] [1] MQTT: Subscriber attempting to connect…
      [0015] [1] MQTT: Subscriber connected
      [0016] [1] MQTT: Subscriber subscribed to topic ‘rocrail/service/command’
      [0017] [0] BLE : Scanning for 3 hub(s) aborted.
      [0018] [0] BLE : Scanning for 3 hub(s)…

    • #7818
      Hilbert BHilbert B
      Keymaster

      Hi Dave,

      There will never be a controllerID posted. But if you are looking for hub mac addresses? Then an empty controller file like:

      
      {
        "name": "MTC4BT",
        "espPins": [
          {
            "pin": 2,
            "inverted": false,
            "attachedDevice": "status"
          }
        ]
      }
      

      Will put the controller in scan mode and this wil produce a log like:

      [0016] [1] MQTT: Connecting to 192.168.70.10:1883...
      [0017] [1] Setup: MattzoTrainController for BLE running.
      [0018] [0] MQTT: Subscriber configuring last will...
      [0019] [1] Setup: Number of locos to discover hubs for: 0
      [0020] [0] MQTT: Subscriber attempting to connect...
      [0021] [1] No locomotives found in the configuration, going into BLE scan mode.
      [0022] [0] MQTT: Subscriber connected
      [0023] [0] MQTT: Subscriber subscribed to topic 'rocrail/service/command'
      [0024] [0] BLE : Scanning for 0 hub(s) aborted.
      [0025] [0] BLE : Scanning for 0 hub(s)...
      [0026] [0] BLE : Discovered unknown device:  (9c:8c:6e:5a:ef:a9).
      [0027] [0] BLE : Discovered unknown device: HwZ_fb0e3dbbb9002b1710 (00:a0:50:*).
      [0028] [0] BLE : Discovered unknown device:  (67:45:23:56:*).
      [0029] [0] BLE : Scanning for 0 hub(s) aborted.
      [0030] [0] BLE : Scanning for 0 hub(s)...
      [0031] [0] BLE : Discovered unknown device: HwZ_fb0e3dbbb9002b1710 (00:a0:50:*).
      [0032] [0] BLE : Discovered unknown device:  (67:45:23:*).
      [0033] [0] BLE : Discovered unknown device:  (9c:8c:6e:*).
      

      The address strating with 90:... are lego Pu hubs, addresses starting with 50:... are the new BuWizz 2.0 hubs.

      BTW this is the development branch (which I am using and developing on, I consider it stable).

      Hilbert

    • #7820
      Dave GDave G
      Participant

      Thanks for that, I have the MAC address of my PU hub and I am happy in being able to find future hub addresses when ready. Instead, I think I am looking for the ControllerID as referenced in the section “The Serial Monitor” at the webpage https://mattzobricks.com/automation/controllers/general where the ID referenced is 9990. I presume this information is then necessary for the configuration of the locomotives in Rocrail, under the Properties tab > Node ID box or am I barking up the wrong tree?

      Dave

    • #7822
      Hilbert BHilbert B
      Keymaster

      Dave,

      Wrong tree 😉 the controllerId is only for MLC and MTC4PF because its configuration is different.

      What you need are the address fields in the configuration file, this address is used in Rocrail associate the locomotive with an address in the configuration file.

      Hope this helps.

      Hilbert

    • #7823
      Dave GDave G
      Participant

      Well that clears that up then! In terms of Rocrail, I have added a train and can see that the MTC4BT has located the physical PU hub. How do I now control the hub via Rocrail? The routes are set and I can see the assignment is correct for the train to a block and then the subsequent block it should travel to. I have set the address in the Address in the Interface Tab as ‘1’ as that is the only loco configured in the code. I can see that Rocrail is sending a speed command to the hub as it is writing it out in the serial log – but there is no movement from the motors? I have tried both A and B ports. I have a feeling it has something to do with the ‘virtual’ mode next to the speed properties etc in the Loco window. Sorry to keep pestering!

      Dave

    • #7824
      Hilbert BHilbert B
      Keymaster

      Dave,

      I think you are in the ‘brake’ state. You have to power up the layout in RocRail, the big poweron/off button in rocrail.
      After that the ‘brake’ will be off and the motors should start to run.

      The serial log will indicate having received an lc command with its speed, and the motor should spinning.

      Hilbert

    • #7826
      Dave GDave G
      Participant

      Thanks Hilbert, a quick reset of the controller and all seemed well. Only got a bit of time to mess around with it again this weekend but managed to get a second train up and running so thank you! I don’t suppose you have any tips on reducing the wait between blocks on auto routing? All routes are mapped and reserve second block / release block on enter are set etc but still seems to take an age for the engine to be assigned a new block to take. My next guess when I get some time is to individually edit the block wait parameters.

      Dave

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