Forum Replies Created
-
AuthorPosts
-
Matthias RunteKeymaster
Des, it looks as if you did not configure the MLC at all. You should deactivate switches and signals (at least you must sure that they do not conflict with your sensors pinis D1 and D2), and you must set the correct sensor pins.
->
#define NUM_SWITCHES 0
(also reduce the switches in the switch array to 0 – see empty configuration as example}->
#define NUM_SIGNALS 0
(also reduce the signals in the signals array to 0 – see empty configuration as example}->
// 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 2// 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 falseTSensorConfiguration sensorConfiguration[NUM_SENSORS] =
{
{
.pin = D1,
.pinType = LOCAL_SENSOR_PIN_TYPE,
.remoteMattzoControllerId = -1
},
{
.pin = D2,
.pinType = LOCAL_SENSOR_PIN_TYPE,
.remoteMattzoControllerId = -1
}
};I know that the configuration is still a bit technical at this stage. When I find the time one day, I am going to implement a web configuration.
Matthias RunteKeymasterIn behalf of Des, I am posting his MLC config file here:
// *********************
// COPYRIGHT AND LICENSE
// *********************// Author: Dr. Matthias Runte
// Copyright 2020 by Dr. Matthias Runte// License:
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.// *****************
// PURPOSE AND USAGE
// *****************// MattzoLayoutController (MLC) example configuration file
// Usage: copy it onto the conf/my/controller_config.h file and adapted it to your needs
// Documentation: https://www.mattzobricks.com// This configuration is the default configuration for the MLC.
// It serves 2 switches, 2 standard light signals, and 2 sensors.// *******************************
// CONTROLLER WIRING CONFIGURATION
// *******************************// PCA9685 WIRING CONFIGURATION
// Infos for output port expander PCA9685
// Usage:
// – If a USE_PCA9685 port expander is connected to your ESP8266, set USE_PCA9685 to true. Else, it must be set to false.
// Wiring:
// – PCA9685 is usually connected to pins D1 (clock) and D2 (data) of the ESP8266.
// – VCC is sourced from V3V of the ESP8266.
// – V+ is sourced from VIN of the ESP8266
// — VIN should be between 5 and 6 Volts.
// — According to the documentation, the PCA9685 will also sustain 12V, but this is not recommended and we have not tested it.
// — We have tested run the board with standard USV voltage (4,65V) and it worked without problems.
// – Connecting GND is mandatory.
// – OE should also be connected. If pulled high, servo power is switched off. Good to preserve your servos. Cabling is usually easiest if pin D0 is used as OE.
// Chaining:
// – Both PCA9685 and the firmware support chaining.
// – Board 1 has the address 0x40, Board 2 0x41 etc.
// Servos:
// – Just connect the servos as designed. Servos connected to PCA9685 must be mapped in SWITCHPORT_PIN_PCA9685.
// Signals:
// – Connecting TrixBrix signals to the PCA9685 is somewhat tricky, because of the “common anode” (common plus terminal) of the signal LEDs.
// – The solution is to connect the middle wire (plus) to V3V of the ESP8266 (NOT the plus pins of the PCA9685 ports), and the outer wires to the PCA9685 pins.
// – It is important to remember the correct way of setting a pin on the PCA9685 to:
// — fully on: pwm.setPWM(port, 4096, 0);
// — fully off: pwm.setPWM(port, 0, 4096);
// – Generally, it is better practice to connect light signals via MCP23017 port extenders
// Additional reference: https://learn.adafruit.com/16-channel-pwm-servo-driver?view=all// 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
// Infos for I/O port expander MCP23017
// Usage:
// – If a MCP23017 I/O port expander is connected to your ESP8266, set USE_MCP23017 to true.
// Wiring:
// – SCL and SDA are usually connected to pins D1 (clock) and D2 (data) of the ESP8266.
// – VCC is sourced from V3V of the ESP8266.
// – GND is connected to GND of the ESP8266. Connecting GND is mandatory!
// – RESET is connected with an 10K resistor to VCC
// – Address ports A0, A1 and A2 according to the desired address (0x20, 0x21, …). All connected to GND means address 0x20.
// Ports:
// – The ports of the are numbered as follows:
// – A0..A7: 0..7
// – B0..B7: 8..15
// Chaining:
// – Both MCP23017 and the firmware support chaining.
// – Board 1 has the address 0x20, board 2 0x21 etc.
// – Up to 8 boards can be connected.
// Sensors:
// – Connecting sensors to the MCP23017 is simple.
// – Just connect one of of the cable pair to GND, the other one to one of the ports of the MCP23017.// 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 2TServoConfiguration 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 4TLEDConfiguration ledConfiguration[NUM_LEDS] =
{
{
.pin = D2,
.pinType = 0
},
{
.pin = D3,
.pinType = 0
},
{
.pin = D4,
.pinType = 0
},
{
.pin = D5,
.pinType = 0
}
};// 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 2// 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 falseTSensorConfiguration sensorConfiguration[NUM_SENSORS] =
{
{
.pin = D6,
.pinType = LOCAL_SENSOR_PIN_TYPE,
.remoteMattzoControllerId = -1
},
{
.pin = D7,
.pinType = LOCAL_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 2TSwitchConfiguration switchConfiguration[NUM_SWITCHES] =
{
{
.rocRailPort = 1,
.servoIndex = 0,
.servo2Index = -1,
.servo2Reverse = false,
.triggerSensors = false,
.sensorIndex = { -1, -1 }
},
{
.rocRailPort = 2,
.servoIndex = 1,
.servo2Index = -1,
.servo2Reverse = false,
.triggerSensors = false,
.sensorIndex = { -1, -1 }
}
};// SIGNAL CONFIGURATION
// Number of signals
#define NUM_SIGNALS 2
// 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 0TSignalConfiguration signalConfiguration[NUM_SIGNALS] =
{
// signal 0: light signal with 2 aspects, controlled via Rocrail ports 1 and 2
{
.aspectRocrailPort = {1, 2},
.aspectLEDPort = {0, 1},
.aspectLEDMapping = {
{true, false},
{false, true}},
.servoIndex = {},
.aspectServoAngle = {},
.overshootSensorIndex = -1
},
// signal 1: light signal with 2 aspects, controlled via Rocrail ports 1 and 2
{
.aspectRocrailPort = {3, 4},
.aspectLEDPort = {2, 3},
.aspectLEDMapping = {
{true, false},
{false, true}},
.servoIndex = {},
.aspectServoAngle = {},
.overshootSensorIndex = -1
}
};// 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 2TLevelCrossingConfiguration 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 0TBridgeConfiguration bridgeConfiguration = {};
// SPEEDOMETER CONFIGURATION
// General switch for speedometer (false = no speedometer connected; true = speedometer connected)
#define SPEEDOMETER_CONNECTED falseTSpeedometerConfiguration 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 = “MLC”;// Syslog application name
const char *SYSLOG_APP_NAME = “MLC”;Matthias RunteKeymasterThe file I am looking for is called controller_config.h. This is usually located in a directory like “..\MLC\conf\my”.
Matthias RunteKeymasterHi Des,
don’t worry, I believe you are only an inch from the solution. If you see the sensors working in the sensor monitor in Rocrail, you have already solved 99% of the work. The rest should only be a bit of Rocrail configuration, or there is a problem in the MLC configuration.My recommendation is to validate that the sensors are triggered in Rocrail by displaying the “Trace” window in Rocrail. Make sure that sensors events are shown in the Trace log, and restart Rocrail after you have changed Rocrail settings via Rocview.
Just in case, could you please post your MLC config file here?
November 30, 2024 at 08:32 in reply to: Trixbrix Servo bewegt sich nur wenig und nondeterministisch #7844Matthias RunteKeymasterWenn der Servo kontinuierlich arbeitet, wird er tatsächlich überhitzen und geht dann relativ zügig kaputt. Die von mir eingebaute Servo-Abschaltung hat also schon ihren Grund. Die Idee ist, dass Du den Servo bei schlecht gehenden Schaltwerken – wie offenbar bei Dir – mit ordentlich Kraft etwas über die Endlage versuchst hinaus zu drehen und danach automatisch abschaltest. So machen das die Trixbrix-Jungs mit ihrem manuellen Schalter übrigens auch. Das Geheimnis ist dabei, dass man auf die Millisekunde genau den richtigen Zeitpunkt für die Abschaltung erwischen muss, da der Servo bei der Abschaltung sonst Unfug macht. Falls Du neugierig bist, schau Dir das im MLC-Code in der Funktion checkEnableServoSleepMode() an.
Übrigens: die konfigurierbaren Servo-Winkel werden in der Firmware begrenzt zwischen den Werten SWITCHSERVO_MIN_ALLOWED und SWITCHSERVO_MAX_ALLOWED (-> MLC.h), um Hardware-Schäden bei Fehlkonfigurationen unwahrscheinlicher werden zu lassen. Die Werte passen für 99% der User. Falls Du über diese Werte hinaus konfigurieren musst, passe die Konstanten entsprechend an und compile die Firmware neu.
November 27, 2024 at 21:44 in reply to: Trixbrix Servo bewegt sich nur wenig und nondeterministisch #7842Matthias RunteKeymasterDie gemessenen 0,25 Volt sind nicht wirklich aussagekräftig und sagen nichts über die Stromversorgung des Servo-Motors aus. Du misst da ein PWM-Signal, das ausschließlich der Steuerung des Servos dient. Da fließt kein signifikanter Strom. 4,5 V und 3,1 A sind ansonsten schon mal nicht schlecht. Das Problem, das Du mit dem Servo-Motor hast, klingt eher nach einem Problem bei der Abschaltung des Servos nach dem Schaltvorgang. Hast Du in der Servo Wiring Configuration die Servo-Abschaltung aktiviert? Typischerweise steht dann dort ein “.detachAfterUsage = true”. Nimm das bitte mal raus oder ersetze “true” durch “false”. Ändert das etwas?
Matthias RunteKeymasterLoks mit MTC4PF mit IR-LED lassen sich auch konventionell über Fernbedienung steuern, soweit der IR-Empfänger nach wie vor so eingebaut ist, dass er IR-Signale von außen empfängt. Wenn man den MTC4PF onboard einbaut, baut man das ja manchmal um, so dass er nicht mehr zu sehen ist.
Die Bluebrixx-Geräte unterstützen wir nicht. Wir arbeiten aber an einer BuWizz 2.0 Unterstützung über MTC4BT.
Ich kenne die Bluebrixx-Motoren nicht, aber wenn die einen PF-Stecker haben passt das.
Wir verwenden originale LEGO PF-Zugmotoren oder China-Nachbauten, zu kaufen z.B. bei Ali Express.
Matthias RunteKeymasterWähle in Rocrail das Menü “Ansicht / Trace” (im englischen UI: “View / Trace”).
Matthias RunteKeymasterIch tippe hier auf ein Routing-Problem. Schau mal, ob der Autorouter alle Routen richtig generiert hat. Ansonsten kann es auch sein, dass die Lok nicht in den nächsten Block darf, z.B. weil sie als elektrisch gekennzeichnet ist, aber der Block keine Oberleitung hat. Das kann viele Gründe geben. Man wird schlauer, wenn man die unterschiedlichen Trace-Optionen aktiviert, dann sieht man schon eher, was faul ist.
Viel Erfolg!
Matthias RunteKeymasterKlingt spannend. Wir freuen uns auf weitere Berichte zu dem Thema.
Matthias RunteKeymaster10 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.
- This reply was modified 1 month, 4 weeks ago by Matthias Runte.
Matthias RunteKeymasterHi Luuk,
we have now worked on your input in greater depth. Here are the answers:– The manual (MTC4BT) talks about making a ‘platformio.ini’ file, but looking at the code in the existing platformio.ini file I assume this should be: make a ‘my_platformio.ini’ file. This given that the existing platformio.ini file expects a my_platformio.ini file. Or should I completely replace the existing platformio.ini file?
We have changed the documentation into copying the my_platformio.ini.example to my_platformio.ini. It should now be clearer and correct.
– In the platformIO tab on the left side of VS code, it always asks me to select a project folder. It repeats itself with this question after selecting the …\MTC4BT subfolder. How do I fix this?
Use the file MattzoControllers.code-workspace in the root of the repository in VS code “File->Open workspace from file…”
– I have a default error in the code of platformio.ini: ‘No option ‘additional_build_flags’ in section: [common]’. How do I fix this?
This is fixed in the devolopment branch and changing the documentation to copy the my_platformio.ini.expample part. The problem will be resolved with the next release – or if you use the development branch.
Matthias RunteKeymasterI don’t believe so. Did you give it a try?
Matthias RunteKeymasterHallo Gerd, das freut mich sehr. Weiterhin gutes Gelingen!
Matthias RunteKeymasterSchön!
Matthias RunteKeymasterDas freut mich!
Matthias RunteKeymaster> Da ich auch über eine 2. Ebene nachdenke, nehme ich an, dass das mitfahren die beste Lösung ist um Verbindungsprobleme zu vermeiden?
Kommt drauf an, wie groß Deine Anlage ist. Wenn sie in einen Raum passt, benötigst Du das m.E. nicht, d.h. der Controller kann stationär verbaut werden.
> Somit bräuchte ich 5 dieser Boards.
Du kannst mehrere PU hubs mit einem Board steuern. Ich empfehle nicht mehr als 4 PU Hubs pro Board, damit die Dinger nicht an ihre Grenzen kommen.
> Aber was benötige ich für die Stromversorgung der Boards?
Ein einfaches USB Ladegerät.
> Zusätzlich wäre es schön einen Ein Aus Schalter zu haben. Hab irgendwo in den Videos von einem Schalter mit 8mm Einbaumaß gehört,finde so einen Schalter aber nirgendwo im Internet und auch nicht in der Zubehörliste.
Schau noch einmal auf der Materialliste (8mm switches). Brauchst Du aber nicht, wenn Du eh nur PU Hubs verwendest und die Boards für den MTC4BT stationär betreibst.
Allgemein finde ich es natürlich super, wenn Du in die Mattzobricks-Welt abtauchen willst. Falls Du keinerlei Elektronik-Vorkenntnisse hast, dann besorge Dir am besten erst einmal einen Elektronik-Startkasten und beschäftige Dich mit der Sache allgemein. Habe ich auch so gemacht. Meist gibt es viele Bauanleitungen für witzige Sachen. Wenn man das gemacht hat, hat man schon einmal eine grundsätzlich Vorstellung von dem, wie die Dinge funktionieren.
- This reply was modified 2 months, 3 weeks ago by Matthias Runte.
Matthias RunteKeymasterHi Luuk, thank you very much for your input, which is appreciated. I transferred your post into our bug tracking system. We will care about it after the summer break. I hope to find some time to record a video that shows the VS Code setup step by step. The written documentation is also helpful, but things change in the VSCode frontend over time and we rarely find the capacity and time to adapt the documentation all the time.
Maybe somebody else can help in the meanwhile? Thanks!
Matthias RunteKeymasterOk, thanks. It has been quite some time since we developed it, so thanks for the analysis. I have taken a note that we enhance the documentation. We will also review the present implementation and probably add a feature for immediate stops, as in the MTC4PF.
Let me add that most people want gentle stops instead of immediate ones. If you want to stop the loco at a defined position, it might be better to work with two sensors per block (enter and in sensor), and start slowing down the loco when it hits the enter sensor. Then the loco continues with moderate or slow speed until it meets the in sensor. Also check the BBT feature of Rocrail, this also helps.
- This reply was modified 5 months, 1 week ago by Matthias Runte.
Matthias RunteKeymasterHi Liam,
try leaving away the pwr*Step parameters, or set them to high values. This should solve your issue. If not, let me know. Then I need to look it up in the code.Cheers,
MattzeMatthias RunteKeymasterWelcome to Mattzobricks! You should try digital sensors instead of Hall sensors. We recommend reed sensors. I recently posted a video about sensors on the Youtube Channel, and I have also put some work into rewriting the sensor page.
Please check out the SENSOR WIRING CONFIGURATION in the MattzoLayoutController configuration. There you will find the sensors that are defined for your controller. The first sensor in the array has Rocrail port 1, the second 2 etc. This is hard-wired in the code. You should also try to monitor the MQTT queue using mosquitto_sub. This also helps to find errors.
Good luck!
Matthias RunteKeymasterHabe noch einmal geschaut. Grundsätzlich scheinst Du schon alles richtig gemacht zu habe. Die Example-Datei wird kopiert und kann dann modifiziert werden, ohne unter Quellecode-Kontrolle zu fallen. Einen Kommentar, dass man dort etwas nicht ändern soll, habe ich allerdings nicht gefunden.
Wünsche noch viel Erfolg!
Matthias RunteKeymasterIst bekannt und die Kritik ist auch berechtigt. Ich habe gerade vor ein paar Wochen die Website-Struktur umgestellt. Daher herrscht derzeit ein bisschen Chaos bei der Doku. Wird besser, sobald ich etwas Zeit finde. Allgemein ist es allerdings tatsächlich eine Herausforderung, die gesamte Bandbreite der Dinge, die wir hier anbieten, didaktisch eingängig aber trotzdem übersichtlich darzustellen.
Richtig ist auch, dass wir nur einen Teil der Webseiten übersetzt haben – geht leider nicht anders. Die doppelsprachigen Webseiten sind sehr aufwendig zu pflegen und synchron zu halten.
Matthias RunteKeymasterPF Kabel: die inneren (Google hilft).
- This reply was modified 6 months, 2 weeks ago by Matthias Runte.
Matthias RunteKeymaster>> The status LED indicates to WiFi connection status, the MQTT connection status and lights up when one or more sensors are triggered. The status LED is very handy in practice. <<
-
AuthorPosts