Interfacing

One of the key challenges in this project is to interface all the various cab components to MSTS. I will deal with the hardware aspects first – and move onto the software in a post a bit later on.

The master controller and the brake controller are reasonably straight forward – they both have electrical contacts in all the relevant positions. My intention for these is to utilise a commercial USB 32-port input/output unit I purchased from eBay, which has not arrived yet.

As for the gauges – I unfortunately don’t have a full set of air gauges as these were missing from C7487 and I don’t wish to destroy my Elcar ones. However – a simple solution will be to make my own utilising stepper motors – more on this one to follow.

The amp gauge, line lights etc were much easier – I was able to get a hold of some K-3090 Dick Smith Electronics Serial I/O Kits – going cheap from a large kit clearance through Allbids. These are in fact the Silicon Chip project from November 2005 – they provide 10 inputs, 10 outputs some analog inputs and a couple of relays. Most interestingly – they are driven by a PIC16F877A – quite a powerful processor for such a simple kit. The analog inputs aren’t much use however, the digital outputs are driven from the microcontroller through a ULN2003 in an open collector setup. Installing a pot and adjusting accordingly leads to being able to drive the gauge from 0 to full based on the digital output… not so useful really .. however… we should now be able to drive the amp gauge by utilising the hardware PWM of the 16F877A to vary the average voltage seen by the meter.. (remember there is a variable resistance as well)

Simulator Construction - Amp gauge being driven by the DSE kit on right

I have not yet started on rewriting the PIC code to achieve this – however it shouldn’t take me all that long to get the amp gauge up and running properly. I will post a photo when I do.

The relay outputs will come in very handy for switching on and off the line lights and brake stand control lights.

2 thoughts on “Interfacing

  1. Hey – I bought a 3 pack of those controllers as well off allbids.
    (I have a spare if you need one)
    How did you go writing the software to interface with the controller? I can use the software that comes with it, but it’s a bit limited.
    Thanks in advance

    • Software that comes with it isn’t that great as you point out – what I did was modify the PIC code to add the extra functions, I’ve kept the same format because I’m lazy, but eventually I’ll fix that as well.

      Let me know what you want to do with them and I’ll help you out with the code.

Leave a Reply to Karl Cancel reply

Your email address will not be published. Required fields are marked *