Welcome to MattzoBricks › Forums › MattzoBricks General Forum › MattzoBricks Train Automation for Beginners
- This topic has 11 replies, 5 voices, and was last updated 2 years, 2 months ago by Andrew Hewitt.
-
AuthorPosts
-
-
February 3, 2021 at 19:59 #2223MaxParticipant
Here is a step by step guide for everyone who is totaly new in MattzoBricks train automation.
I’ll edit this topic and add helpful hints step by step.What you need to start with train automation:
- Windows PC or Raspberry Pi for Rocrail and MQTT (please find further tipps in the corresponding section below) - Electronics - Software - WiFi (e.g. your home network)
— Software
- Arduino IDE (to programm your MattzoControllers) - MQTT (communicates between Rocrail and MattzoControllers) - Rocrail (Server and GUI for your Lego automation environment) - Mattzobricks firmware
— Electronic components
- Breadboard Kit - Resistors Kit - NodeMCU Module ESP8266 ESP-12F Wifi - or NodeMCU Module ESP32 Wifi Bluetooth (CP2102) - add L9110S Motor Driver Controller if you want to directly controll the motor of your trains - add a servo motor for instance SG90 Micro Servo Motor 9G or one from TRIXBRIX for LEGO switches - digital multimeter (helps to find problems :))
— Raspberry Pi
- at least a Pi 3b newer - MQTT (Mosquitto) - Rocrail - Latest Raspbian (tested with 2020-12-02-raspios-buster-armhf-full)
— Troubleshooting Guide
Step by step how to troubleshoot a MTC4PU. Scenario: My loco does not move at all. Controller is a MTC4PU without Status LED connected to a USB power supply (bare Controller). 1. Verify whether the MTC4PU does have basic network access. -> via ICMP from your computer, from the GUI of your Wifi equipment, Console of Arduino IDE or the Syslogserver the MTC4PU is using (if configured) -> related source is: MattzoController_Network_Configuration.h and MTC4PU_Configuration.h Example: pi@raspberrypi:~ $ ping 10.1.1.55 PING 10.1.1.55 (10.1.1.55) 56(84) bytes of data. From 10.1.1.201 icmp_seq=1 Destination Host Unreachable 2. Verify connection between the MTC4PU and the MQTT server. -> via Arduino IDE Serial Monitor, Syslogserver and MQTT server log -> related sources: MTC4PU.ino, MTC4PU_Configuration.h and MattzoController_Network_Configuration.h Example: From MTC4PU: MTC4PU61785 MTC4PU <lc> node found. Processing loco message... MTC4PU61785 MTC4PU loco id: Loco1 MTC4PU61785 MTC4PU addr: 6197 MTC4PU61785 MTC4PU Consuming message for train Loco1 (6197) OR MTC4PU61785 MTC4PU Message disregarded, as this controller does not handle train 1337 From MQTT: New connection from 10.1.1.55 on port 1883. Socket error on client MTC4PU61785, disconnecting. 3. Verify connection between Rocrail and the MQTT. -> via MQTT and Rocrail server log -> related sources: your MQTT and Rocrail server configuration Example: From MQTT: New connection from 127.0.0.1 on port 1883. New client connected from 127.0.0.1 as RocrailService (c1, k60). *127.0.0.1 means Rocrail runs on the same server as MQTT. From Rocrail: mqttread OSocket 0721 Other side has closed connection. mqttread OClntCon 0896 mqtt broken socket 4. Verify connection between Rocrail and the MTC4PU. -> related sources: your MQTT and Rocrail server configuration, MattzoController_Network_Configuration.h Example: From Rocrail ... addr=6197, protocol=default, calculated speed=63, command=- V=25, dir=fwd, lights=off... From MTC4PU: MTC4PU61785 MTC4PU Loco 1: Loco1 (6197). Target speed: 25, current speed: 25, max speed: 100
-
February 4, 2021 at 09:29 #2244MaxParticipant
— 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 board -
February 5, 2021 at 11:26 #2268Henk van LingenModerator
Small note; of course it is not necessary to use Windows for Rocrail or Mosquitto. You can also use a Linux system (I do). If you plan to use the syslog functionality, a linux box for that seems simpler.
-
February 5, 2021 at 11:50 #2269ZoltanParticipant
I also (plan to) use Linux (Debian 10) for Rocrail and mosquitto.
Everything installed, Rocrail is working (WLAN, w/ DR5000, w/o MQTT).
So a Linux aspect would be also appreciated (for those things, where it differs from the Windows world).
I eagerly wait for having Rocrail working with Mattzo Controllers on MQTT without any other CommandStation (DR5000 or whatever).
Especially the MQTT part is (a bit?) misty for me…- This reply was modified 3 years, 7 months ago by Zoltan.
-
July 20, 2022 at 18:30 #5350Andrew HewittParticipant
How do i do that to use Rocrail and Mosquitto on Linux. I have a chromebook with linux inside
-
February 5, 2021 at 11:50 #2270MaxParticipant
Hi 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.
-
-
March 11, 2021 at 23:13 #2728Mike YoungParticipant
Hello!
I’m collecting components for this project (love it all BTW!) and wound like to use my Mac Mini Server to run Rocrail since it’s on all the time anyway. I see that they do have an installer for it but maybe there is another reason I cannot? Is anyone doing this? -
March 12, 2021 at 08:00 #2729ZoltanParticipant
Best to ask for help in the rocrail forum.
-
March 12, 2021 at 18:09 #2731Mike YoungParticipant
OK, I would also like to ditch the PUP hub due to battery size limitations. Has anyone wired a PUP train motor directly to a motor sheild? I would like to run x8 rechargables and a Mattzocontroller in each train same as the PF solution. Thanks for your help!
-
-
March 12, 2021 at 20:06 #2732ZoltanParticipant
I find the price of the PUP Hub a robbery. 50 € for an empty plastic box with a 50 Cent bluetooth receiver inside is a no-go.
I don’t know what current the black PUP motor draws, but if under 800 mA then it goes direct with an L9110 and MTC4PF. If it draws more, use an L298N H-Bridge instead of the 9110.
I use an ESP and an L9110 with PWM with MTC4PF with Rocrail for controlling the G-size motor in my test loco (see video), and another sketch with PWM via Z21 App for direct manual control of the crocodile motor without Rocrail. MTC4PU is a great software for an IMHO useless hardware – great only for locos with already built-in PUP Hub. Otherwise use the equally genial MTC4PF without all the bluetooth garbage.
-
March 13, 2021 at 05:50 #2733Mike YoungParticipant
LOL,Yes! agreed. Hey, if I bricklink my old hubs then I can afford to outfit my whole fleet with Mattzocontrollers! Muhahaha
Would you know the correct wiring from PUP train motor to ESP? Just VCC & Gnd? I love that you guys tinker with more than just “official” parts here. -
January 4, 2022 at 20:07 #4548MaxParticipant
— Possible Layout Controller Settings (not for TrixBrix Servos)
//Controller1
const int SERVO_MIN_ALLOWED = ; // i.e. 80
const int SERVO_MIN = 85;
const int SERVO_START = 92;
const int SERVO_MAX = 98;
const int SERVO_MAX_ALLOWED = ; // i.e. 105//Controller2
const int SERVO_MIN_ALLOWED = ; // i.e. 80
const int SERVO_MIN = 84;
const int SERVO_START = 92;
const int SERVO_MAX = 100;
const int SERVO_MAX_ALLOWED = ; // i.e. 105
-
-
AuthorPosts
- You must be logged in to reply to this topic.