Loading
Depronized

Hectorrail 141 Wifi locomotive for OS-Railway - fully 3D-printable railway system

by Depronized Oct 9, 2017
Download All Files

Thing Apps Enabled

Please Login to Comment

How many RPM motor do you recommend for high and low speeds. Thank you, great work

Hi, just one question, can the drivers cabins be successfully printed without support?

Great work

Many thanks

Thanks! They almost can, it's just the space for the light above the window that is problematic. If I remember correct, I used support on build plate only, because I think this part is extending backwards overlapping the "floor" of the cabin, so then you'll get a small part of support there instead of filling the whole thing with supports.

HI what do I have to do so that goes with the TimeObject.h. Unfortunately, I am even bloodier beginner

Hi! No problem. :) I checked on my workstation and the files are extracted in the following directory:
c:\Program Files (x86)\Arduino\libraries\ArduinoTimerObject
And it's not just TimerObject.h that is supposed to be there, all files from the zip:
https://github.com/aron-bordin/ArduinoTimerObject

thanks, now I still have the problem that he does not connect to the wifi. have the same ESP as you in the picture. there are any special settings in the arduino ide

Congratulations for your work, coincidentally I have also developed a train model with NodeMCU mini.
I used an old router and a page with jqwery lib that allows me to activate several locomotives and turnouts with servo in different IP at the same time:

$.get(url, {"mensaje"},Respuesta)

I used also the analog input of the module "A0" with a voltage divider to inform of the battery charge to the page,

void bateria() {
int sensorValue = analogRead(A0); //Lectura del ADC
voltage = map(sensorValue, 0, 1023, 0, 42); ////////Estudiar utilizar funcion map() 42= 4.2 v
server.send(200, "text/plain", String (voltage));
}

and this module for charging the battery with USB: https://www.ebay.com/itm/5V-Mini-USB-1A-Lithium-Battery-Charging-1s-1-cell-3-7v-Lipo-Charger-Module-Board-/191946469467

Notes:
The variable string_html can be stored in Progmem to save ram: https://techtutorialsx.com/2017/12/16/esp32-arduino-async-http-server-serving-a-html-page-from-progmem/
http://arduino-esp8266.readthedocs.io/en/latest/PROGMEM.html

Also the variable of the engine speed can be remapped, reducing the sending of values
In your code the variable it has 1024 levels, if it is remapped passes less values: analogWriteRange (50); would pass from 0 to 50 velocity values. and the process is faster.

regards.

Thanks! The battery voltage idea is really nice! Especially if using lipos, it's so easy to ruin the batteries, especially if kids are playing with the stuff and not shutting it of. This is why I've used basic batteries and not lipo cells for these initial projects.

Regarding the speed for the analogWrite, yes I guess the resolution is not really needed, however I don't see why it should be faster? it's built to have an intentional ramp, and it can of course be adjusted to taste. I started with what I thought would be a realistic acceleration/deceleration ramp, but it took so long so the train basically finished half a lap on the track before it stopped. :D

Also thanks for the tip about the string_html, that's very useful especially for bigger interface designed. This can be developed so much with just a bit of more time into it, I've just made the very basic to get it all going, but with not too much time it would be possible to code an "ATC" that can talk to several NodeMCU's, controlling for example switches and multiple trains. :)

Hi!
I'm almost ready to have this project complete, having only the motor to be bought. But finding one at a reasonable price has become a harder task than I thought.
I'd prefer the trains to have more load power than speed (but not too slow) but chosing one has been too challenging. What I find has too high reduction rates and thus slow speeds with a lot of torque, or too fast with not torque at all. And having the motor with 16mm is even harder.
I've accepted that I'll have to find a bigger motor and adapting the motor mount and given the parameters you've told in a previous conversation I have found this geared motor and would like to ask for your oppinion if (with a new motor mount) this could be a motor fit for the job.
http://www.robotshop.com/eu/en/12v-730rpm-278oz-in-hd-premium-planetary-gearmotor.html
It has a 16:1 reduction, 12V, 730rpm and with only "slightly" larger diameter (22mm).

