In the last post I discussed the circuit used in the model train lighting. Today well look at board layout.
Above is a completed board with the CR2477 battery, MSP430, resistors and tilt sensor wired in. This all went into a nice neat little box I designed for this project which can be found here. I used a socket for the mcu because I would like the ability to reprogram, reuse or replace it at will. Both the RESET and LED resistors were wire under the socket to save space on the board, While I didn’t need to do that for this board layout, I might want to modify the board at some point in the future.
I put the tilt sensor on a board of its own, with solid wires running into the main board. This gave me the required horizontal alignment, but also allowed me to fine tune the angle by being able to twist the whole board ever so slightly. The original design called for two tilt sensors, but I found that I didn’t need the second one. I removed it in the code, but you could just as well keep it and bridge it or attach it to some other sort of normally closed sensor. I wired the LEDs up in parallel, an to be honest was probably a bit too arty when I did it.
I don’t have an image, but these were then glued into the roof of the unit with some tinfoil backing to provide some reflective. The wires were glued off to one side and fed through two small holes drilled in the base of the coach. They were then cut to length and glued into position and then soldered onto the board. If you look at the first image, you an just see the white wire glue into the base behind a very small wall. This way none of the wiring can be seen.
Below is a time lapse video of the test. To be honest it works exactly as I wanted it to.
Now to the lessons learnt.
- I need to add a switch between battery and board for longer storage times when I wont be operating the units.
- The units I have built so far seem to turn off the lights at slightly different times, even though the code is EXACTLY the same. I can only assume that its dependent on things like temperature, voltage, and differences between individual packages. To fix this, the design might need to include a more accurate oscillator.
Well that’s it, thanks for checking this set of posts out.