The microCS is a basic command station. It makes a nice unit for your workbench or a small layout. If you've ever wanted to be able to modify your command station, here's your chance. Make the default loco your favorite number or hard-program in some turnout routes. Why not if its yours.
Hardware for the microCS
You can use just about any Arduino Uno compatible board. I used a real Arduino Uno R3 and I tested a knockoff, the Sain, which also worked nicely. However, you will probably want the genuine Arduino Motor Shield. It has a current sensing feature that actually works and is sensitive enough to capture the read-back pulse of a DCC decoder. I started with a Pololu motor shield but it was not sensitive enough, while the cheap China knockoffs don't seem to have any current sensing at all. The other use of current sensing, besides decoder read-back, is for over-current protection in case of a short.
For the keyboard I used a 4x4 matrix type that is easily available. You can use another brand without any trouble. Or you could use a matrix of 16 pushbuttons. It takes 8 pins (4 for the columns and 4 for the rows), and that pretty much maxed out the Uno, but it performs really nicely. The key action works ncely and there is pressure feedback that lets you know when you have pressed the button.
The throttle is a linear 5K potentiometer with a center detent. The clockwise side of the detent is forward and the other direction is backward with zero at the center. Fairly hard to find such a pot but I found one at Digi-key. I did program the pot with a fair amount of deadband around zero so you can probably get away without the center detent. Some folks may not like having the reverse be built in to the speed control like this. By changing the code you could add a reverse button and have the pot control the full range.
For the display I used a Newhaven serial display in I2C mode. (NHD-0216K3Z-FL-GBW-V3) Originally I used it on a 9600 baud serial softport but this turns off interrupts while sending and played havoc with the DCC signal which depends on interrupts for accurate timing. In the end I used a simple I2C software hack to send commands with bit-banging. As there is no need to ever get anything back from the display, the code is send only. You can use other displays but you will need to know what you are doing as the code will need some rework. In the end I didn't do a great job (at least from the point of view of the software gods/software zealots) in seperating the display code as it made things too big and I ran out of programming energy. I will have to live with the shame.
I put the whole thing in to a Adafruit Arduino case. It is a bit big but it has a nice feel in the hand. The motor shield being a bipolar type is not very efficient and produces a fair amount of waste heat and so I left the bottom plate of case entirely off for more circulation.
READ THE COMMENTS IN microCS.cpp TO SET UP THE HARDWARE.