T-TRAK U-TUBE
T-TRAK U-TUBE
  • 3
  • 3 722
Controlling turnouts with servo motors from JMRI with MQTT
This video shows how I am controlling turnouts with servo motors connected to a NodeMCU ESP8266 which is similar to Arduino devices.
Turnouts are controlled using JMRI which means you can just tap a layout diagram on your phone to throw the points.
Communication between JMRI and the NodeMCU is MQTT (messaging) over TCP/IP using the NodeMCU's inbuilt WiFi so the only wires to it are DC power.
This does not use DCC. It is totally independent of track power. Although it uses JMRI, it can be used on any DC or DCC layout. It does not use DCC stationary decoders for the turnouts. Of course, you can add a DCC connection to run your trains.
Timestamps to fast forward
00:00 Into
00:37 The test track - 2 half=depth, triple length T-TRAK modules
00:55 Fitting a servo
01:37 The NodeMCU - the brains driving the motors
04:01 About MQTT
05:59 Getting it working with JMRI
08:56 MQTT Explorer - watching the messages
11:51 Wrap up - what you get for less than $20
Equipment:
- 9g servo motors - NodeMCU ESP8266 controller, now superseded by ESP32
- PCA9685 16 channel PWM servo controller
- SPDT microswitches (for frog polarity)
- servo mounting bracket - I've designed and 3D printed my own
- 5V and 6V power supplies. You can probably use one power supply though the servos create "noise" on the power which may impact the NodeMCU. You can smooth the power with a capacitor but "best practice" is to use separate power supplies.
Software:
- JMRI. Note: At the time of creating this video, JMRI (version 4.19) on Windows computers requires JMRI to be run as administrator for the MQTT connection to be established. I normally use Linux systems so haven't had that issue.
- MQTT broker. I use and recommend Mosquitto, This can run on the same computer as JMRI or any other of your choice. It is a light weight messaging system so will happily coexist with JMRI
- Sketch for the NodeMCU.
The test track being used has 5 Peco electrofrog turnouts with Peco flex track. The base is two triple length, half depth T-TRAK modules, hence the short lengths of Kato Unitrack at the ends. I have run big locos with 60ft container wagons and little shunters (switchers) with underweight 4 wheelers through all these turnouts with all going very smoothly through. So that's a gold star for the test, now to progress to my main yard.
The set up as demonstrated costs about $17 Australian or about $3.50 per turnout which includes the servo motor, microswitch and the controller boards. I have not included the cost of power supplies because there are many way of doing this and each person's situation is different.
I use a 12VDC power bus with a cheap buck converter to drop this down to 6VDC for powering the servo controller and servo motors. I use a separate 5VDC power supply for the NodeMCU. If you have a big demand for DC power, using a computer power supply is worth considering to give you several different voltages and lots of amps.
I give a big thank you to Speed Muller for his guidance through this. It is not my invention.
Переглядів: 2 947

Відео

PSX AR demo with Kato turnout
Переглядів 5346 років тому
This video demonstrates a PSX-ARSCFB auto reverser linked to a Kato Unitrack turnout. The two sidings are part of the reversing section under control of the PSX-AR and the turnout on the mainline is also controlled by the PSX-AR. The reversing section and the turnout toggle together whether it be by a train entering the reversing section or by setting the turnout by it DCC address. The isolatio...
T TRAK at Sandown 2018
Переглядів 2426 років тому
Driver's view of a lap of the T-TRAK exhibit at Sandown, March 2018

КОМЕНТАРІ

  • @raymondjackson6069
    @raymondjackson6069 Рік тому

    Hello, hello... anybody home? Hello?

    • @t-traku-tube5883
      @t-traku-tube5883 Рік тому

      I'm planning to redo this with a proper commentary.

  • @hackforfood-n5s
    @hackforfood-n5s Рік тому

    Do you have the aurdino sketch for this?

    • @t-traku-tube5883
      @t-traku-tube5883 Рік тому

      Apologies for the slow response. The sketch used was very much work in progress and not fit for publishing. A small part of the code was not mine so not mine to publish. The sketch was abandoned. I switched to mqTrains, available as a binary image at mqtrains.com.

  • @jamessutton9319
    @jamessutton9319 4 роки тому

    Would be interested to see how to configure the Mosquitto MQTT broker and any additional Sketch samples you can provide.

    • @t-traku-tube5883
      @t-traku-tube5883 4 роки тому

      James, I don't do any configuration with the broker, just install it as per Mosquitto instructions. You can do things like require a login to connect but I don't bother with that (even though I'm ex-IT with significant focus on security!). I have recently done an NMRAx presentation on MQTT - ua-cam.com/video/3lu0SZ9wjj0/v-deo.html . In that there is mention of a better sketch (mqTrains) than mine being prepared. Rather than finish off my sketch, I'm putting my efforts into helping with mqTrains.

    • @jamessutton9319
      @jamessutton9319 4 роки тому

      @@t-traku-tube5883 I have two more questions after watching that video. 1. Is that project still on track for releasing something before Thanksgiving? 2. Where can we expect to see it when available? Website? UA-cam channel?

    • @t-traku-tube5883
      @t-traku-tube5883 4 роки тому

      @@jamessutton9319 Hopefully by Thanksgiving but no guarantee. I will post details here when released.

    • @t-traku-tube5883
      @t-traku-tube5883 3 роки тому

      Well, clearly we didn't make Thanksgiving and a few distractions since then. Release of a binary upload for the ESP is imminent. Keep an eye on mqtrains.com. We use a simple loader program (not ours) to upload the binary. Code will be released a bit later.

    • @jamessutton9319
      @jamessutton9319 3 роки тому

      Any chance of getting the source code for those of us who understand that side of things?

  • @davidlesnick1487
    @davidlesnick1487 4 роки тому

    Very nice concise video. I am curious if the sketch you used for programming the NodeMCU is downloadable someplace.

    • @t-traku-tube5883
      @t-traku-tube5883 4 роки тому

      Sorry, my sketch is work in progress and needs more work to release. I may be switching to a different sketch.

  • @heavyj4805
    @heavyj4805 5 років тому

    thank you so much for showing this.... I almost decided not to use unitrack till I saw this.

  • @conecuhvalleyttrak
    @conecuhvalleyttrak 5 років тому

    Nice layout! 😃👍

  • @haydnbold
    @haydnbold 6 років тому

    very nice.