Testing was... interesting. Got it all assembled and connected the transformer. Applied power and POP, the breaker tripped! OK, that's not good! Turns out that Digikey sent me silicon diodes instead of the TVS diodes I ordered! Same physical package size, and since the package has the correct part number and the faint numbers on the device didn't mean anything to me, I "assumed" they were correct. I "assumed" wrong! Removed the TVS and things got back to normal, the power LED came on, I had good serial data through the buffer circuit, and of course lights and couplers appear to work just fine, they're just wires. I then took the "TVS" diodes over and tested them independently, they are ordinary silicon diodes. I couldn't find any match to the numbers on them on Digikey or even the rest of the Internet, I just assume they're probably 3-4 amp silicon diodes from the size.
One down, let's do some actual testing.
Sadly, my circuit that detects when the train is stopped or moving, and which direction, didn't work at all. I did see very small indications on the LED's that it was sensing direction, but the stopped light stayed on all the time. I broke out the scope and made a little revelation, I should have looked more closely in the design phase. The PWM circuits do a very odd thing, which explains why I was having a problem. The direction you're going has the line sitting at 5V and going to ground for the variable pulse width time. However, the other direction has the line sitting at ground. Actually, it was open and just floating, I found that out soon after! I had been looking at the active PWM output and falsely "assuming" the other one just sat positive when it wasn't active.
Given that behavior, I had to swap the trigger input pins on the multivibrator chip to get it working properly. Well, that entails changing four wires on a small SMT chip, cutting tiny closely spaced traces, etc. with everything already soldered to the board! It's not pretty, but I did get the wires rerouted. I also noticed that I had a couple orders of magnitude error in my computations for the pulse width out, so I had to lengthening it 100x for it to cover the 10 millisecond time span between the PWM pulses, time for a much bigger resistor. OK, all that's done and the reverse direction works great, the reverse movement LED comes on, and the stopped LED goes off. Cool, I have it working! Try it in forward, not so good. Both the reverse and forward LED's come on! That's not right! I put my 'scope on the two PWM inputs to see what's happening and it starts working correctly! Take the 'scope off and it screws up again. Ah Ha! Remember those "floating" PWM outputs? Enough noise was getting coupled to the very low power input of the multivibrator reverse trigger to trigger it when I was going forward. Obviously just a product of how the board traces were routed for that side. A 1 meg resistor to ground fixed it, so that's the issue. I decided to actually go with 100K to ground in the next spin to insure this doesn't rear it's head.
Now with all the wires hanging off and the extra resistors hanging off the back, it works like I originally intended. The only minor quibble I have is when you switch directions, both direction lights momentarily flash and then everything is normal. This is a byproduct of the fact that the active direction changes the state of the PWM output from floating to +5V and the other direction goes from +5V to floating. That would be harder to fix, so I'm going to ignore it, it really isn't a major issue.
Timing was good, I used up the three boards I got from OSH Park, so now I'll order a slightly larger quantity of the next spin, maybe from SEEED Studio, they have a pretty cheap deal. I don't want to spend too much on boards yet until I get one fully working with no hacks.
Not too bad for the first cut, but I should have been a bit more careful in my initial design and I could have avoided most of this except for the bad TVS.