Keep up the good work.
Best regards.

I understand. It's in my timeline to do a total remake of the transmission system to allow much bigger motors, but that will take a while. The motor you have there in the link is too long I'm afraid. There is a batch of really high-end motors sold for nothing on eBay right now, check these out: https://www.ebay.com/itm/ESCAP-16-Coreless-Cup-Gear-Motor-DC-12V-540RPM-Gear-Motor-With-Encoder-16MM/291634976134?hash=item43e6cc9586:g:g-4AAOSwVFlUI8VT the train will not be very fast with these, but considering the price i'ts a total bargain. These motors are like the Maxon motors also coreless and I can assure you these has cost 30 to 40 times more new from the factory. They even have an encoder so if you want, you can connect it to the controller and get real speed/position feedback to do speed control. There are libraries and tutorials for quadrature encoder for Arduino so it's not too complicated. If I didn't have access to the motors from work, I would buy 10 of those right away for future projects, because those must be leftovers from a scrapped project or a company that has shut down. A tip, if you are into fine mechanics, the motor in the link has a very special planetary gearbox construction that is made of stacked removable stages, so if I don't remember wrong you can remove a stage in that gerabox to reduce the reduction. But be aware, the gears are really tiny so make sure you have the right tools, lots of light and steady fingers, and work in a tray with edges because if you loose a gear or something you're screwed. :)

Hello,
I've fully printed out two of these (one for me, one for my son) and have made modifications to parts to allow easier assembly with my printer and it's tolerances. I'll definitely post pictures soon as I'm assembling them now (they roll on track and have the 4 wheel drive set up at the moment). Anyway, I commented here for two reasons;

Regarding the Maxon motors and your suggestion of 2-3 cars, is that with a faster or slower gearbox? Just wondering because I'd like to print all your existing cars and probably design another or two (and be able to pull them all).

As I said I remixed a lot of the parts (mostly moving mechanical parts) to make assembly easier for me. Do you mind me posting them as a remix? Eventually I want to make and post an American freight engine based on your model if that's OK with you.

Nice to hear! :) Regarding the motors, I ran mine with 6 cars at full speed for a while and the motor was extremely hot, so I was apparently overstressing it a bit. It's a DCX16 with GPX16 gearbox 6,6:1 reduction ratio. It's apparently not strong enough for that load so I would suggest a higher gear reduction, for example 16:1. But my plan is to do a remake of the transmission to allow much bigger motors, just haven't decided on how to solve the transmission yet, as the bogies need to both tilt and turn. Ideally it would be nice to be able to use like a 35mm brushless outrunner. But that is in the future, I don't have a plan for when, I have a couple of other projects I want to finish first.
You know what, after I'm finished writing this comment I will upload the motor mount in STEP-format so you can easier modify it.

So a suggestion would be to search ebay for 16mm motor with planetary gearbox like this one: https://www.ebay.com/itm/ESCAP-16-Coreless-DC-12V-Gear-Motor-With-Encoder-16MM-540RPM-NEW-ESCAP-Design/131574422838?hash=item1ea2725d36:g:YqQAAOSw1QpZ8peG and use that for the initial tests, and while you run it with that one, design a bigger motor mount. In that way you will be able to pull more load. You can of course also use two motorized boogies on the same locomotive, that would also help.

