Skip to main content

As part of my RTC program, I've been trying to understand how the odometer in the engine works.

Part of the answer must somehow include the gear ratio between the motor and the wheel. I took a diesel, marked the tach cylinder and the wheel position. Then I twirled the tach wheel until I got an integral number of tach revolutions and wheel revolutions. I got 42 tach revolutions for 4 wheel revolutions which gives a gear ratio of 10.5 to 1.

My question is for the next step, trying to understand the number of tach pulses to distance traveled. The tach strip in this engine has 24 black bars. Then I need to know the circumference of the wheel.

The diesel has the typical wheel that uses 22mm traction tires. But when I measure the solid wheel without the tire, I get about 22.6 mm. It's a little tough to measure the wheel with the tire since the measurement depends on how well the tire is installed. I measured a few times and I could say that it might average around 22.6 mm.

Does anyone have any information as to whether or not I am using the right values for the wheel or the gear ratio?

 

 

Original Post

Replies sorted oldest to newest

Mark I'm amazed at some of the stuff you've already come up with!  I'm pretty sure the byte 0x08 by itself tells a lot about the effective gear ratio, taking into account the driving wheel diameter.  If you take that value as an 8-bit integer and divide by 22.7, it will yield the approximate motor revolutions per inch.

I've counted the gear ratios on a lot of locos, and at one point several years ago, Dave Hikel shared a table with some common gear ratios.  Every MTH diesel I've ever measured is geared at 10.5:1.  I thought I measured the wheels at 0.875"; that loco may have had a lot of mileage with its tires worn smooth.  I no longer have physical access to all of the locos I measured.  In trying to relate the hex value to distance traveled, I had to guess at driving wheel diameters, so my suggested divisor of  22.7 is approximate.  It's known that slight speed variation exists among DCS locos; traction tire thickness could be one of the variables responsible for this variation.  I also know that MTH specifies the same tire for wheels having slightly different diameters.  In some cases, getting the tire on is a stretch!

The other variable is the flywheel diameter, and especially, the number of stripes.  Perhaps the flywheel diameter doesn't matter much, since the reader sees the stripes in linear fashion.  I'm pretty sure Gunrunner John said 28 stripes is standard.  There is probably a minimum stripe width required for reliable operation.  If the flywheel is too small to accommodate a tape of 28 stripes (at their minimum width), it's possible that MTH fudges the odometer variable so that the sensor's returned value at any given RPM matches that of other "standard" locos.  Maybe that's the purpose of byte 0x09h? 

I know it's possible to "trick" a loco by using a tape with more stripes.  Some of my PS2 locos are jerky below an indicated 4 mph.  Folks here on the Forum have claimed they could force a balky loco to run slower-- at a measured 1 or 2 scale mph-- by using a custom tape with more stripes.  (Of course at higher speeds, the actual speed would be very different from the indicated speed, and also from that of "factory" unmodified locos.)

I hope you're able to find out more on this issue, and I look forward to reading about it on the Forum!

Last edited by Ted S

I'd be very surprised if the MTH steamers are geared that low, I believe they're more like 18:1  I've recently worked on several Williams steamers where I actually was computing the gear ratio, a brass K-4 was 28:1, and the Williams brass Niagara was 44:1. 

Actually Ted, I have stated several times that 24 stripes is "standard" for MTH PS/2 or PS/3 locomotives.  As far as adjusting speed, dropping a stripe or adding a stripe from a 24 stripe flywheel will change the speed around 4%.

GRJ I'm sorry I misquoted you, no offense, I was working from memory. 

All diesels are 10.5:1.  Most early Premier steam is 16:1.  After 2001, MTH's engineers started looking beyond the Fisher-Price aisle... The 20-3047 Niagara and later 80" drivered Northerns were ~18:1.  Medium-drivered locos with an idler gearbox, like Consolidations and Mikados are ~20:1.  These are solid runners.  Most RailKings until recently were 14:1 (RS-545 larger motor) or 17:1 (RS-385 standard motor).  All of these ratios are "tall" (faster) compared to traditional norms for adult-oriented scale models.

I know for certain that some MTH steam locos with the tiny RS-365, such as RailKing train set locos and USRA 0-6-0 switcher, are geared lower-- 26:1, 28:1, and in some cases more.  Dave Hikel's table confirms this (and he would know!)

Based on my personal experience with two different RK Mohawks and analysis of data in the sound files, it looks like MTH has begun using the 26:1 ratio in more of the RK steam locos with the RS-385.  This is a good thing!  I remember our discussion about the 1980s Williams brass.  IMO 30:1 is about ideal, so the new ratios are a step in the right direction.  Unfortunately, the great bulk of die-cast locos already made are geared too tall and require speed control for smooth operations at single-digit speeds.

