Forum Replies Created
-
AuthorPosts
-
MaxParticipant
Hi Herbert,
you need to press the button from the begining until the very end of the flash.
I am happy to help you out!
But as some problems are very controller or Arduino related, I think it is easier to find solutions for those on other ressources like Arduino Forums.You can find some hints in the thread MattzoBricks Train Automation for Beginners
MaxParticipantHi Herbert,
did you tried another board to exclude hardware problens?
While flashing you need to hold down Boot/Rst pin on an ESP32.If MQTT is installed on the same system as Rocrail, localhost or 127.0.0.1 is correct.
MaxParticipantIch würde das ja gern mal sehen. Mach doch mal ein Bild vom Breadboard.
MaxParticipantIch bin gerade daran einen absoluten Beginner-Leitfaden zu erstellen. Der Thread “MattzoBricks Train Automation for Beginners” wird von mir sukzessiv erweitert.
Aber Zoltan, läuft die Lok? 🙂
MaxParticipantFrom “bug” to feature. Thank you Mattze!
The emergency brake situation remains until you have reset it. To reset, you need to virtually switch the “power” in Rocrail off and on again.
MaxParticipantHey Yevgen, that is correct. But even after restarting Rocrail, my MTC4PU thought he was a Christmas tree 🙂
MaxParticipantHi Mattze and Team!
While working on a troubleshooting guide I ran into the following “bug” of a MTC4PU.
After shutdown of Rocrail, the MTC4PU looped into the following:... Feb 10 13:30:51 MTC4PU61785 MTC4PU Flipping function 2 to 1 Feb 10 13:30:51 MTC4PU61785 MTC4PU Flipping function 3 to 0 Feb 10 13:30:51 MTC4PU61785 MTC4PU Flipping function 4 to 1 Feb 10 13:30:51 MTC4PU61785 MTC4PU Received MQTT message [rocrail/service/command]: <sys cmd="ebreak" informall="true" controlcode="" slavecode="" server="infw76700B84"/> Feb 10 13:30:51 MTC4PU61785 MTC4PU <sys> node found. Processing sys message... Feb 10 13:30:51 MTC4PU61785 MTC4PU rocrail system command: ebreak Feb 10 13:30:51 MTC4PU61785 MTC4PU received ebreak, stop or shutdown command. Stopping train. Feb 10 13:30:51 MTC4PU61785 MTC4PU Flipping function 1 to 1 Feb 10 13:30:51 MTC4PU61785 MTC4PU Flipping function 2 to 0 Feb 10 13:30:51 MTC4PU61785 MTC4PU Flipping function 3 to 1 Feb 10 13:30:51 MTC4PU61785 MTC4PU Flipping function 4 to 0 ...
After restarting Rocrail even a ebreak could not stop the MTC4PU. Maybe you can find the root cause in the code..
Many greetings!
MaxParticipant@Matze und Team: Es gibt im Sketch für MTC4PF_Configuration.h einen Typo im Kommentar:
// 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)
Korrigiert müsste es lauten:
// Automatic lights. If set to true, Functions with odd numbers (Fn1, Fn3...) are switch on when loco is going forward, and even numbers (Fn2, Fn4)
MaxParticipantHi Henk, thats abolutely right. That is why I’am using a Pi3 as server part.
It is cheap, does not consume much power and it is configured for SMB and even Syslog too.A more specific post about the Pi is work in progress.
MaxParticipantHey Zoltan, it depends.
I think Matthias does have good experience with switch motors from TRIXBRIX.
The advantage for sure is that they are completely ready to be integrated.Personally I’am using “SG90 Micro Servo Motor”. It is not a tragedy if a motor gets messed up.
They are very cheap and can be modified in a way that they fit very good between two Lego “Panel 1 x 2 x 3” as you can see above.EDIT: Bricklink Lego Switch Case
- This reply was modified 3 years, 3 months ago by Max. Reason: Link to Bricklink Case
MaxParticipantI’ve ran into the same bug like Zoltan described it in his post #2247.
Nevertheless if you fix the .motorShieldType into “MotorShieldType::L9110” the Sketch runs trough Arduino IDE like a charm.For the sake of completeness I’ve tested two different 8266 NodeMCU Versions.
Both without any problems so far.- This reply was modified 3 years, 3 months ago by Max.
MaxParticipantrelease 0.3.1 (presently scheduled for Sunday or next week)
Hi Mattze,
any releasenotes prior to the release? Just asking for a friend 🙂
MaxParticipant— Arduino IDE
Setting up your computer:
– For a connection to the Arduino CH340G to USB, you need to install drivers on your computer.
A guide can be found here: GuideSetting up Arduino IDE:
– Please read the controller sections of the web page very carefully
– A guide how to setup IDE for a basic ESP8266 based project: Guide2
– tinyxml2 library: https://github.com/leethomason/tinyxml2
– Syslog library: https://github.com/arcao/Syslog
– any other missing libraries can be installed via IDE Library Manager– setup Baud rate for Serial Monitor correctly (e.g. 115200)
Bugs and Errors:
– ESP32 “A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header”
-> FIX: Hold down the “BOOT/FLASH” button in your ESP32 board while uploading a new sketch at the same time.
– If you encounter problems with WIFI connectivity (version 3.0.0 of ESP8266) consider a downgrade to 2.7.4 of the boardMaxParticipantAfter replacing the 8266 V3 to a V2 NodeMCU it works and I’am realy proud of it.
Concidering the fact that I’ve never “programmed” an Arduino board before the MattzoControllers I’am realy proud about the result:Maybe the final casing:
Max
MaxParticipantHey Piet,
you are absolutely right! Of cause there is enough power input from USB connection.
In the meantime I’ve found a little sketch for ESP32 and adapted it for ESP8266 to test basic functionality of the servo.
The outcome is the same. Via console its clear that the sketch works and the ESP “does something”.
But the power output is not enough for the servo.I’ve ordered ESP8266 V2 and will test again with it.
Here you can find the servo_test sketch:
#include <Servo.h> //Servo library for 8266 static const int servoPin = D0; // Connect servo (orange) to D0 on the board Servo servo1; //Connect the servo1 on VIN and G int angle =0; int angleStep = 5; int angleMin =20; int angleMax = 160; void setup() { Serial.begin(115200); servo1.attach(servoPin); } void loop() { for(int angle = 0; angle <= angleMax; angle +=angleStep) { servo1.write(angle); Serial.println(angle); delay(20); } for(int angle = 180; angle >= angleMin; angle -=angleStep) { servo1.write(angle); Serial.println(angle); delay(20); } }
MaxParticipantHi Matthias, hey Thorsten,
Piets Problem looks like mine.
As enaugh voltage is crucial at the SwitchController, can we somehow modify the layout to a more capable power source?I would like to test it with eight AAA 1.2V batteries but i do not know how to chsnge the layout by now.. 🙂
MaxParticipantHey Piet, as far is a know that is right sir.
MaxParticipantHi Paul,
as your problem with the SwitchController sounds exactly like mine in the MQTT thread, i would like to know which board and power supply (with specifications) you are using? 🙂Many greetings! Max
MaxParticipantHallo nochmal!
Bitte entschuldigt, wenn ich es euch nicht leicht mache!
Ich habe folgendes gemessen:
An VIN und G liegen ~1.9V an. Hier ändert sich auch nichts wenn eine Weiche geschaltet wird.
An D0 liegen ~0.2V an. Hier gibt es eine kurze Schwankung (+/- 0.1V) wenn geschaltet wird. 3.3V werden jedoch nicht erreicht.
Das Verhalten kann an D1 reproduziert werden. Also wird je nach Port in Rocrail schon der korrekte DX angesteuert.
Nur nicht mit genug Spannung.
An 3V und G liegen 3.3V an.Habe ich unter Umständen ein ungeeignetes Board erwischt?
Es ist ein “NodeMCU Lolin V3 Module ESP8266 ESP-12F WIFI Wifi” von AZDelivery.MaxParticipantHallo Thorsten,
vielen Dank für dein Feedback!
Ich werde morgen mal mit einem Digitalmultimeter messen. Dann sollte ich mehr Infos liefern können.MaxParticipantIch habe den Controller via USB am PC angebunden um via Arduino IDE Monitor die Ausgabe des Controllers zu prüfen. So wie es aussieht, empfängt der Controller die Kommandos und möchte den Servo stellen. Der Servo bewegt sich aber nicht.
Received MQTT message [rocrail/service/command]: <sw id=”sw1″ cmd=”straight” manualcmd=”true” forcecmd=”false” controlcode=”” slavecode=”” server=”infw76300B2C” iid=”” prot=”D” uidname=”” bus=”0″ addr1=”38853″ port1=”1″ gate1=”0″ param1=”58″ value1=”85″ delay=”500″ actdelay=”true” singlegate=”false” accessory=”true” porttype=”0″ decid=””/>
Parsing XML successful.
<sw> node found.
addr1: 38853
port1: 1
cmd: straight
param1: 58
value1: 85
Turning servo on port 1 to angle 58Spätestens jetzt bin ich jedoch komplett überfragt.
MaxParticipantHallo Matthias,
mit deinen Videos auf YT hast du mich motiviert eine teilweise Digitalisierung der Legobahn von mir und meinen Kindern zu beginnen.
Angefangen habe ich mit einem SwitchController der bisher eine Weiche schalten soll.
Leider bewegt sich der Servomotor nicht. Ich habe in diesen Thread gepostet da ich aufgrund fehlender Kommunikation vermute, dass es sich um ein MQTT / Rocrail Problem handelt.
Die Ermittlung der Ursache jedoch der Reihe nach.– Rocrail und MQTT Server ist ein RPi3. Rocview läuft auf einem Windows PC.
Unter Rocrail -> Services ist der MQTT Service eingerichtet (getestet einmal mit 127.0.0.1, der IP des RPis und des Hostnames des RPis).
– Die Weiche ist in einem einfachen Gleisplan eingerichtet mit der Controller ID und der Portnummer 2.
– An dem Controller selbst ist der Servo an Port D1 angeschlossen.
Der Controller hängt an einem Netzteil für Smartphones (5V, 2.0A).Ändere ich den Status der Weiche mit einem Mausklick, bekomme ich folgende Log Meldungen:
– mosquitto_sub
Keine ausser PINGREQ und PINGRESP– mosquitto -v
Sending PINGRESP und Received PINGREQ to / from Controller.– Rocrail Server
0210126.105832.182 r9999I 768FF460 OSwitch 2150 switch [sw1] field event: state=straight(field:straight) gatevalue=1 inv=0 fieldstate=straight
20210126.105832.183 r9999I 768FF460 OSwitch 0180 CTC LED: m1=0 m2=0– In tcpdump schneide ich den Netzwerkverkehr zwischen MattzoController und RPi mit
Ich würde einen Befehl von MQTT zu Controller erwarten. Diesen sehe ich aber nicht.Wo könnte ich wohl nach dem Fehler schauen?
Vielen Dank für eure Hilfe!
Bitte bleibt an diesem großartigen Projekt dran!
Das ist eine Art Neudefinition von LegoCity Zug und ist einfach fantastisch!Grüße Max
- This reply was modified 3 years, 3 months ago by Max.
-
AuthorPosts