Regarding remix, of course! I've been hoping that others would join and post compatible stuff so it's very welcome. :) I have lots of interests so I like to draw and build some other stuff as well, not just this train system so it would be a bit sad if it's only up to me to publish things for it. :) I'm drawing for example a 60cm scale military waterjet-powered RC-boat right now also for 3D-printing.
Regarding america freight engine, I've been drawing a little bit on a GP38, maybe that is the kind of locomotive you're thinking of?
I have just started with the chassis, so tons of work left. But a tip there is not to go for scale, rather look at the geometry of Lego locomotives and make a compromise. The GP38 for exampl would be something like 40cm scale, and with the narrow track radius it would not work very well with pulling cars, so I reduced the scale and shortened it to 30cm length, that is what I've found works well with the track. The Hectorrail 141 being around that size, much bigger than that and it won't work well. My RC6 is an example, it runs but it cannot pull cars because the ends of it swings too far outside the track.

haha... I forgot that I had already uploaded the motor mount as STEP and Fusion 360-format. :) But it is on the motorized bogie page:
https://www.thingiverse.com/thing:2644082

Motorized bogie for OS-Railway - fully 3D-printable railway system

Just to make sure I'm correct. You're running the 6V Maxon motor #320175 with 5.4 reduction #118184 with a 6V NiMH battery pack in that video correct?

I think a GP38 is exactly what I'm looking at creating (or something very close to). Funny you mention the RC6 because originally I was going to make that one but I noticed it wasn't complete. Originally I wanted to create a whole system just like you have but for once in my life I thought, I bet someone's done this already and I don't need to create everything from scratch. You've done a fantastic job with this, this is honestly the first time I haven't done it all myself. I'm incredibly impressed.

I'll look up some motors. I'm not great with reading the specifications but I'll do my best. I'm also attempting to run off a 3s lipo with a buck converter to drop the voltage down for the NodeMCU. Hopefully it all works out. Just started with the electronics and software the other day. Making two at once makes the process a little slower haha.

No, I'm actually running a DCX16 and a GPX16 gearbox in the one in the video. I chose to suggest the RE16 instead because it is much cheaper. But I'm realizing now that pulling many cars is a too heavy job even for the DCX16 at 6,6:1 reduction as i have so I suggest a higher reduction ratio like 16:1 or 19:1. You need about 1000rpm on the wheels for 1m/s. So 0,5m/s = 500rpm is quite suitable I think, and if you use my gears from the updated bogie you have roughly 1,4:1 reduction ratio so 0,5m/s = 700rpm after the motor+gearbox.

I would say that these motor combinations with for example 5,4:1 is suitable for a tram or a short high-speed trainset with 2-3 cars maximum. More than that will mean that it's easily overloaded.

Don't hesitate to ask if you find a motor and wonder if it's suitable, I work with motors all day long so I can help you judge its suitability. :)
The hard thing in this is more to estimate the friction and load because of the 3D-printed transmission, so I think it will be a good idea to make a bigger motor mount and use much bigger motors to get both more torque margin but also being able to use simpler motors.

Where do I find the 'TimerObject.h' header file?

It is not with the ino file?

Regards

Chris

Hi!

A perfectly good question. I had completely forgotten that I installed that. :P
https://playground.arduino.cc/Code/ArduinoTimerObject

Will update the description as soon as I can!

Thanks for pointing this out!

Nice project - but could you give some more motor details? I realise that you work for Maxon but the motor and gearbox you quote are far too expensive to make this a realistic proposition...

Can you give some more details of required RPM of motor and gearbox? Looks like the motor you mention is a nominal 4,000 RPM with a gearbox of 5:1 to 9:1 reduction - so you are looking for approximately 400 - 800 RPM at the drive shaft? The 16mm is the motor diameter for your mount? I would be looking for a much cheaper motor/gearbox combination that I would make a new mount for.

Hi,

Of cource I understand that and this is 100% hobby project for me so I’m not under any obligations to favor Maxon here. We will try to see if it is possible to offer a discount on particular combinations for this project, but my gut feeling is that it will still be over the top for many. Anyway, good news is that other motors are already in tests! I will publish a new adjusted motor mount for a really cheap sollution as soon as I can, so check back here (will write in the change log) and I can write here too when it’s up. Your provided data are correct, and the latest improved gears are for 3mm motor shaft.

