Skip to main content

Too long, don't want to read? Skip to the video and picture links

So, I've been working on this electronics system for an O gauge locomotive on and off for the past 8 months-ish and want to share with you guys what I've done so far for anyone who is interested in this kind of stuff. I am relatively new to this forum, but I have done some business through the WTB section. @Budkole sold me the beautiful locomotive 5426 you see in the video. It worked out fairly well considering it had some electronics issues, and I planned on replacing them all anyways (As a side note, 3rd rail locomotives are impressively good looking and smooth running. The motor/printer belt system is indeed a beast. This is the first one I have owned!).

My goal with this project was to come up with something that was 100% programmable, ran on battery power, and could be controlled from pretty far away - hence fairly ideal for outdoor use as well. I wanted it to be comparable to TMCC, ERR, or protosound, if not better. Right now I only have the one locomotive that I have converted, but the system is designed to control many at once.

The electronics within the locomotive are controlled by an arduino and include a radio transceiver, amp, motor controller, various mosfets, neopixel leds, voltage converters, and some passive components... there is also a peristaltic pump to bring smoke fluid from an auxiliary tender to the unit in the boiler. The speakers have been upgraded and placed in the boiler as well (in my opinion it sounds a bit more realistic with the sound coming from here). The battery is a 3S lipo 3000mah and seems to last a long time as long as the smoke unit is off. I haven't done any official battery testing yet, and probably won't until I can put it on a layout with cars behind it. The smoke unit has a 4 ohm resistor in it, so it can draw 3 amps at a full charge of 12.6V, that's 40 watts... so that alone would drain the battery completely in well under an hour assuming I don't want to get below 11.1V to avoid having to balance charge it all the time (and make last more cycles). That's part of the reason why I bothered to make the smoke unit power adjustable.

The blue central controller - also based around arduino - relays commands to the locomotive via radio. It can theoretically send data at 2Mbps so it can control many locomotives at once (more than I will ever be able to afford) up to about a football field away (in theory up to a kilometer, but less because of interference). The central controller can function on its own with scripts or be controlled manually via bluetooth from an android device, as seen in the video below.

Both the controller and locomotive are battery powered. The controller can easily be powered by a 5v usb cord as well. The locomotive cannot currently be powered by track, but in the future I will add functionality so it can use DC track power; or at least be able to charge on track without plugging it in.

Just below is the video I made demoing all of the functionality. Right now, I can write basic scripts that tell locomotives to go a certain distance and then perform a certain action. I'm working on a more advanced location based tracking system, but it won't matter much without a layout or other locomotives. Thus, considering my setup is just a straight track on my apartment floor, the video isn't super exciting, and my filming equipment isn't exactly professional grade...but it does showcase all of the functionality so far.

Demo Video: https://www.youtube.com/watch?v=C7qy0MdIsFA

Here are also some random pictures from the build process: https://imgur.com/a/az9Vd7U

In my opinion, I'm pretty happy with where it is now, but there are some small issues that you may notice in the video. For one, the sound isn't perfect. There is some clipping, especially with the whistle, though I have some ideas on how to fix this. I think the board is running out of memory when the locomotive starts going fast and playing lots of chuff sounds as well, as it occasionally skips a beat, and sometimes completely cuts out when blowing the whistle at the highest speeds. The sound files also probably need to be trimmed to be shorter as the locomotive starts moving faster so they don't overlap as much. Overall though, even though I'm only using free 11khz samples up-scaled to 44khz, I think the quality of the sound combined with the improved speakers is still better than the railking stuff I grew up with, but maybe not quite as good as something like Loksound.

You'll also notice that the higher the speed gets, the wonkier the speedometer gets too. I think this is caused by either the program may be skipping calculations due to memory issues or delay between the android device and central controller. The delay between the controller and the locomotive is basically nothing... however, there is some noticeable delay between the android device and the controller via bluetooth, and I don't know whats causing that. Its only really noticeable when trying to blow the two-step whistle. I could circumvent this by adding a screen to the central controller and cutting out the android device, but arduino is limited in its ability to drive a screen, and that would also be very expensive.

