Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • in reply to: MattzoLayoutController #3749
    Lucas HLucas H
    Participant

    Hi Oscar,

    Thanks for your reply and insight on the issue! I’m not too familiar with C++ either but for what I know this could work indeed. I’ll try this solution as well to see if it works with the latest board firmware of the ESP8266 and if the controller is then working properly. Unfortunately, I don’t use the Boom Barrier function of the layout controller so I don’t know what the implications will be of the changed code.

    Maybe some of the developers have some further insight on this issue?

    in reply to: MattzoLayoutController #3746
    Lucas HLucas H
    Participant

    I ran into this error again last night but commenting out the lines of code turned out to be working only for a limited time and is definitely not the desired solution! Even with a successful upload of the MattzoLayoutController firmware the ESP8266’s WiFi got all kinds of issues after the second boot. After some further testing, I think I found the root issue for this error. It seems that the new board firmware (version 3.0.2) for the ESP8266 is the cause of the problem. The solution I found to be working successfully is to downgrade the firmware version of the ESP8266 to 2.7.4 via the Arduino IDE boards manager. After you done so, restart Arduino IDE, upload the firmware again and you should be good to go!

    Let me know if this helps!

    • This reply was modified 2 years, 7 months ago by Lucas HLucas H.
    in reply to: MattzoLayoutController #3745
    Lucas HLucas H
    Participant

    Hi Oscar,

    As a quick workaround I ended up commenting out these three lines of code. As long as you don’t use the levelcrossing function of the layout controller you should be fine.

    Hopefully this will be addressed by a more experienced user with a permanent solution.

    Hope this helps for now!

    in reply to: MTC4PF – MattzoTrainController for Power Functions #2336
    Lucas HLucas H
    Participant

    Will do!

    in reply to: MTC4PF – MattzoTrainController for Power Functions #2319
    Lucas HLucas H
    Participant

    Hi Matthias,

    Thank you very much for your help, it works perfect!

    All the best,
    Lucas

    in reply to: MTC4PF – MattzoTrainController for Power Functions #2299
    Lucas HLucas H
    Participant

    Hi Matthias,

    The section of the config file (MTC4PF_Configuration.h):

    
    // NUM_FUNCTIONS represents the number of Rocrail functions that are defined for this controller
    // If changed, the number of array values for FUNCTION_PIN below must be changed as well.
    // You should also check void lightEvent(), which is responsible for switching headlights from white to red etc.
    const int NUM_FUNCTIONS = 6;
    
    // Digital pins for function output
    // For lights conntected to LEGO IR Receiver 8884, use virtual function pins IR_LIGHT_RED and IR_LIGHT_BLUE
    uint8_t FUNCTION_PIN[NUM_FUNCTIONS] = { D0, D1, D2, D5, D6, D7 };
    
    // The loco address for which the function pin will be triggered.
    // You may fill that array up with zeros (0). Meaning: "all trains". Makes only sense if this controller is handling a single train only.
    int FUNCTION_PIN_LOCO_ADDRESS[NUM_FUNCTIONS] = { 0, 0, 0, 0, 0, 0 };
    
    // Automatic lights. If set to true, Functions with odd numbers (Fn1, Fn3...) are switch on when loco is going forward, and odd numbers (Fn2, Fn4) when reverse. Set to false to disable the feature.
    // To set-up more advanced behaviour, find the lightEvent() function in the MTC4PF code and change it as desired.
    const bool AUTO_LIGHTS = true;
    
    // Digital output PIN to monitor controller operation (typically a LED)
    bool STATUS_LED_PIN_INSTALLED = false;  // set to false if no LED is installed
    uint8_t STATUS_LED_PIN = D8;
    

    And the lightEvent() function in MTC4PF:

    
    // execute light event
    // IF DESIRED, YOU MAY UPDATE THIS CODE SO THAT IT FITS YOUR NEEDS!
    void lightEvent(LightEventType le, int locoIndex) {
      if (!AUTO_LIGHTS)
        return;
      
      for (int i = 0; i < NUM_FUNCTIONS; i++) {
        if (locoIndex == 0 || locoIndex == FUNCTION_PIN_LOCO_ADDRESS[i]) {
          switch (le) {
          case LightEventType::STOP:
            mcLog("Light event stop");
            // switch all functions off
            // UPDATE THIS CODE SO THAT IT FITS YOUR NEEDS!
            // functionCommand[i] = false;
            break;
          case LightEventType::FORWARD:
            mcLog("Light event forward");
            // UPDATE THIS CODE SO THAT IT FITS YOUR NEEDS!
            functionCommand[i] = true;
            break;
          case LightEventType::REVERSE:
            mcLog("Light event reverse");
            // UPDATE THIS CODE SO THAT IT FITS YOUR NEEDS!
            functionCommand[i] = (i == 0);
            break;
          }
        }
      }
    }
    

    This should be all the relevant code. Let me know if I missed something!

    in reply to: MTC4PF – MattzoTrainController for Power Functions #2293
    Lucas HLucas H
    Participant

    Hi,

    I have successfully implemented a RGB led on both the front and rear of my 60197 train which works perfectly when switching directions: the leds show either white or red depending on the direction. I simply added two ESP8266s with a 9v battery in the front and rear of the train and used the MTC4PF firmware to control the LEDs. However, I would like to have two leds in both the front and rear of the train but I run into a slight problem with the code. I’ve installed the red terminal of the LEDs on the ports D0 and D5 and added D0-1-2-5-6-7 to the functions in the config file (since those are the ports I am using to control the LEDs). When going forward the leds in the front of the train both show the white aspect, which is correct. However, for the rear part of the train only one of the 2 LEDs shows the red aspect, the other one remains dark. I’ve tried some combinations in the execute light event section of the code but have not been successful yet. Could someone indicate what would be the correct functioncommand[i] for reverse in order to have both leds show red when in reverse direction? Or is this something that is not yet supported in this version of the firmware?

    Cheers,
    Lucas

    in reply to: MTC4PF – MattzoTrainController for Power Functions #2164
    Lucas HLucas H
    Participant

    Hi Mattze,

    I meant the GND pin indeed, my bad. Looking forward to the list!

    Lucas

    in reply to: MTC4PF – MattzoTrainController for Power Functions #2161
    Lucas HLucas H
    Participant

    Hi Thorsten,

    Thank you for your reply, very interesting to read! I tried it out today for one of my trains on the layout and it works really well with the IR led build into the train next to the receiver. Although I prefer the Powered Up solution for most of my trains, this is a really nice way of automating my older power function trains. Only difference is that with the motor shield the train runs a bit smoother, but that’s negligible.

    Thanks again and all the best,

    Lucas

    in reply to: MTC4PF – MattzoTrainController for Power Functions #2097
    Lucas HLucas H
    Participant

    Hi,

    I have a question regarding the wiring diagram of the Mattzocontroller for Power Functions with the IR led. The diagram shows that the IR led is directly connected to the 3v and d5 pins. However, most IR leds only run at 1,5v (at least the 940nm type which is commonly used). Furthermore, IR leds often run at higher currents (60mah or higher) while the gpio pins of the esp8266 only can provide 12mah max. I have tried the IR solution a while ago with a 940nm IR led when firmware 0.3 was released. I found then that most similar projects which use and esp8266 and an IR led use resistors and a transistor (type 2n222 or similar) which I had also used for my testing. I found that the solution was a bit unreliable so I bought the L9110 motorshield and have not tried it ever since. However, when I saw your new video today I became interested again since it seemed to work really well and would be easier to implement onboard the train.

    Could you explain why you’ve chosen to not use resistors and a transistor in this scenario and what type of IR led you have used? Isn’t this harmful to the controller/led in the long run or am I missing something here here?

    Thanks a lot and all the best,

    Lucas

    in reply to: Rocrail Issues #2012
    Lucas HLucas H
    Participant

    Hi Piet,

    Have you defined the routes for the blocks in Rocrail? If you haven’t done so, the auto mode will not work. The easiest way of creating the routes is by using the router in Rocrail which automatically generates the routes for the layout. Go to file/router/routing in Rocview in order to have the router generate the routes.

    Let me know if this solves the problem!

    All the best, Lucas

Viewing 11 posts - 1 through 11 (of 11 total)