That is excellent news, thank you very much :)

I am a member of two model engineering clubs in the UK and we are very keen to get young people interested in engineering, and this is a perfect project - even for some of the older members, who currently build steam locomotives :)

I can wait until you have done some investigation and testing but do you think something like this would be any good?

https://www.ebay.co.uk/itm/DC-12V-2-1000RPM-High-Torque-Electric-Gear-Box-Motor-Speed-Reduction-Gearbox-/263216800032?_trksid=p5731.m3795

I will watch your progress with interest, but thank you very much for all your effort

Chris

Hi, that sounds very interesting! and I think it's a perfect thing to combine both mechanics and electronics. A thing that can be discussed also which is often overlooked, is adaptation for manufacturing process. Most older members will most likely be very well aware of what you need to think about when designing something for CNC milling for example. 3D-printing can sometimes mistakenly be described as a magical method free from these considerations, when in fact it's very far from. A very interesting subject of discussion can be to look at a complex model and think - how could it be designed to avoid any supports? overhangs? is any material going to be extruded in "mid-air"? Step two is strength considerations, take a chair for example and print it standing up and you can easily break of the legs and back rest, print it sideways and you can discuss how it suddenly got so many times stronger. These are just some of the considerations I take into account when making a design. Someone may say - how about SLA? you won't need those considerations there! truth, SLA and SLS has their own things to consider. Take closed spaces for example, an FDM can print a piece with a honeycomb infill-structure with air inside the void, an SLA or SLS cannot. The "void" will be filled with resin or powder. So you need to introduce draining holes. That is just one of them.

Regarding your motor, no it will not work because it's too big. The present motor mount is made for 16mm motor. A bit larger than that would be possible with a re-design of the motor mount, however too large will make it collide with things and restrict the movement of the boogie. The motor being tested is a 16mm DC-motor with planetary gearbox and 3mm shaft, I just need to make a new motor mount which brings the motor closer to the drive shaft because of different motor shaft length, but as soon as that's finished I'll publish both the motor mount and link to a suitable low-cost motor.

Hello again.

I see that in the main body printing you've printed the middle part without support as a bridge.
What are the settings you are using in slic3r to print the main body, e.g. overhang threshold, etc. Did the bridging of that middle part went perfect? I didn't wanted to waste so much filament to find it wont work!
I've made already the cabin parts and even though the prints were nice, they weren't perfect, and I'll have to trim a little the upper part to make it perfect, so I had to ask this before printing the main body.
Btw I have a i3 Prusa MK2S.

Keep up the good work!

Hi, sorry forgot to answer this one! The middle part of the body is indeed printed with support! I don't remember exactly, but almost all my prints are done with 0,2mm layer height. (or 0,25mm if I'm in a hurry). I use standard Slic3r settings for overhang thresholds etc.

Updated the design today with new gears, now it works really well with the DCX16 motor and GPX16 gearbox, I will post the exact combination tomorrow when I'm at the office.

Thanks! Let me know if you have any other questions "down the track" :)

Haj Olle!
Är du nu igång igen.
Lika cool konstruktion som vanligt!
Hadde ditt RC på Smalspårsträffen förra lördagen.
Det var mycket uppskattat.
Vi hörs snart igen.
// Gert

Tack! och kul att det är uppskattat. För de som inte har en printer så går det ju säkert att hitta någon som vill printa delar om någon vill ha det som grund att bygga på. En erfaren modellbyggare kan ju ta detta mycket längre än jag gjort om man lägger till mer detaljer på traditionellt vis. De 3D-printade delarna kan ju vara en bra grund, går ju ganska lätt att borra i och bearbeta.

Hi,
I have a question for you.
There is a very similar locomotive in Austria, ÖBB 1014/1114.
Can you make a few adjustments on your locomotive?
I'll send you a blueprint.
Thank you very much!
Best Regards,
Csaba