The voltage divider reading the battery is also wonky, but I think that is due to general electronic interference in the system...regardless, its accurate enough to tell you when it needs charged to prevent over-discharging.

I should note that if you are paying attention to the "distance to objective" and "total distance" values in the video, you will see that the locomotive only starts decelerating at the target rather than stopping suddenly. It can be programed to slow down before reaching the target so that the scripting is more accurate, but I didn't get that in depth for the video. Overall, I'd say the controller could put a locomotive within plus or minus a foot of where you want it to go on a layout... this is partly due to the limitation of communicating in integers or bytes to save bandwidth.

For the future, I have many plans. I will certainly share more if people are interested in seeing how this turns out over the next year or so.

Cheers!

Last edited by Aaron Jamison
Original Post

Replies sorted oldest to newest

Aaron Jamison posted:

Too long, don't want to read? Skip to the video and picture links

So, I've been working on this electronics system for an O gauge locomotive on and off for the past 8 months-ish and want to share with you guys what I've done so far for anyone who is interested in this kind of stuff

Cheers!

I just speed read most of this post. Haven't viewed video. Can you do this without a battery system? I applaud your work. Thank you!

Walter Anderson posted:

I just speed read most of this post. Haven't viewed video. Can you do this without a battery system? I applaud your work. Thank you!

Short answer is that you could, but it would be much easier to do with DC track power than AC track power since the main input to the system is 12vdc. One could probably fit the appropriate AC/DC converter in place of the battery though if desired.

Aaron Jamison posted:

Too long, don't want to read? Skip to the video and picture links

So, I've been working on this electronics system for an O gauge locomotive on and off for the past 8 months-ish and want to share with you guys what I've done so far for anyone who is interested in this kind of stuff. I am relatively new to this forum, but I have done some business through the WTB section. @Budkole sold me the beautiful locomotive 5426 you see in the video. It worked out fairly well considering it had some electronics issues, and I planned on replacing them all anyways (As a side note, 3rd rail locomotives are impressively good looking and smooth running. The motor/printer belt system is indeed a beast. This is the first one I have owned!).

My goal with this project was to come up with something that was 100% programmable, ran on battery power, and could be controlled from pretty far away - hence fairly ideal for outdoor use as well. I wanted it to be comparable to TMCC, ERR, or protosound, if not better. Right now I only have the one locomotive that I have converted, but the system is designed to control many at once.

The electronics within the locomotive are controlled by an arduino and include a radio transceiver, amp, motor controller, various mosfets, neopixel leds, voltage converters, and some passive components... there is also a peristaltic pump to bring smoke fluid from an auxiliary tender to the unit in the boiler. The speakers have been upgraded and placed in the boiler as well (in my opinion it sounds a bit more realistic with the sound coming from here). The battery is a 3S lipo 3000mah and seems to last a long time as long as the smoke unit is off. I haven't done any official battery testing yet, and probably won't until I can put it on a layout with cars behind it. The smoke unit has a 4 ohm resistor in it, so it can draw 3 amps at a full charge of 12.6V, that's 40 watts... so that alone would drain the battery completely in well under an hour assuming I don't want to get below 11.1V to avoid having to balance charge it all the time (and make last more cycles). That's part of the reason why I bothered to make the smoke unit power adjustable.

The blue central controller - also based around arduino - relays commands to the locomotive via radio. It can theoretically send data at 2Mbps so it can control many locomotives at once (more than I will ever be able to afford) up to about a football field away (in theory up to a kilometer, but less because of interference). The central controller can function on its own with scripts or be controlled manually via bluetooth from an android device, as seen in the video below.

Both the controller and locomotive are battery powered. The controller can easily be powered by a 5v usb cord as well. The locomotive cannot currently be powered by track, but in the future I will add functionality so it can use DC track power; or at least be able to charge on track without plugging it in.

Just below is the video I made demoing all of the functionality. Right now, I can write basic scripts that tell locomotives to go a certain distance and then perform a certain action. I'm working on a more advanced location based tracking system, but it won't matter much without a layout or other locomotives. Thus, considering my setup is just a straight track on my apartment floor, the video isn't super exciting, and my filming equipment isn't exactly professional grade...but it does showcase all of the functionality so far.