Last edited by Ted S

I suspect that motor torque has as much to do with performance as gear ratio.  My MTH 19th-century 2-8-0 has a gear ratio of 28:1, and slow speed performance out of the box was rather poor.  It got better after a great deal of breaking in, but this is the best it can do (under conventional control; I don't have DCS).  Not bad, but if you ask me, not that great.  And yes, its top end is way too fast.

 

Attachments

Videos (1)
DSCN4948
Last edited by 49Lionel

Walking out the door but can't stand not sticking in my .02cents.  I have two Railking steam locos a ten wheeler and a 2-8-0  H-10  both are around 28:1. They are among the best slow runners I have even without PWM motor drivers.  At 28;1 they still have plenty of top end speed and both run very quiet. Also looks like it would not be too difficult to ditch the 365 Mabuchi for a 385.           j

I opened up my 30-1660-1  P&LE (NYC) 0-6-0 USRA Steam Switcher  #9060 PS3 and twirled the tach wheel. I counted 18 revolutions for one rev of the driving wheel. The blind drivers and non-traction tire wheels are 27mm. Again the traction tire increased that a little bit to 27.2 mm. Tach tape has 24 stripes.

My goal along these lines is to figure out how to decode the data returned by the engine that represents the trip odometer (DTO) and odometer (DOD).

In the next few posts, I will describe what I have discovered so far.

Step 1: a fixed distance

I used RR-Track when I designed my layout. RR-Track has the ability to add up the length of a selected route. I picked my longest circular route and RR-Track told me that it was 1.5884 Smiles. Ellison fans will know that this was his term for a scale mile. In O gauge, it's 110 feet or 1320 inches.

Starting with the diesel's wheel diameter at 22.6 mm, 24 stripes on the tach strip and a 10.5 gear ratio, math and geometry tell us that we have 472.225 revolutions of the driving wheel to cover 1 Smile. That also works out to 119000.8 tach stripes per Smile.

My plan was to use that 1.5884 Smile distance as a standard length to try to understand the DTO and DOD commands.

Step 2: Collect the data

For several years, I've been studying the commands and responses between the remote and the engine. I learned a long time ago how to build a radio snooper to decode the commands and responses. Both the DTO and DOD commands elicit two responses from the engine, the first is a 16 bit number, the second is a 32 bit number. These numbers are read out from the RAM memory in the engine. The first number is always the same for any particular engine and is the same for both the DTO and DOD responses from that engine. The second number increases as the engine runs and does not change when the engine is stopped. The values returned for the DTO and DOD commands are very different but both increase as the engine runs.

My working assumption is that the 16 bit number somehow incorporates the gear ratio and wheel diameter. For the diesel that I'm working with, the value is 21637. In a lot of my documentation, I call this the Scale Factor.

Then the 32 bit number represents the trip odometer (for DTO) and the odometer (for DOD). The remote takes these two values and displays the Smiles on the display.

More to follow.

Ted S posted:

GRJ I'm sorry I misquoted you, no offense, I was working from memory. 

All diesels are 10.5:1.  Most early Premier steam is 16:1.  After 2001, MTH's engineers started looking beyond the Fisher-Price aisle... The 20-3047 Niagara and later 80" drivered Northerns were ~18:1.  Medium-drivered locos with an idler gearbox, like Consolidations and Mikados are ~20:1.  These are solid runners.  Most RailKings until recently were 14:1 (RS-545 larger motor) or 17:1 (RS-385 standard motor).  All of these ratios are "tall" (faster) compared to traditional norms for adult-oriented scale models.

I know for certain that some MTH steam locos with the tiny RS-365, such as RailKing train set locos and USRA 0-6-0 switcher, are geared lower-- 26:1, 28:1, and in some cases more.  Dave Hikel's table confirms this (and he would know!)

Based on my personal experience with two different RK Mohawks and analysis of data in the sound files, it looks like MTH has begin using the 26:1 ratio in more of the RK steam locos with the RS-385.  This is a good thing!  I remember our discussion about the 1980s Williams brass.  IMO 30:1 is about ideal, so the new ratios are a step in the right direction.  Unfortunately, the great bulk of die-cast locos already made require speed control for smooth operations at single-digit speeds.

Hello Ted S

I have an Railking Imperial Challenger #30-1724-1 which has PS-3 and RS-385 motors and driver dia. is 32-33 MM.  What is the gear ratio for this engine ?  

God will save you from hidden dangers and from deadly diseases, Psalm 91:3

Tiffany 

Step 3 : expectations

Scaling factor 16 bit value - I would expect this to be a number that multiplies or divides the number to be scaled.

Like:   actual value = initial value * scaling factor

or:      actual value = initial value / scaling factor

In his reply above, Ted S, thinks this is not a 16 bit value but rather two 8 bit values. He might be right.

DTO and DOD 32 bit value - This has to be derived from the tach strip. In its simplest form, I would expect it to be a count of tach pulses. I would expect the DTO value to be a lower value with a lot of decimal places. A representation that could measure short distances accurately. I would expect the DOD value to be a higher number with few decimal places. A representation that could measure long distances. Think about the number of digits on the odometer and trip odometer in your car.

So if the DTO and DOD values were just a count of tach pulses, we could expect that the scaling factor embodies the gear ratio and wheel diameter to convert the raw values into linear distance.

Step 4: results

Now, running my engine over the measured 1.5884 Smile loop, I got the scale factor, DTO and DOD values from the engine. I used the remote to get these same values displayed as Smiles.

It took some experimenting and hints from Eric Linz, but I came up with these two equations:

DTO in Smiles =  raw_value / (11 * scaling_factor)

DOD in Smiles = (46.5 * raw_value) / scaling_factor

The constant factors in the equation were not exactly pulled out of thin air but I can't explain their values. I got those values by working backwards using the remote to tell me what DTO/DOD value I should see.

Step 5: tests

Over my fixed loop, the DTO and DOD values using the equations agree to within about 0.25% with the actual length of the loop. I tested this with one diesel engine and one steam engine that had different gear ratios and different wheel diameters. Both equations agree with the remote down to a few decimal places (but don't produce the exact same results as the remote).

I don't yet understand how to take a gear ratio and wheel diameter to produce the scaling factor value.

That's all I have been able to figure out about DTO and DOD.

raw_value is clearly based on the same tach stripe count for DTO and DOD.  Perhaps another way to look at it is to observe that 46.5 x 11 = 511.5.  That is suspiciously close to "exactly" 512.000 - in other words is a 9-bit binary shift which is arguably what you'd expect a presumably fixed-point microcontroller processor to do to represent two levels of resolution or scaling of the same underlying value.

 

@Tiffany your loco has a value of "96" in the sound file, byte 0x08.  Based on the info you provided (and my past experience), I would guess the gear ratio is 17:1.  You can verify this by taking the shell off and turning the flywheel by hand.  Make a tiny mark on the flywheel and driving wheel rim so you don't lose count.  Turning the flywheel by hand won't hurt the loco, and it's a good way to see if something is binding in the drive train.

Speaking of which, @49Lionel what kind of motor does your 19th Century loco have?  I can't help but feel that maybe something is binding on yours, because as John said, the 28:1 locos are usually very smooth runners.  The little RS-365 revs to 12000 RPM or more.  If the worm gear isn't pressed onto the motor shaft (and unfortunately many of them are  , you could probably swap the motor for another one with lower RPM and more torque.

@SanDiegoMark Not sure if this helps, but do you know the "sampling period" for the tach sensor?  The scaling factor supports the speed as well as the odometer function.  In order to know the loco's current speed, Protosounds has to poll the sensor every second, every half-second, etc.  If 0x08 by itself is the scale factor, then multiply the static value by 1408 to get stripes per scale mile.  Multiplying 0x08 by about 0.4 gives the number of stripes per second, per smph  (in other words, the expected number of stripes per second at 1 smph.)  Higher values indicate a slower, smoother-running loco.  How does the sensor actually work?

Last edited by Ted S

The sensor clearly has to be using something like the uP counter input function, you could never individually capture all the pulses otherwise.  If the motor is spinning at 8,000 RPM (some do, I checked), and you have 24 stripes, you'd have 3200 stripes/second to sense, or one about every 300 microseconds.  You might be able to service interrupts at that pace, but it would be consuming a significant part of the bandwidth.  What I do in the Chuff-Generator is use an input pin counter trigger to count the stripes and then just react when I get to the correct count.

Ted S posted:

 

Speaking of which, @49Lionel what kind of motor does your 19th Century loco have?  I can't help but feel that maybe something is binding on yours, because as John said, the 28:1 locos are usually very smooth runners.  The little RS-365 revs to 12000 RPM or more.  If the worm gear isn't pressed onto the motor shaft (and unfortunately many of them are  , you could probably swap the motor for another one with lower RPM and more torque.

I don't know what motor it is, but here's the best picture I have:

DSCN4273

When I had the rods off I tested each component and didn't detect any binds.  I'd definitely be interested to see how a different motor would perform, but that's not something I'd try doing myself.

Attachments

Images (1)
  • DSCN4273
Last edited by 49Lionel

There is also a ton of the 3xx Mabuchi motors, so you want more than just the RS-385, as there are endless varieties of those.  You will want one that is a 12V or 15V model, and also has a top RPM to match your gear ratio.  When I went looking for motors, I was amazed at the difference in specification for the same 3xx model number, there are a bunch of letters/numbers after the motor type that denote various options.

gunrunnerjohn posted:

The sensor clearly has to be using something like the uP counter input function, you could never individually capture all the pulses otherwise.  If the motor is spinning at 8,000 RPM (some do, I checked), and you have 24 stripes, you'd have 3200 stripes/second to sense, or one about every 300 microseconds.  You might be able to service interrupts at that pace, but it would be consuming a significant part of the bandwidth. 

I figure that for a typical diesel, there would be 119,000 pulses per Smile. At 120 Smph, that would be 238,000 pulses per minute or 3966 pulses per second - one every 252 microseconds or so.  On a lower geared steam engine the pulse rate would be even higher.

So, as you noted, its likely this is a hardware counter.  But the DOD and DTO raw values are read out by reading 4 bytes of RAM each. If these are hardware counters, they could be memory mapped. I don't know what is available in whatever uP is used.

 

Ted S posted:

I'm pretty sure the byte 0x08 by itself tells a lot about the effective gear ratio, taking into account the driving wheel diameter.

I have 16 engines and I've looked at the bytes at RAM 0x08 and 0x09 to try to see some pattern.

All diesels have values like 0x54 0xAB, 0x54 0x85 and 0x55 0x45. These all have about 22mm wheels.

The 4 steam engines have these values

0-8-0     0x5D 0x64    27.55mm wheel

2-8-0     0x62 0x55     32.74mm wheel

Berk      0x50 0x23     36.27mm wheel

0-6-0     0x7B 0x90     27.11mm wheel

Maybe there are some hints in these numbers.

Mark, I'm not sure that 0x09 has anything to do with the speed or odometer function.  The byte at 0x08 does a pretty good job by itself of describing the effective gear ratio and by extension, motor revolutions per inch, stripe count per inch, stripe count per second at a given speed, etc.

Your sample data only confirms what I already knew.  All diesels are geared the same at 10.5:1 and typically have the same size wheels.  With my understanding, and never having had any of your locos apart, I predict the gear ratios of your steamers as follows:  0-8-0 is 14:1, 2-8-0 is 18:1, Berk is 16:1 (I'm guessing yours is Premier- I have one), 0-6-0 is 18:1.  The 0-6-0 has the highest 0x08 value and would probably be the smoothest runner of this group.

The formula for the approximate gear ratio is: Driving Wheel size in mm * the value of 0x08h as an 8-bit integer * 0.00552. 

I'm not sure why some diesels have 0x54 and others 0x55.  But the difference is only 1 in 84, or about 1.1 percent which is within tolerances for double-heading.   I also can't explain why the formula doesn't work out to the exact value in every case. 

Some theories are: the exaggerated curvature of a very small flywheel may impact the accuracy of the tach reader, leading to missed or double-counted stripes.  Also, there may be a fudge factor to account for expected skidding / slippage on curves.  On tight curves, the inside rail is significantly shorter than the outside, so one or both wheels have to skid, and this may translate to lost motion.

A long time ago MTH warned that operating scenarios recorded in the TIU wouldn't be suitable for repeated playback, without eventually resetting the loco to its exact starting position.  They predicted that position errors would accumulate over time, leading to fouled switches, running through the block, etc.  Lionel's LCS tries to get around this problem by using track sensors to establish the position of the loco, and to trigger events.

Last edited by Ted S
SanDiegoMark posted:
gunrunnerjohn posted:

The sensor clearly has to be using something like the uP counter input function, you could never individually capture all the pulses otherwise.  If the motor is spinning at 8,000 RPM (some do, I checked), and you have 24 stripes, you'd have 3200 stripes/second to sense, or one about every 300 microseconds.  You might be able to service interrupts at that pace, but it would be consuming a significant part of the bandwidth. 

I figure that for a typical diesel, there would be 119,000 pulses per Smile. At 120 Smph, that would be 238,000 pulses per minute or 3966 pulses per second - one every 252 microseconds or so.  On a lower geared steam engine the pulse rate would be even higher.

So, as you noted, its likely this is a hardware counter.  But the DOD and DTO raw values are read out by reading 4 bytes of RAM each. If these are hardware counters, they could be memory mapped. I don't know what is available in whatever uP is used.

In my little C-G, I just let the tach counts accumulate in a 16 bit timer.  In the mainline loop I compare that count to my calibration constant.  When it equals (or exceeds) my calibration constant, I trigger a chuff and zero the hardware timer for the next cycle.  Although my cycle time for the simple functions of the C-G probably never missed a count, if I did miss one, it wouldn't really make any difference in the greater scheme of things, so that wasn't a major issue.

Add Reply

Post
The DCS Forum is sponsored by

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

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