Hi, This one is an ÖBB, but I it is 1012. I googled the 1014 quick for pictures and it's quite some difference, mainly the drivers cabin. As you can imagine these projects take a substantial amount of time to draw and the shape of the driver cabin is the hardest to model. The thing is that it's not just to change it, as it's a complex mix of shapes, surfaces and features so even to change some small details would require substantial re-work in many cases because it breaks the references used by other features. Because of this, I will not do any modifications unfortunately, I simply don't have time.

Hi
Perfect system. I have myself made some trains in scale LGB and ferry in 1:87. I would like to know the precise scale of Your system (I guess that it is 1:45), but then I can change the scale of my models so they match OS-Railway.

Hi
Thanks! :) Yes the scale is 1:45, although precise is probably to stretch it a bit. :D I aim for that but then I adapt measurements to make it work. Function is priority over scale. The important thing is the track, the inner distance between the tracks is 32mm. But this locomotive for example is not scale, it's almost 10cm shorter than scale, to make it work better with the tight radius I have on the track, when pulling cars. Just the locomotive itself would work fine even in scale size, but the distance from the boogie centre point to the coupler attachment means that it will swing too far outside the track, it won't work, so that is why I reduced the size. Also if I make scale passenger cars for this one they would be too long to be practical, so I will make smaller ones. This is also the reason I've gone for short freight train cars up till now.

Oh, You have a good point and I agree with You. Focus shall be on function and printability before rivets counting. By the way. I sit in Denmark (Gedser), have a little house in Blekinge and family in Jönköping, so no problems with swedish if You have the need for a private message.
Regards
Torben

Wow....just wow. I have to try to make one of these...It's probably in the description, but what size print bed do you need?

I need a bigger printbed!

Actually, you don't. :) Open Cura, go to Preferences and uncheck "Automatically drop model on build plate". After doing this you can place the body and the chassis vertically and lower them in order to print half at a time! :)

Shhhh! It's a perfectly good excuse to upgrade ;)

haha, that is so true. :)

rpm motor recommend?

Apparently, I edited the answer too much and included link so my comment is flagged for moderation, check the page later today and I will add Maxon motor + gearbox combinations. ( I work for Maxon, at the Swedish regional sales office).

Edited: See description page now for motor combinations.

cheap garden railway here i come!

We demand pictures of that when you're done. :D

nice!!!. printing in process

Nice! you can also put the NodeMCU in your Z70. I will soon post a different version of the source code which works as a wifi-node instead, connecting to your router. In this way, both your trains (and in the future also switches and other stuff) can connect to your wifi network and you'll be able to control all of them at the same time.) The reason I didn't go with the node version now is that the antennas on these boards are very small, and they sit close to an evil EMI-source so I had trouble getting a reliable connection to my router. It worked a lot better just sitting with an iPad or mobile phone next to the layout. Then the connection is rock-solid.

Hello,

thanks for this project.
I have compiled this with arduino 1.8.5, do this wifi remote supposed to work like this: I press 'forward' or 'backward' then it goes 'forward/backward', when I press 'emergency stop' or 'stop' - it stops and after ~2s it starts to move for 2s again, then stop after 2s and repeats it 2-7 times then stops or infinite loop at random? When this repeat is going on ESP wont accept any button press.
Also ant random when you press buttons - wifi dissapears, ESP reboot/crash?

And any update on this "I will soon post a different version of the source code which works as a wifi-node instead" ?

Thank you

Hi!

it almost sounds as your browser is sending repeated requests that are interpreted one after the other, but this is a guess. It's a behaviour I haven't experienced. I guess it's maybe an obvious question, but have you gotten the same result connecting from different devices?
Our mobile devices today has so much networking going on and tons of services that tries to communicate through the internet, so I'm wondering if these services are bombarding the NodeMCU with requests ultimately causing it to stop respond. It's just a theory, anyone that is more experienced on embedded wifi could maybe confirm or dismiss. But I think it's generally a good idea to close as many apps as possible before you connect to the NodeMCU.