Demo Video: https://www.youtube.com/watch?v=C7qy0MdIsFA

Here are also some random pictures from the build process: https://imgur.com/a/az9Vd7U

In my opinion, I'm pretty happy with where it is now, but there are some small issues that you may notice in the video. For one, the sound isn't perfect. There is some clipping, especially with the whistle, though I have some ideas on how to fix this. I think the board is running out of memory when the locomotive starts going fast and playing lots of chuff sounds as well, as it occasionally skips a beat, and sometimes completely cuts out when blowing the whistle at the highest speeds. The sound files also probably need to be trimmed to be shorter as the locomotive starts moving faster so they don't overlap as much. Overall though, even though I'm only using free 11khz samples up-scaled to 44khz, I think the quality of the sound combined with the improved speakers is still better than the railking stuff I grew up with, but maybe not quite as good as something like Loksound.

You'll also notice that the higher the speed gets, the wonkier the speedometer gets too. I think this is caused by either the program may be skipping calculations due to memory issues or delay between the android device and central controller. The delay between the controller and the locomotive is basically nothing... however, there is some noticeable delay between the android device and the controller via bluetooth, and I don't know whats causing that. Its only really noticeable when trying to blow the two-step whistle. I could circumvent this by adding a screen to the central controller and cutting out the android device, but arduino is limited in its ability to drive a screen, and that would also be very expensive.

The voltage divider reading the battery is also wonky, but I think that is due to general electronic interference in the system...regardless, its accurate enough to tell you when it needs charged to prevent over-discharging.

I should note that if you are paying attention to the "distance to objective" and "total distance" values in the video, you will see that the locomotive only starts decelerating at the target rather than stopping suddenly. It can be programed to slow down before reaching the target so that the scripting is more accurate, but I didn't get that in depth for the video. Overall, I'd say the controller could put a locomotive within plus or minus a foot of where you want it to go on a layout... this is partly due to the limitation of communicating in integers or bytes to save bandwidth.

For the future, I have many plans. I will certainly share more if people are interested in seeing how this turns out over the next year or so.

Cheers!

This is exactly what I was getting at in my post about the death of TMCC.

Aaron, thanks for this, it's what the future of O-scale 3-rail needs. I agree that it's better than Railking, not sure if it falls short of Loksound, as the reproduction quality on YouTube isn't always the best.

I'm curious about the smoke fluid in the tender. Was that your idea? It could add new realism. Lionel, MTH, or both, could make a water tank with a spout that dispenses smoke fluid, and make it look like we're really adding water to the loco.

I like the slow chuff at startup, it's one of the things I'm a stickler for with my engines. The air pump is also great.

Welcome to the wireless club! I did my first direct to loco wireless system in 2011. It was featured in an LCCA video (still there). I have converted eight locos to BlueRail bluetooth control using DC track power, AC track power and battery power. All work great and have been demonstrated at several club meetings. Also, sound is nice with BlueRail app. The battery powered locos are two years old, use LiPO's and are still going strong. As pointed out in a previous post, running on AC track power is not difficult. Your approach is intriguing and I will follow it closely.

Lionelzwl2012 posted:

John, you said plan closure off err is that correct. Will lionel still sell err stuff? Or should we grab it while we can?

I think that is correct judging by these two posts, but I was unable to find the official announcement. If anyone has it that would be interesting to read.

https://ogrforum.com/...-of-the-tmcc-upgrade

http://www.modeltrainforum.com...wthread.php?t=166978

Trainman2 posted:
I'm curious about the smoke fluid in the tender. Was that your idea? It could add new realism. Lionel, MTH, or both, could make a water tank with a spout that dispenses smoke fluid, and make it look like we're really adding water to the loco.

I have yet to see another example of the fluid in the tender, probably because its not super practical having a long hose run from the tender to the front of the boiler - bad kinks are the enemy! Unfortunately, there wasn't enough room for a fluid tank so it would have to pump fluid from an auxiliary tender. Anyhow, the whole reason behind doing that was so that I can really crank the smoke unit. I want it to look good outside even in some slight wind. In the future I plan to do something like that, having a water tank with a dispenser on my layout so that the controller can tell the locomotive to refill and I won't have to do anything

