Loading

NodeMCU and Wifi

Please Login to Comment

All questions and discussion regarding the use of the NodeMCU and wifi for the trains. It's not limited to the Hectorrail 141, the same board and code can be used with any of the locomotives with the only change being the LED's.

Would you be able to upload links to the board, wifi module, motors, ball bearings, and axle here?

Yes!

NodeMCU: https://www.ebay.com/itm/NodeMCU-Lua-WIFI-Internet-Development-Board-Based-on-ESP8266-ESP-12E-CP2102/262491147220?epid=1374522790&hash=item3d1db10bd4:g:zX4AAOSwjXRXZ7Jt
(Not really sure what you mean by board and wifi-module? they are integrated).

My prototype is powered by a Maxon DCX16 and a one-stage gearbox 6,6:1 and it's too fast, I'm going to change to a two-stage gearbox 16:1 instead, better have more stable performance and more pulling power than a top speed that makes it fly off the track in the curves. :)
I would recommend the following as a more high-end alternative to the combinations already mentioned on the description page:
DCX16S with GPX16 gearbox 16:1 reduction. Will give between 55 - 80cm/S speed and roughly 50N pulling force (which is a lot! and a conservative number). You can order it here: https://www.maxonmotor.com/maxon/view/configurator/?ConfigID=B774550A71D0

Ball bearings (NOTE! this isn't critical, dummy bearings of PLA drilled to have at least a little bit of play and lubricated with suitable lubricant will give really low friction unless a very heavy load is placed on the car/locomotive): There are lots of sellers of ball bearings with 6mm OD, 3mm ID and 2,5mm thickness, there for I'll post a link to an ebay search here: https://www.ebay.com/sch/i.html?_odkw=ball+bearings+6x3x2.5&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.Xball+bearings+3x6x2.5.TRS0&_nkw=ball+bearings+3x6x2.5&_sacat=0

LED's: These are so inexpensive these days so I would recommend to buy a bunch at once, these kits are nice, because chances are you want to build many things with lights in right? :)
https://www.ebay.com/itm/300pcs-10-value-Five-Colors-3mm-Round-Bright-Light-LED-Diode-Lamp-Assortment-kit/301829705720?epid=702796036&hash=item464673cff8:g:zJQAAOSw1S9WdOWo

Wheel shaft: I use carbon fiber rod, not because it's the best, just because I had it at home and it's easy to cut in wanted length, especially since I'm working in the living room of my apartment often late at night so I can't make a lot of noise grinding metal... A steel shaft would probably mean lower friction if you choose to use PLA bearings. If you search on ebay for "Stainless steel shaft" you will get tons of hits, so choose a suitable length according to your need. https://www.ebay.com/sch/i.html?_odkw=3mm+steel+pin&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.X3mm+stainless+steel+shaf.TRS0&_nkw=3mm+stainless+steel+shaft&_sacat=0

Thank you! Most of the parts are on order. All the parts for the locomotive (and at least one passenger car, maybe more) have been printed, electronics on order and in the works. I should let you know that I am in the process of making a large-scale railway with your designs. I plan on potentially running it along the ceiling of my school's printing lab, possibly bringing the track "into a valley" and creating a small 3d printed village along the route. I also hope to create an app to control the train based on the NodeMCU and Arduino script you coded. I will definitely keep you informed on my progress!

Oh that's awesome. No I mean AWESOME. :) You actually brought up one topic that I was thinking about for a couple of month ago but it had slipped my mind, I was thinking of a way to store the trains and cars while I don't have a layout running, and the idea was to build track in the form of shelves on the wall in several levels to accommodate all rolling stock while not in use.

A couple of ideas you might be interested in, I plan to include an inductive sensor and a magnet holder on the track. It can be used to sense for example a train station. I'm also working on adding NodeMCU to the turnouts, because they were available for a reasonable price on wish and ebay, it makes sense to use them as well in the turnouts. So the long term plan is not to have the web page in the train itself (although that option will of course still be available) but what I want to do is to have all the trains and turnouts (and possibly other stuff) connected to a router, and from one centralized app/webpage be able to monitor and control all of them. I even came up with a crazy idea yesterday, what if you put an IR-transmitter and an IR receiver in the boogie, you should be able to register the sleepers, and combined with a sensor telling the controller when the train is turning, the train would be able to completely map the entire layout by itself. :) This is way down the track, but I'm throwing this idea out here because I know there are a lot of electronics folks out there that might think the programming and coding is more fun than CAD, and could pick this up. :) I will at least provide the foundation by adapting my designs to include the needed sensors, then time and interest will tell how far this will go in terms of software. But I'm optimistic, because these NodeMCU boards combined with Arduino are so simple to use, such a tiny code to make it run (given how complex the task really is). So that lets enthusiasts focus on the fun part of the coding, the actual thing that's supposed to happen, instead of worrying about wifi TCP/IP-stacks and what-not. I anyway plan to have two code versions, one AP (access point) where the functionality is like it is now, you connect a phone or tablet directly to the train. And I plan to have a node-version, where the train needs to have an already present wifi network to connect to.

Thank you! I'm not completely sure where in the school I will set up the layout. For the time being, I have been working on printing a lot of track, just finished printing the locomotive and car. I have been thinking of centralizing the turn-off controls, like you said, based on a second NodeMCU and cervo motors. My current idea is to route the NodeMCU control and have the control of both the locomotive's movement and the layout of the switching segments of the track controlled through a single app. My thought is to have the app have a tab for controlling the locomotive, and a tab for the layout. I also am going to paint the locomotive, because I have lots of different-colored filament and some messy parts of my prints. I want to paint it in an Amtrak livery :) Kind of like what you are talking about. I have a lot of ideas like this, I'll let you know how things are going! How would you feel about corresponding over email about some of my ideas and progress? Just a thought :D

well, check out the Node-Red app. I use Hector Wifi locomotive with my custom firmware which connects to MQTT server and executes commands that are received as MQTT messages. Then I can control the train and everything else via any MQTT app on Android / IOS or via any app via any meaningful communication (http endpoints, ...) router via Node-Red (which has MQTT capability of course)

I can only recommend using Blynk (https://blynk.io/), really easy to build a tiny app to control the train: