Investigating I2C

Today’s post is going to be one of those interim ones I promised last time, where I report on progress made (or not), mostly about my work with testing the use of I2C as a short-range communications bus.

I decided to start with examining the code I’d written last spring, only to find that most of it was irrelevant as it was doing things the I2C hardware would do for me, or it had functional compromises I didn’t need to make now. About 90% of it got deleted, and I started working on something that would work with I2C, using a couple of my test programs to create a library that front-ends the internal Wire library used to directly control I2C. That’s working to the point that I can pass messages to/from the master, and detect damaged messages, but there’s a lot more to do.

PWM Motor Control

DC motors are controlled by varying the voltage and polarity of the DC power connected to them. In a simple DC power-pack a rheostat is used to provide a voltage to the track that varies from zero volts to the power pack’s maximum, which is often around 16 Volts. A simple switch is used to swap the positive and negative outputs to change the polarity (and thus the direction the motor turns). This tends to waste a lot of power as heat, but since that’s happening inside the power pack (and “a lot” isn’t really all that much at these voltages) that’s acceptable.

DCC decoders need to take a constant-voltage AC input from the rails, and control a DC motor somehow. Even if they could use a rheostat, wasting power as heat inside a plastic model is more problematic. The technique normally used instead is called Pulse-Width Modulation, and it’s a fairly simple and commonplace, and efficient, method of controlling DC motors from a digital controller. The same technique is used in many other applications. Read More...

Decoder Wars I

Edit: see the comments for some additional notes; also, I’ve edited the text to correct some errors, but those edits are marked.

A long time ago, in a distant land, titans met to do battle...no, wait, I mean recently, on my kitchen table, I started testing DCC motor decoders for N-scale EMUs. And as with most wars, after it started I began wondering why on earth I’d thought it was a good idea. Still, I have reasons for this, and the result is important: the winning candidate will go in my (so far) 27 trains that don’t support Kato’s plug-in decoders, and some have two motor cars, so it’s closer to 30 decoders.

Configuring The EM13 Part I

Kato’s EM13 DCC decoder (29-351) is a specialized decoder used for the motor car in an EMU/DMU model or other “DCC Friendly” models made by Kato. DCC Friendly (the English term is used even in Japanese, rendered as “DCCフレンドリー” or “DCC furendorī”) isn’t the same as “DCC Ready”, and it is a phrase used by others to simply mean that a model is relatively easy to convert to DCC. But when Kato uses it, the phrase means “will accept Kato FR11, FL12 and/or EM13 decoders”. And the models that do so are primarily Kato’s N-scale Japanese prototype models: commuter trains, limited express trains and Shinkansen (bullet trains). They also use it in some steam locomotive models, including the American-prototype GS-4.

Track Voltage, Motor Voltage, and DCC

As I’m finishing up the wiring for the two upper-level loops (one of which will be DCC-only, the other will be the switchable DC/DCC line), I’m also getting my DCC electronics set up and ready for use. There are several aspects to this, and I’ll cover others in future musings. But today I’m going to write about track and motor voltage. I could have just used the command station as it came, and it probably would have worked fine. But I like understanding exactly what’s going on under the hood, and so I ran a number of tests and spent some time researching what the track voltage should be, and why, and what that meant for the motor on a train. And if I ever add a booster, it will be important for it and the command station to be set to output the same voltage (this avoids problems when a train bridges between two power districts), so I may as well pick a voltage now.