Update! Added a change log, see at bottom of page
The Hectorrail 141 is a locomotive designed more for function than scale, but keeping a scale-like look. It is slightly smaller than scale to function better on the track. The electronics is very simple yet very powerful at the same time. A NodeMCU with a built in wifi access point and web server controls LED's and motor through a Dual TB6612FNG motor driver from Sparkfun.
This is a part of the OS-Railway system, intended to be a complete 3D-printable railway system. You can find the main track page here: https://www.thingiverse.com/thing:2146361
I hope I have included everything but reservation for errors, don't hesitate to ask in the comments if something is unclear! :)
The NodeMCU ESP12E is a very powerful little board equipped with a ESP8266 Wifi module. NodeMCU has their own script language but thanks to some hard working enthusiasts, it has been ported to Arduino as well. (see below on this page the simple steps you need to follow to use it with the Arduino development software.)
In the supplied code, the NodeMCU board acts as a wifi access point. This means that it creates its own wireless network that you can connect any wifi-equipped device with a browser to. When you open the browser and type in the web server IP-address (192.168.4.1) a web page with buttons and controls is sent to the browser from which you can control lights and the motor. The program is very small given the very powerful task it executes, thanks to libraries taking care of all the wifi-related stuff, so even if you have limited experience with Arduino, you should be able to understand the code and tinker with it.
Designed using Fusion 360. Big thanks to Autodesk for providing it for free for hobbyists!
Printing and assembling
The parts are especially adapted for the Prusa i3 MK2 print bed and the length is just enough to be printed diagonally on the bed. But in order to be able to slice it, you need to turn off brim and skirt.
Print settings are not critical for this print, although support is needed for the main body part. Print the drivers cabins standing up for best result, if you print them laying down the layer edges will be more visible.
I will include divided main body parts and chassis for the case you have a smaller print bed so stay tuned if that is the case, in the mean time I suggest you check out NodeMCU if you haven't done so.
- The following combinations are suggestions based on the assumption that you intend to run it with maximum 2-3 cars. If your goal is to build a long train with many cars, you should already consider more powerful options. I will expand this to include other motor mounts and other suggestions as well.
Expected performance, given nominal load on motor, for the fast version would be around 0,8m/s and 0,25m/s for the slow but more powerful version. NOTE! these are theoretical values and depends on load, slope, quality of the build etc, yea I know.. you get it. You can order the following motor+gearbox combinations online directly from the manufacturer, Maxon. These are high-end motors and not cheap, if you want to go low-budget, start by searching on ebay but be prepared to make your own motor mount.
6V combination for high speed, low load
Combination number: 608325 (available shortly on www.maxonmotor.com)
Consists of RE16 motor #320175 and gearbox GP16A reduction 5,4:1 #118184
6V combination for high load, low speed
Combination number: 397611 (enter number in search field at www.maxonmotor.com)
Consists of RE16 motor #320175 and gearbox GP16A reduction 19:1 #110322
12V combination for high speed, low load
NOTE! NodeMCU cannot handle 12V, so this is just to show which winding is chosen, and when running it on 2s lopo (8,4V fully charged) you will get a lower RPM, but fully functional).Combination number: 369582 (enter number in search field at www.maxonmotor.com)
Consists of RE16 motor #320177 and gearbox GP16A reduction 5,4:1 #118184
12V combination for high load, low speed
NOTE! NodeMCU cannot handle 12V, so this is just to show which winding is chosen, and when running it on 2s lopo (8,4V fully charged) you will get a lower RPM, but fully functional).
Combination number: 398764 (enter number in search field at www.maxonmotor.com)
Consists of RE16 motor #320177 and gearbox GP16A reduction 19:1 #110322
Recommended workflow for building
1.Print major parts (Note: chassis had an error, and have been updated to iteration #4.) Print the chassis, main body and two pcs of the drivers cabin and the roof. if you use a prusa i3 MK2, use the prepared STL's with the body and chassis turned 52 degrees. To save time, you can print the chassis, main body and roof at 0,2mm layer height and the cabins with 0,1 as they are more demanding to get a nice surface. The gap longitudinal gap between the roof and the body is intentional and not a printing precision error. It serves two functions, first of all it is actually scale like, but it has an important function. On the RC6 I found out that the roof is tricky to remove, if one side is lifted before the other, it can damage the parts. The gap between the roof short sides and the body part will ensure you can safely lift the roof on one side and take it of without being extra careful.
2. Electronics When you see that your prints came out OK, complete the electronics before gluing all the parts together. Depending on the chosen filaments, the cabins are likely to be somewhat transparent so in order to avoid ugly looking light spill you can paint the inside with black paint as shown in the included pictures. The holes for the LED's are painted as well before the LED's are inserted, then the back of the LED's are painted as well. Why is there no hole for battery cable from the battery bay? you might ask,
it's because you can choose your self how to install this. Depending on if you want to glue a connector directly there, or if you want a cable throughput, just drill a hole where it suits you. It's not critical where. On the prototype, I've just used it with the battery inside the cabin.
3. LED's When the LED's are in place in the driver cabins and cables have been soldered, glue the cabins to the main body. "Super glue" (Cyano Acrylate) works really good for PLA, but there are other alternatives as well.
4. NodeMCU Connect the NodeMCU, the motor controller and the LED's on a prototype board BEFORE you make a mother board or solder these firmly. In this way you can make sure the right LED's are lit, and that the polarities are correct. Note the connections or put stickers on the wires so you keep track of which cables go where. Follow the steps further below on this page for programming the NodeMCU. There are also many good tutorials available on youtube for NodeMCU and Arduino.
5. Motorized boogie Print the parts for the motorized boogie. Depending on your printer, the wheels probably have to be drilled out with a 3mm drill to make them fit a 3mm carbon shaft, but drill very carefully as you want them to sit tight. When the measurements are correct you can use a drop of CA to secure them, but be careful not to get CA into the ball bearings so do this with the shaft without the ball bearings attached. The dimensions of placement of the gears is indicative and you may have to adjust them depending on the tolerances of your prints. If you have trouble getting the 4WD-system working, try just powering one shaft to begin with. You can also sand the gear teeth to remove any imperfections that might make the assembly go rough. There should be play between the gears, don't place them firmly against each other. Building the motorized boogie is the hardest part of the whole build, it might take some testing until you get the positions right, so don't give up! Put O-rings or rubber bands on the wheels for traction.
Note! The pre-assembled build plate STL contains 3pcs gear for 2mm shaft, and 3pcs gear for 3mm shaft. This is because the prototype has a motor with 2mm shaft. The combinations suggested above has 3mm shaft so either drill one of the gears to 3mm or print another one.
6. Non-motorized boogie Print the second non-motorized boogie. Hint: You can use the same wheels as for the motorized boogie with O-rings also for this one if you want to make the locomotive run smoother and quieter, or you can of course build two motorized boogies to increase power output and traction.
7. Roof stuff If you want to add the power source arms to the roof, print the build plate named "roof stuff" 2 times. A thin piano wire (for example 0,5mm) is used according to the supplied picture. Getting the right lengths can take a few tries. The parts are glued using CA.
8. Bumpers Print the bumpers and assemble. They are mounted using M2 screws and the extensions can be either loosely inserted or glued with CA. Note that the aft ones might interfere with the car coupler depending on which cars you use, you can solve this by cutting away a bit of the underside of the bumper extension plates if needed. I have lowered the mounting hole for the coupler in order to solve this problem I had on my prototype.
9. Windows You can choose either to print the included solid windows if you don't plan to make any interior, or use clear plastic. A tip is to print the solid ones and use as templates when making other windows.
10. Cars No train is complete without cars, here are two compatible ones:
Click here for freight car chassis
Click here for hopper car addon
Click here for tanker car
Also, keep an eye on the main track page for updates with additional track pars:
Click here for main track page
- 1pcs NodeMCU ESP12E or similar ESP8266 equipped development board.
- 1pcs Sparkfun motor driver - dual TB6612FNG (1a)
- Battery pack. Prototype runs on 4 NiMH cells, you can also use a 2S 7,2V LiPO-pack. Motor board should be OK with 3S, but in most cases depending on what motor you choose, 2S (2 cells series) will be enough. NOTE! The NodeMCU cannot handle more than 10V according to specification, so if you use 3S you can only connect it directly to the motor board, but you need a voltage regulator for the NodeMCU.
- 8pcs 6mm OD, 3mm ID, 2,5mm thickness ball bearings
- 3mm carbon rod for wheel shafts
- 2mm carbon rod for connecting shaft if you want 4WD
- 16mm DC-motor and gearbox. Search ebay or you can purchase directly at www.maxonmotor.com detailed motor+gearbox suggestions to be added! If you are uncertain, ask in comments.
- M2 screws. Length is intentionally not critical in most cases. I have a big bag of countersunk 25-ish mm M2's that I cut to suitable length. This is way more convenient than trying to buy many different lengths
- M3 screws. 4pcs M3x20mm are used to mount the bogies to the center hub. The center hub is mounted on the chassis using an M3, but with no size restriction other than it taking up cabin space. One M3 is used to secure the car coupler, also this one can be long if you drill out the hole through the chassis. I try to design in a way that doesn't restrict the screw lengths whenever possible so you can use whatever lengths you have as long as they are long enough to do their job.
Add this line in Preferences
Go to Tools -> Boards -> Board Manager and scroll down to the esp8266, click on it and click install.
If you use the same NodeMCU board as pictured, select NodeMCU 1.0 and your'e ready to upload the code! Note that you might need to insall drivers, google for NodeMCU drivers for your operating system.
Regarding the library TimerObject
The code uses an Arduino library called TimerObject.
It can be found here: https://github.com/aron-bordin/ArduinoTimerObject
Extract all files in a directory called "ArduinoTimerObject" under your arduino install directory, example: c:\Program Files (x86)\Arduino\libraries\ArduinoTimerObject\
2017-11-17 Found an error in the chassis. Both boogies should be mounted on a round prost. One of these were accidentally removed when trimming the space for the boogies. If you have already printed the chassi, don't worry, you can put a piece of wood, plastic or whatever there to make the boogies level.
2017-11-14 New version of the motorized bogie published, it is included on this page as a zip-file, but also published on its own page:
2017-11-05 After having trouble with the motor pinion and first drive gear, I've updated these with sharper teeth and more ingress, and a drive gear with more teeth (14 instead of 10). STL's are called:
3mm 14t bevel gear upgrade.stl
3mm 10t bevel gear upgrade.stl
Use this motor mount even if you use a different 16mm motor, this motor mount has more room for the pinion because of the fact that the 14 teeth drive gear is bigger in diameter.
Keep in mind that the pinion is for motor with 3mm shaft, let me know if you need another diameter.