Welcome to MattzoBricks Forums MattzoLayoutController (MLC) Nutzung von D4 als Sensor

Viewing 2 reply threads
  • Author
    Posts
    • #7755
      Stephan KnokeStephan Knoke
      Participant

      Hallo,

      ich habe mir jetzt mehrere (10) MLC Mini programmiert. Alle haben die gleiche Konfiguration:
      2x Weiche (D0 und D1)
      6x Sensor (D2 bis D7)
      1x Status-LED (D8)
      4x VirtualSensor (für Weichen)
      Das funktioniert, aber leider nur teilweise.

      1 MLC Mini funktioniert gar nicht. Er wählt sich nicht ins Netzwerk ein. Ursache ??? vielleicht defekt

      Bei 2 MLC Mini habe ich ein Problem, wenn ein Reedkontakt an D4 angeschlossen ist. Dann leuchtet die Kommunikations-LED dauerhaft. Diese funktionieren dann auch nicht richtig.
      Muss ich die Eingänge noch irgendwo initialisieren oder macht das das Programm automatisch, je nach Konfiguration? Das waren ja mal Signal-Ausgänge …

      Viele Grüße

      Stephan

    • #7758
      Matthias RunteMatthias Runte
      Keymaster

      10 Stück ist doch schon mal ein guter Anfang! 🙂

      Wenn 9 gehen und einer nicht funktioniert, ist da wahrscheinlich der ESP8266 defekt. Der Kontakt zur WLAN Antenne bricht leicht, dann hat man praktisch keinen WLAN Empfang mehr. Tausch den mal aus.

      D4 ist bei den meisten ESP8266 in der Tat die interne LED. Dürfte aber eigentlich kein Problem sein. Die Pins werden durch die MLC Konfiguration automatisch richtig konfiguriert. Poste bitte Deine Konfiguration hier einmal, ich werfe mal einen Blick drauf.

    • #7763
      Stephan KnokeStephan Knoke
      Participant

      mmh, ja der eine MLC hat beim Booten eine Meldung “Sensor 1 ein” und dann “Sensor 1 aus”, wählt sich aber nicht ins Netzwerk ein.
      Ich habe diese Platine aber inzwischen zurück geschickt und kann nicht mehr nachschauen.

      Meine Konfiguration:

      // PCA9685 port expander used?
      #define USE_PCA9685 false
      
      // PCA9685 OE pin supported?
      #define PCA9685_OE_PIN_INSTALLED false
      const uint8_t PCA9685_OE_PIN = D0;
      
      // Number of chained PCA9685 port extenders
      #define NUM_PCA9685s 1
      
      // MCP23017 WIRING CONFIGURATION
      
      // MCP23017 port expander used?
      #define USE_MCP23017 false
      
      // Number of chained MCP23017 port extenders
      #define NUM_MCP23017s 1
      
      // SERVO WIRING CONFIGURATION
      
      // Servos are used for motorizing switches and form signals
      
      // Number of servos
      #define NUM_SERVOS 2
      
      TServoConfiguration servoConfiguration[NUM_SERVOS] =
      {
          {
              .pin = D0,
              .pinType = 0,
              .detachAfterUsage = true
          },
          {
              .pin = D1,
              .pinType = 0,
              .detachAfterUsage = true
          }
      };
      
      // LED WIRING CONFIGURATION
      
      // LEDs are used in signals, level crossing lights or bascule bridge lights
      // As an example, 2 LEDs are required for a light signal with 2 aspects
      
      // Number of LEDs
      #define NUM_LEDS 0
      
      TLEDConfiguration ledConfiguration[NUM_LEDS] =
      {
      };
      
      // SENSOR WIRING CONFIGURATION
      
      // Sensors are generally used to indicate that a train have reached a specific position on the layout
      // Special forms are remote and virtual sensors (see below)
      
      // Number of sensors connected or connectable to the controller
      #define NUM_SENSORS 10
      
      // A special form of a sensor is the "remote sensor"
      // Remote sensors are not electrically connected to this controller, they are triggered via Rocrail commands.
      // Remote sensors can be used for level crossings in Autonomous Mode.
      // Set REMOTE_SENSORS_ENABLED to true to generally enable remote sensors.
      // If you do not control a level crossing in Autonomous Mode with this controller, set to false!
      #define REMOTE_SENSORS_ENABLED false
      
      TSensorConfiguration sensorConfiguration[NUM_SENSORS] =
      {
          {
              .pin = D2,
              .pinType = LOCAL_SENSOR_PIN_TYPE,
              .remoteMattzoControllerId = -1
          },
          {
              .pin = D3,
              .pinType = LOCAL_SENSOR_PIN_TYPE,
              .remoteMattzoControllerId = -1
          },
          {
              .pin = D4,
              .pinType = LOCAL_SENSOR_PIN_TYPE,
              .remoteMattzoControllerId = -1
          },
          {
              .pin = D5,
              .pinType = LOCAL_SENSOR_PIN_TYPE,
              .remoteMattzoControllerId = -1
          },	
          {
              .pin = D6,
              .pinType = LOCAL_SENSOR_PIN_TYPE,
              .remoteMattzoControllerId = -1
          },
          {
              .pin = D7,
              .pinType = LOCAL_SENSOR_PIN_TYPE,
              .remoteMattzoControllerId = -1
          },
          {
              .pin = -1,
              .pinType = VIRTUAL_SENSOR_PIN_TYPE,
              .remoteMattzoControllerId = -1
          },
          {
              .pin = -1,
              .pinType = VIRTUAL_SENSOR_PIN_TYPE,
              .remoteMattzoControllerId = -1
          },
          {
              .pin = -1,
              .pinType = VIRTUAL_SENSOR_PIN_TYPE,
              .remoteMattzoControllerId = -1
          },
          {
              .pin = -1,
              .pinType = VIRTUAL_SENSOR_PIN_TYPE,
              .remoteMattzoControllerId = -1
          }    
      };
      
      // STATUS LED WIRING CONFIGURATION
      
      // Digital output pin to monitor controller operation (typically a LED)
      // Set to false if no status LED is installed
      const bool STATUS_LED_PIN_INSTALLED = true;
      // If installed, the pin controlling the status LED
      const uint8_t STATUS_LED_PIN = D8;
      // If installed, set to true to flip high/low state of the status led pin
      const bool STATUS_LED_REVERSE = false;
      // Power level of the status LED (0..1023)
      // Recommended max. power levels: white: 800, blue: 600, green: 500, yellow: 350, red: 300
      const int STATUS_LED_POWER = 300;
      
      // ****************************
      // LOGICAL OBJECT CONFIGURATION
      // ****************************
      
      // SWITCH CONFIGURATION
      
      // Number of switches
      #define NUM_SWITCHES 2
      
      TSwitchConfiguration switchConfiguration[NUM_SWITCHES] =
      {
          {
              .rocRailPort = 1,
              .servoIndex = 0,
              .servo2Index = -1,
              .servo2Reverse = false,
              .triggerSensors = true,
              .sensorIndex = { 6, 7 }
          },
          {
              .rocRailPort = 2,
              .servoIndex = 1,
              .servo2Index = -1,
              .servo2Reverse = false,
              .triggerSensors = true,
              .sensorIndex = { 8, 9 }
          }
      };
      
      // SIGNAL CONFIGURATION
      
      // Number of signals
      #define NUM_SIGNALS 0
      // Maximum number of signal aspects (e.g. 2 for red/green, 3 for red/green/yellow etc.)
      #define NUM_SIGNAL_ASPECTS 2
      // Number of signal LEDs (usually equal to NUM_SIGNAL_ASPECTS)
      #define NUM_SIGNAL_LEDS 2
      // Maximum number of servos for form signals (e.g. one for the primary and another one for the secondary semaphore)
      // If no form signals are used, just set to 0
      #define NUM_SIGNAL_SERVOS 0
      
      TSignalConfiguration signalConfiguration[NUM_SIGNALS] =
      {
      };
      
      // LEVEL CROSSING CONFIGURATION
      
      // General switch for level crossing (false = no level crossing connected; true = level crossing connected)
      #define LEVEL_CROSSING_CONNECTED false
      
      // Number of boom barrier servos configured for the level crossing
      #define LC_NUM_BOOM_BARRIERS 4
      
      // Number of signals configured for the level crossing
      #define LC_NUM_LEDS 4
      
      // Number of level crossing sensors
      #define LC_NUM_SENSORS 4
      
      // Number of tracks leading over the level crossing
      #define LC_NUM_TRACKS 2
      
      TLevelCrossingConfiguration levelCrossingConfiguration = {};
      
      // BASCULE BRIDGE CONFIGURATION
      
      // General switch for bascule bridge (false = no bridge connected; true = bridge connected)
      #define BASCULE_BRIDGE_CONNECTED false
      
      // Number of bridge Leafs (equals number of bridge servos)
      #define NUM_BASCULE_BRIDGE_LEAFS 0
      
      TBridgeConfiguration bridgeConfiguration = {};
      
      // SPEEDOMETER CONFIGURATION
      
      // General switch for speedometer (false = no speedometer connected; true = speedometer connected)
      #define SPEEDOMETER_CONNECTED false
      
      TSpeedometerConfiguration speedometerConfiguration = {};
      
      // ****************
      // NETWORK SETTINGS
      // ****************
      
      // Trigger emergency brake upon disconnect
      const bool TRIGGER_EBREAK_UPON_DISCONNECT = true;
      
      // WiFi Hostname
      // Allowed characters: a-z, A-Z, 0-9. From 2nd character, hyphens ("-") may also be used.
      const char *MC_HOSTNAME = "LegoTrackControler";
      
      // Syslog application name
      const char *SYSLOG_APP_NAME = "MLC";
      
Viewing 2 reply threads
  • You must be logged in to reply to this topic.