Viewing 4 reply threads
  • Author
    Posts
    • #8346
      Ulrich SchneiderUlrich Schneider
      Participant

      From the header and example files, it seems possible to wire LEDs to the motor output. While everything else was easy to configure with the MTC4PFmini, I have trouble connecting LEDs to the motor output.

      In my case, I want to control the LED via the controller’s Dupont connectors:

      My code for the train light section:
      // 1: LED via motor shield
      .trainLightType = TrainLightType::ESP_OUTPUT_PIN,
      .pin = D6,
      .motorShieldIndex = 0,
      .motorPortIndex = 1,
      .powerLevelOff = 0,
      .powerLevelOn = MAX_ARDUINO_POWER,

      The motor shield section is the one from the original file of the MTC4PFmini.

      Can someone help me with this?

    • #8347
      Matthias RunteMatthias Runte
      Keymaster

      Hello Ulrich,
      I hope I understand your problem correctly. Do you want to connect lights to the motor shield?

      If yes, have a look at the example file “MTC4PF_conf_V100.h” (included in firmware version V1.2.1 and some earlier versions). There you’ll find a train light of type ‘TrainLightType::POWER_FUNCTIONS’. Is that what you are looking for?

      The example loco has just a simple front light. It can be controlled via F1 in Rocrail, and it also triggered when the train starts to move.

      Does that help?

      Cheers,
      Mattze

    • #8351
      Ulrich SchneiderUlrich Schneider
      Participant

      Thanks for the reply.

      I indeed used that file to create my own. While everything works as expected, the LEDs using the DuPont connectors dedicated for the second motor immediately burnt through.

      It would be of immense help if you could provide a file for the MTC4PFmini with the following setup:
      – Power functions motor on top
      – LED 1: V to 5, Gnd to 4
      – LED 2: V to 3, GND to 4
      – LED 3: V to 2, GND to 4
      (- LED 4: V to 1, GND to 4)

      I numbered the DuPont connectors as in the instructions file. 1 & 2 are reserved for a second motor. I would like to attach LEDs to them.

    • #8352
      Matthias RunteMatthias Runte
      Keymaster

      Got it. If you just connect LEDs to the motor shield without any resistors or other protection, they will inevitably burn out immediately and create magic smoke. The motor shield provides up to 9V, with a stronger battery even more. That is the instand end of lifecycle of any LED.

      What’s you hardware setup? Did you actually build a MTC4PF mini with the PCB and the case? Or did you buy an ESP8266 development board and use it “bare” as it is? As you are referring to using D1, D2, D3 and D5 for your LEDs, I assume the latter.

      Have a look at the other configuration files like the ones for TGV, SFE, METRO etc. I will also add a light configuration for the MTC4PF mini standard configuration file (MTC4PF_conf_mini.h). Before I merge it to develop, it needs some testing (don’t have the time for that this weekend, I think). If you hang yourself in here, you well be notified when it’s done and tested:

      https://github.com/Mattzobricks/MattzoControllers/issues/150

    • #8360
      Ulrich SchneiderUlrich Schneider
      Participant

      I was an idiot. I thought the code magically managed the voltage appropriately for LEDs connected to the motor shields. Now that I used some fitting resistors, it works as expected.

      Just to be double clear. Theoretically, it is impossible to attach two LEDs to one single motor shield if they should both be on simultaneously. The shield only has (High, Low), (Low, High) and (Low, Low) but never (High, High), right?

      • #8364
        Matthias RunteMatthias Runte
        Keymaster

        Wiring LEDs in series is absolutely no problem.

        Example: the V100 that you have seen in some of my videos. It has three white LEDs that are wired in series, and attached to the motorshield. I have also added a small additional resistor in the chain.

        When connecting electrical consumers to terminals, only the voltage difference between the terminals is relevant, not the potential of the terminals. That means that “high/high” and “low/low” is precisely the same – no current will flow.

        Happy building!

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