Regarding the wifi-node software, good you reminded me of that! :D I've been busy with other projects lately, so had forgotten about this. The first tests I made was done with a demo firmware that connects to a router, which seems to be the most common way these boards are used as there are more youtube tutorials about it. In theory, it's a better way of doing it at home as you don't have to switch network on a device, but I had the problem at home that my train would come out of reach of the router, breaking the wifi link and I had to restart it several times so than I started to investigate another alternative and did the present firmware so I could use one of my old discarded mobile phones as remote control. Anyway, I don't have simple answer to your problems I'm afraid, but try as I said a device with as little as possible running on it, because It's been working very good for me with my old Android phone. (Nexus 5).

If you want to do a bit of programming your self, the node firmware isn't rocket science, you can reuse most of my code.
In the Arduino IDE, open the example Examples -> ESP8266WebServer -> HelloServer
Bring up my code next to it, and you can compare the functionality. In my code, you replace WiFi.softAP(ssid, passord); with WiFi.begin(ssid, password); and those should then of course be the credentials to your local router.
Most of my code regarding the web functionality is for the ESP8266WebServer so that can be left unchanged, it doesn't matter if the connection to it comes via a client router config or a local AP like my code. With a bit of experimenting, I think you should be able to solve it, save both originals and you can convert it step by step, for example, take my functions handleRoot() and handleNotFound() and copy them into the example, this will show the control page when accessed via a router. Insert all the variable declarations in the beginning of the program and the pinout configurations into setup(). Insert the most important part, the server.on lines that routs the incoming trafic to the respective functions that do stuff, and insert the functions in the program as well, and you should be up and running and with a bit of tinkering you should be able to improve my program as well, it's a very rough program to just get started.

Hi,

thanks for reply.
I have tried it with android phone and pc (firefox, windows 10 and linux), older arduino 1.6.13 - same effect. Only first command working ok, after that its going nuts :)
I also have changed code to use router, added serial loging whats going on - and nothing changed.

Ok, weird. Do you get the same kind of behaviour when you only run a plain example?

I have an idea of one thing you could test. The web page that the NodeMCU sends uses javascript to send data using the URL but without page refresh. This was done to mitigate the delay it would cause if the page would have to be reloaded every time a button is pressed or the speed slider is moved. But this also means that the page is able to send multiple requests rapidly.

Another way to control it is to write the commands directly in the browser address area, for example
ip address followed by /run?dir=forward&speed=512

To decelerate, type:
ip address followed by /updateSpeed?speed=0

If you just send /stop that means emergency stop. In this way, you're not using the javascript and the browser will not send repeated commands. (not that it should be doing that normally either, but at least you omit any fault created by the control web ap). If this works without any problem, you know that the behaviour is caused by the web page that the NodeMCU sends, and you can investigate further from there.

almost the same behavior when sending URL directly, 30% it works ok but then it starts to stat/stop loop by itself.

I have started another test with my code, when i set GPIO PWM directly with specific value it works OK (start / stop),
im not programmer so i havent figured out yet how to change direction, ATM it works for one direction only :)

Ok, direction is changed with AIN1 and AIN2. They need to be either 1, 0 or 0, 1. For example, if both are high, the motor will have positive voltage on both leads, and both ground if AIN1 and 2 are low. This is why you see that I send direction and !direction. This makes sure they always get opposite signals.

I actually had the same problem. First i had to change some code, because i am using a router and couldnt get a connection with the nodemcu, so now im using some other ip for it!

And when i finally got that working, well it didnt. Exactly the same as for you daanlt, when i send a command the first or second one works, after that it starts to repeat itself. However, i did get it working, by trying another browser. My main browser is Firefox, it didnt work. Then i tried Safari (on my iphone) and it works, same with Chrome on the computer. Internet Explorer works too but the slider UI for speed control is not showing. So maybe it is some Java problem?