electronics

Nov 2013 15

DCC for the Kato TGV

My Kato S14701 TGV arrived in pretty good condition, but still needed a bit of TLC before it would run. It dates from the 1980s and the wheels looked like they haven't ever been cleaned, but apart from that, all the paint is still in tact, nothing is missing, etc, so I think I did pretty well. However that said, if I wanted it to move at all, it would need a DCC decoder.

Disassembling

First trick is to dismantle the power car. The only outward clue is a small screw on the nose which must be removed:

(Yes I know the wheels are clean here, I cheated and took this photo at the end!)

Then one needs to gently prise the body away from the shell. Do this front and back around each set of bogies.

Read full post...
Sep 2013 30

Simulating Railroad Crossing Lights

Everyone has seen a railway crossing before, and if you're a railfan you've probably spent more than a few hours stuck behind them waiting for their infernal blink-blink-blink to stop so you can continue chasing your train!

How do you make your model crossing blink like that though? The simple answer would be a 555 timer in astable mode with some set and reset triggers. But that would be easy, and when you're an software engineer everything looks like a software problem. So instead, we attack the problem with a sledgehammer and use an Arduino.

Kidding aside, there are very valid reasons why you might want to use an Arduino for such a simple problem. Suppose you're using the excellent Arduino CMRI library to connect your layout to

Read full post...
Sep 2013 23

Addressing many LEDs with a single Arduino

A fun little side project of mine is Arduino C/MRI, a library that lets you easily connect your Arduino projects up to the JMRI layout control software, by pretending to be a piece of C/MRI hardware. Hence the name.

A common problem when using Arduino C/MRI is dealing with lots of inputs and outputs. As an example, lets wire up a simple non-CTC crossing loop here in New Zealand. It is about as simple as you can get:

Each end consists of:

A turnout. We'll need 1 digital output to drive that. A route indication signal on each leg of the turnout. We'll need an LED for red, and one for green (technically it'd be blue here in NZ). That's 3 pairs of outputs = 6 more. A push button ...
Read full post...
Sep 2013 22

Driving many outputs with Arduino C/MRI

A fun little side project of mine is Arduino C/MRI, a library that lets you easily connect your Arduino projects up to the JMRI layout control software, by pretending to be a piece of C/MRI hardware. Hence the name.

Hello World

The basic "hello world" example is fairly straightforward, wiring up a JMRI light to a physical LED on the Arduino board.

#include <cmri.h> CMRI cmri; void setup() { Serial.begin(9600); // make sure this matches your speed set in JMRI pinMode(13, OUTPUT); } void loop() { // 1: main processing node of cmri library cmri.process(); // 2: update output. Reads bit 0 and sets the LED to this digitalWrite(13, cmri.get_bit(0)); }

It's easy enough to extend this example to handle 5, 10, even 15 outputs... if you have an Arduino Mega, you could have a LED on...

Read full post...
Feb 2013 26

Building lighting

It was going to be another long night, I could tell. The siding was being shunted tomorrow and we had a load of grain going out, so everyone was rushing to get the last of their harvests in today. Which of course meant another late night at the weigh bridge for me.

I'd run all the numbers and my radio serial (Drag Net) had finished, so I stepped outside for a breather. There was a warm breeze blowing and the crickets — or were they frogs — were loud, as usual. Sometimes I wonder if they ever sleep.

I wandered down the road a little and looked back up at elevator. It was quite a sight looming up there, flood lights over the loading bay. Tomorrow I'd probably have to climb out on the roof and inspect the cyclones. Off in the distance I cou...

Read full post...