Willkommen bei MattzoBricks › Foren › MattzoTrainController for Power Functions (MTC4PF) › Probleme Zwischen Rocrail und Esp
- Dieses Thema hat 6 Antworten sowie 2 Teilnehmer und wurde zuletzt vor vor 9 Monaten, 2 Wochen von
ChrisRey aktualisiert.
-
AutorBeiträge
-
-
Dezember 12, 2024 um 23:22 Uhr #7905
ChrisRey
TeilnehmerHallo ich bin neu da.
Habe einen Esp 8266mod 12 f und L9110 ( motorschield ) hier die ausgabe zwischen dem Zug und rocrail im seriellen teil :
MattzoController setup completed.
initializing train light pins
loading loco configuration
loading motor shield configuration
stopping all locos
Setting train speed 0 (power: 0) for motor shield index 0
setMotorShieldPower() called with msi=0, mpi=0, desiredPower=0
Wifi connected. My IP address is 192.168.178.103.
(Re)connecting to MQTT 192.168.178.104…
MQTT connected, listening on topic [rocrail/service/command].dann geben wir mal gas:
Message parsing complete, target speed set to 39 (current: 0, max: 100)
Setting train speed 10 (power: 282) for motor shield index 0
setMotorShieldPower() called with msi=0, mpi=0, desiredPower=282
Executing light event forward
Setting train light index 0 to status off
Executing light event forward
Setting train light index 1 to status on
Setting output pin 4 to 850
Setting train speed 12 (power: 299) for motor shield index 0
setMotorShieldPower() called with msi=0, mpi=0, desiredPower=299
Setting train speed 14 (power: 315) for motor shield index 0
setMotorShieldPower() called with msi=0, mpi=0, desiredPower=315
Setting train speed 16 (power: 332) for motor shield index 0
setMotorShieldPower() called with msi=0, mpi=0, desiredPower=332
<lc> node found. Processing loco message…
loco id: v100
addr: 10233
Consuming message for train TGV2 (10233)
dir (raw): true
direction: forward
V: 0
V_max: 100
Message parsing complete, target speed set to 0 (current: 16, max: 100)
Setting train speed 0 (power: 0) for motor shield index 0
setMotorShieldPower() called with msi=0, mpi=0, desiredPower=0
Executing light event stop
Setting train light index 0 to status off
Executing light event stop
Setting train light index 1 to status off
Setting output pin 4 to 0hier der output aus rocrail:
23:21:15 9999 id=v100: addr=:10233, protocol=default, calculated speed=0, command=- V=0, dir=fwd, lights=off, throttleid=rv4074
23:21:14 9999 id=v100: addr=:10233, protocol=default, calculated speed=99, command=- V=39, dir=fwd, lights=off, throttleid=rv4074Wichtig wäre noch zu erwähnen Rocrail aus linux vm.
Und ich hatte es zuvor mit dem Devlop Branch versucht nun hab ich mal master probiert bei beiden geht der Motor nicht.
Egal welcher Port und auch verschiedenen Motoren getestet ! -
Dezember 12, 2024 um 23:23 Uhr #7906
ChrisRey
Teilnehmerhier die config:
// 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.// This file needs to stay in the folder of the firmware for the specific MattzoController!
// Handling of different configurations:
// It’s a good idea to create copies for all the controllers of this type that you own.
// Before compiling and uploading the firmware, just include the correct configuration into the firmware code.
// This allows to manage specific configurations for the different controllers easily.// Best practice:
// 1. Create a copy of this file if required (see above).
// 2. Go through the settings below and update the settings as required.// *********************************************************************************************
// Example file for configuring the MTC4PF to control a train with L9110 motor shield and lights
// *********************************************************************************************// *****
// LOCOS
// *****// Number of locos (aka. MattzoLocos) controlled by this controller
const int NUM_LOCOS = 1;// List of MattzoLocos
// The parameters have the following meaning:
// – locoName: name of the loco as setup in Rocrail
// – locoAddress: address of the loco as setup in Rocrail
// – accelerationInterval: time interval for acceleration / braking (default: 100 ms)
// – accelerateStep: power increment for each acceleration step
// – brakeStep: : power decrement for each braking step
MattzoLocoConfiguration *getMattzoLocoConfiguration()
{
static MattzoLocoConfiguration locoConf[NUM_LOCOS];locoConf[0] = (MattzoLocoConfiguration){
.locoName = “TGV2”,
.locoAddress = 10233,
.accelerationInterval = 100,
.accelerateStep = 2,
.brakeStep = 10};return locoConf;
}// *************
// MOTOR SHIELDS
// *************
// Number of motor shields connected to this controller
const int NUM_MOTORSHIELDS = 1;// List of motor shields that are controlled by this controller
// The parameters have the following meaning:
// – locoAddress: loco that this motor shields is attached to
// – motorShieldType: motor shield type
// – L298N_enA, L298N_enB: PWM signal pin for motor A / B, if L298N is used.
// – in1..in4: pin for motor direction control for motor shields L298N and L9110 (in1: forward motor A, in2: reverse motor A, in3: forward motor B, in4: reverse motor B).
// – minArduinoPower: minimum power setting for Arduino based motor shields. You might need to adapt this to your specific shield and motor. 200 might be a good value for a start. Should be 0 for LEGO IR Receiver 8884.
// – maxArduinoPower: maximum power setting for Arduino based motor shields (max. 1023). You might need to adapt this to your specific shield and motor. 400 might be a good value for a start.
// – configMotorA: turning direction of motor A (1 = forward, -1 = backward, 0 = unused). In case of LEGO IR Receiver 8884, this is the motor connected to the red port.
// – configMotorB: same for motor B; if IR receiver: blue port
// – irChannel: if a LEGO IR Receiver 8884 is used, the selected channel of the receiver. May be 0, 1, 2 or 3. If the loco uses multiple IR receivers on different channels, additional motor shields for the loco are required.
MattzoMotorShieldConfiguration *getMattzoMotorShieldConfiguration()
{
static MattzoMotorShieldConfiguration msConf[NUM_MOTORSHIELDS];msConf[0] = (MattzoMotorShieldConfiguration){
.locoAddress = 10233,
.motorShieldType = MotorShieldType::L9110,
.L298N_enA = 0,
.L298N_enB = 0,
.in1 = D3,
.in2 = D4,
.in3 = D5,
.in4 = D6,
.minArduinoPower = 200,
.maxArduinoPower = 1023,
.configMotorA = 1,
.configMotorB = 0,
.irChannel = -1};return msConf;
}// *************************
// TRAIN LIGHT CONFIGURATION
// *************************// Number of train lights controlled by this controller
#define NUM_TRAIN_LIGHTS 2// List of train lights including their configuration
TTrainLightConfiguration trainLightConfiguration[NUM_TRAIN_LIGHTS] =
{
{
// 0: head light / white
.trainLightType = TrainLightType::ESP_OUTPUT_PIN,
.pin = D0,
.motorShieldIndex = -1,
.motorPortIndex = -1,
.powerLevelOff = 0,
.powerLevelOn = MAX_ARDUINO_POWER,
},
{
// 1: head light / red
.trainLightType = TrainLightType::ESP_OUTPUT_PIN,
.pin = D2,
.motorShieldIndex = -1,
.motorPortIndex = -1,
.powerLevelOff = 0,
.powerLevelOn = 850,
},
};// ******************************
// FUNCTION MAPPING CONFIGURATION
// ******************************// Rocrail functions are used to MANUALLY switch train lights on and off
// Number of function mappings
#define NUM_FUNCTION_MAPPINGS 6// List of function mappings
TLocoFunctionMappingConfiguration locoFunctionMappingConfiguration[NUM_FUNCTION_MAPPINGS] =
{
// fn1: forward mode. head lights red
{
// head lights white off
.locoAddress = 10233,
.fnNo = 1,
.fnOnOff = true,
.trainLightIndex = 0,
.trainLightStatus = TrainLightStatus::OFF},
{// head lights red on
.locoAddress = 10233,
.fnNo = 1,
.fnOnOff = true,
.trainLightIndex = 1,
.trainLightStatus = TrainLightStatus::ON},// fn2: backwards mode. head lights white
{
// head lights white on
.locoAddress = 10233,
.fnNo = 2,
.fnOnOff = true,
.trainLightIndex = 0,
.trainLightStatus = TrainLightStatus::ON},
{// head lights red off
.locoAddress = 10233,
.fnNo = 2,
.fnOnOff = true,
.trainLightIndex = 1,
.trainLightStatus = TrainLightStatus::OFF},// fn3: head lights off
{
// head lights white off
.locoAddress = 10233,
.fnNo = 3,
.fnOnOff = true,
.trainLightIndex = 0,
.trainLightStatus = TrainLightStatus::OFF},
{// head lights red off
.locoAddress = 10233,
.fnNo = 3,
.fnOnOff = true,
.trainLightIndex = 1,
.trainLightStatus = TrainLightStatus::OFF},
};// *********************************
// TRAIN LIGHT TRIGGER CONFIGURATION
// *********************************// Triggers are used to AUTOMATICALLY switch train lights on and off
// Number of train light triggers as defined just below
#define NUM_TRAIN_LIGHT_TRIGGERS 6// List of train light triggers
TTrainLightTriggerConfiguration trainLightTriggerConfiguration[NUM_TRAIN_LIGHT_TRIGGERS] =
{
// forward mode. head lights red
{
// head lights white off
.locoAddress = 10233,
.lightEventType = LightEventType::FORWARD,
.trainLightIndex = 0,
.trainLightStatus = TrainLightStatus::OFF},
{// head lights red on
.locoAddress = 10233,
.lightEventType = LightEventType::FORWARD,
.trainLightIndex = 1,
.trainLightStatus = TrainLightStatus::ON},// backward mode. head lights white
{
// head lights white on
.locoAddress = 10233,
.lightEventType = LightEventType::REVERSE,
.trainLightIndex = 0,
.trainLightStatus = TrainLightStatus::ON},
{// head lights red off
.locoAddress = 10233,
.lightEventType = LightEventType::REVERSE,
.trainLightIndex = 1,
.trainLightStatus = TrainLightStatus::OFF},// this section may be commented out to prevent the head and rear lights from being switched off upon stop
// stop: head lights off
{
// head lights white off
.locoAddress = 10233,
.lightEventType = LightEventType::STOP,
.trainLightIndex = 0,
.trainLightStatus = TrainLightStatus::OFF},
{// head lights red off
.locoAddress = 10233,
.lightEventType = LightEventType::STOP,
.trainLightIndex = 1,
.trainLightStatus = TrainLightStatus::OFF},
};// ************************
// CONTROLLER CONFIGURATION
// ************************// Constants for motorshield type Lego IR Receiver 8884
const u_int8_t IR_LED_PIN = D7; // pin on which the IR LED is installed that controls all attached Lego IR Receiver 8884s.// 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;// Report battery level
const bool REPORT_BATTERYLEVEL = false; // set to true or false to allow or omit battery level reports
const int SEND_BATTERYLEVEL_INTERVAL = 60000; // interval for sending battery level in milliseconds
const int BATTERY_PIN = A0;
const int VOLTAGE_MULTIPLIER = 20000 / 5000 – 1; // Rbottom = 5 kOhm; Rtop = 20 kOhm; => voltage split factor
const int MAX_AI_VOLTAGE = 5100; // maximum analog input voltage on pin A0. Usually 5000 = 5V = 5000mV. Can be slightly adapted to correct small deviations// ****************
// NETWORK SETTINGS
// ****************// Trigger emergency brake upon disconnect
const bool TRIGGER_EBREAK_UPON_DISCONNECT = true;// WiFi Hostname
// Hostnames must start with a-z, A-Z, 0-9. From 2nd character, hyphens (“-“) may also be used
const char *MC_HOSTNAME = “MTC4PF-TGV2”;// Syslog application name
const char *SYSLOG_APP_NAME = “MTC4PF-TGV2”; -
Dezember 13, 2024 um 10:02 Uhr #7907
Matthias Runte
AdministratorHallo Christian, willkommen bei Mattzobricks. Auf den ersten Blick sieht das nicht schlecht aus. Die Kommunikation zwischen Rocrail und dem MTC4PF funktioniert, das sieht man an der Log-Ausgabe des MattzoControllers.
Probiere doch bitte mal, mit einem Arduino-Beispiel Sketch das Motorshield zu testen, indem Du damit den Motor laufen lässt. Sobald das klappt, wird das auch mit dem MTC4PF funktionieren.
-
Dezember 13, 2024 um 11:43 Uhr #7908
ChrisRey
TeilnehmerHey ich habe die gekauft https://www.amazon.de/dp/B07DK4FMWR?ref=ppx_yo2ov_dt_b_fed_asin_title
L9110S kann das Daran liegen das das s sind ? -
Dezember 13, 2024 um 18:51 Uhr #7909
Matthias Runte
AdministratorDas weiß ich nicht. Schau mal in die Spezifikation versuch doch erst einmal, das Ding mit einem einfachen Arduino-Sketch zum Laufen zu bringen.
-
Dezember 13, 2024 um 21:44 Uhr #7910
ChrisRey
TeilnehmerLeider nicht sind aber die gleichen grünen wie aus deinen Videos .das einzige was ist der ESP hat usb c . Zum sketch Versuch ich finde kein gescheiten 🙁
Danke für deine zeit und gedult
-
Dezember 13, 2024 um 23:57 Uhr #7911
ChrisRey
TeilnehmerAlso Schande über mich ein Kabel zum Motor war nicht richtig hmpf ist mir beim nochmaligen durchmessen mit dem Multimeter ausgefallen .
Wieder was dazu gelernt Kabel Prüfen vom pf für den Motor 🙁 ich musste mir nochmal ein Bild vom Kabel aufrufen da ist es mir aufgefallen . Fehler lag also 30Cm vor der Elektro Installation!-
Diese Antwort wurde vor 9 Monaten, 2 Wochen von
ChrisRey geändert.
-
Diese Antwort wurde vor 9 Monaten, 2 Wochen von
-
-
AutorBeiträge
- Du musst angemeldet sein, um auf dieses Thema antworten zu können.