I'm currently working on a new smoke unit design that will improve its overall performance and just make it a lot easier to deal with than it is right now.

BOB WALKER posted:

Welcome to the wireless club! I did my first direct to loco wireless system in 2011. It was featured in an LCCA video (still there). I have converted eight locos to BlueRail bluetooth control using DC track power, AC track power and battery power. All work great and have been demonstrated at several club meetings. Also, sound is nice with BlueRail app. The battery powered locos are two years old, use LiPO's and are still going strong. As pointed out in a previous post, running on AC track power is not difficult. Your approach is intriguing and I will follow it closely.

Thank you! Bluerail looks fantastic judging by your demo videos. I really like the idea of sending updates wirelessly. It is also good to hear that lipos are working out. The technology in batteries has significantly improved in the past decade, and even since you started in 2011.

Severn posted:

Great work! Are you going to "gitlab" it for others of us to replicate and contribute to? I've been trying to build a bemf controller for some time myself. Pretty much a fail so far ... Not a hw engineer. But I've learned a lot.

I really like the idea of developing a community that can share scripts, sounds, and other code.

I have a plan if this gains enough interest, that is all I'll say for now   ETA is a long time though. Maybe a year-ish at least.

Budkole posted:

Aaron, I knew you were working on something special.  Thats awesome!  Im definitely interested in your work.

The Dude posted:

Looks good, keep us posted on its development.

gunrunnerjohn posted:

The AC/DC conversion is the easy part, I don't see that as any problem.  There are tons of off-the-shelf modules to do that trick. 

Given the planned closure of ERR and no more TMCC upgrades, you may get some interest in this project.

Thank you all for the comments! I am unable to do updates frequently, but I will do a big update like this when I make update-worthy progress.

gunrunnerjohn posted:

The AC/DC conversion is the easy part, I don't see that as any problem.  There are tons of off-the-shelf modules to do that trick. 

Given the planned closure of ERR and no more TMCC upgrades, you may get some interest in this project.

John, What cruise commander M would you recommend for Lionel Birkshire  Jr with TMMC control?

Gerry

SGMret posted:
gunrunnerjohn posted:

The AC/DC conversion is the easy part, I don't see that as any problem.  There are tons of off-the-shelf modules to do that trick. 

Given the planned closure of ERR and no more TMCC upgrades, you may get some interest in this project.

John, What cruise commander M would you recommend for Lionel Birkshire  Jr with TMMC control?

Gerry

Since ERR has no more of them in stock, it doesn't really matter what I'd recommend.

I am impressed, Aaron, it looks like a pretty neat hack (said in the positive sense of the word). In the tech industry open source software projects have created a lot of interesting technology, thinks like Linux and Apache technologies were developed as open source projects and became backbones of many commercial systems.  Something like your system could be the backbone of both home brewed projects and commercial providers (the way Linux for example is supported by commercial firms like RedHat), the nice part of open source projects like this is the response time for fixes is generally superior to commercial vendor only products. Among other things, such a system likely would not have the problems you have with TMCC/Legacy and DCS, where people are reliant on the manufacturer actually having enough boards built for repairs or third market firms. 

In any event, I am impressed by this, when I actually have time to tinker I would love to try this. 

gunrunnerjohn posted:
SGMret posted:
gunrunnerjohn posted:

The AC/DC conversion is the easy part, I don't see that as any problem.  There are tons of off-the-shelf modules to do that trick. 

Given the planned closure of ERR and no more TMCC upgrades, you may get some interest in this project.

John, What cruise commander M would you recommend for Lionel Birkshire  Jr with TMMC control?

Gerry

Since ERR has no more of them in stock, it doesn't really matter what I'd recommend.

John, Thanks for your reply. ERR still lists Cmdr M  and by default indicates item is available.

 Tanks again Gerry

Add Reply

Post
×
×
×
×
Link copied to your clipboard.
×
×