As I mentioned, I’ve been doing a bit of Arduino over the last couple of weeks.
My layout is still awaiting a home so I content myself with the first module, the loco shed, on which the points, turntable and scenic lighting are all controlled by a small control box which contains an Arduino Mega (a real one, not a clone!) and an HW184 CAN interface.
The CAN bus connects to three more HW184s, each connected to a Nano, which in turn control:-
The points - 8 channels but only use 5 - which handle the Tortoises, my own driver board. Over on the right of the photo below - the bi-colour leds indicate the point state.
The turntable which is stepper driven, using an A4988, it has a phototransistor which is used to reset the step count every rev. That’s the nearer board with the green led on it.
The lights, using PWM & MOSFETs - whilst it works, this is the least satisfactory and will get some attention at some point. The lighting Nano also controls a relay which switches the front siding between DCC and programming track / this is interlocked with the points so you can’t inadvertently bridge the gap.
I now have two lovely lever frames that my pal John Matthews built from his own kits for his garden railway, the Leigh & North Whitton, on which we spent many happy hours.
John was a proponent of working rodding for points, signals were operated by whipping twine “wires” with under baseboard weights to return them to danger. This does not float my boat, so I have converted the first frame to digital operation, there is a microswitch to detect the position of each lever, and these feed a Mega clone (this will easily accept 50-odd inputs, the larger frame has 31 levers) and the Mega transmits its status via ubiquitous HW184. John had implemented mechanical locking on his frames. I will update this when I build the layout, can’t really do it before! I will probably connect the Block instrument, Tapper and Bell to spare Arduino pins.
The slave units comprise a Nano and a CAN interface and will control 12 servos which can be signals or points, of course. These are mounted on a stripboard panel.
The three servos are mounted on a 3DP (FDM, not resin) signal base which drops into a 3DP “socket” which is intended to be glued/screwed to the baseboard, allowing signals to be simply dropped in and plugged in, servicing them off-layout is much easier. It’s upside down in the photo.
I got a large bag of surplus 5-way plugs & sockets which I have standardised on as the CAN bus connection, whilst the CAN itself needs only two wires (High & Low), it’s normal to have a common ground for all units on the bus. I’ve included a 12V and 5V connection as well.
Servos take a bit of grunt so I will feed the slaves locally - 12 would need the capability to provide a few Amps, though arranging that they don’t stall is important. I’m going to add a chunky capacitor to each slave to minimise any tendency for current spikes caused by one servo to destabilise the others. I haven’t added the power connection or the capacitor yet.
The lever frame needs very little current, and runs happily off a USB charger, or off the 5V line from the CAN bus, though I’ve not wired that in as yet.
I can share code and circuit diagrams (though “as is”, no guarantees!) if anyone’s keen to go down this road.
atb
Simon