($22.83) The Teensy 3.1 will be used as the onboard locomotive
computer for this project. The board may be
purchased here.
The pinout for the board may be
found here.
Pin usage:
0,1 (RX1,TX1) | bluetooth |
2 | Tachometer |
3(pwm),7,8 | Motor control |
4(pwm),11,12 | Motor control |
5,6 | Coupler load sensors |
9,10 (RX2,TX2) | Reserved |
DAC | Sound output |
13 | Power LED |
14 (A0) | Track voltage monitor |
15 (A1) | Motor load sense |
16-19 | Additional: digital/analog/touch inputs; ditigal outputs |
20-23 | Lights/Smoke (digital or PWM) |
($1.14) Power for the onboard electronics will be provided by DC on the track rails. The exact voltage can vary, and we need to provide a regulated 5VDC for the electronics. I am using an LM2596 DC-DC converter which will be suitable for track voltages between 8-35VDC. A multimeter will be required to adjust the module to the desired 5VDC output, then a dab of paint can be put on the adjustment screw to lock it in place.
($4.45) Bluetooth control is enabled by a serial module such as the
HC-06. These may be found on Ebay for a low cost, but generally ship
from China and may take several weeks to arrive. Connection to the
Teensy is as follows:
VCC -> 3.3V
GND -> GND
TXD -> RX1
RXD -> TX1
Alternates:
HC-05,
HM-10,
HM-11
($0.50) Control of the locomotive motor will be handled by an L293D
DC motor controller. This chip can control two motors but will
only handle a maximum of 1.2A of current
(possibly only 0.6A per channel?) so I will need to check if the
locomotive motors fall within this range. This chip can also be
found cheaply on Ebay.
Controlling the Speed of DC Motors
Complete speed/direction example
Discrete logic inverter
Alternates:
DRV8801
($0.11) For car detection on the layout, magentics will be used. An A3144 Hall effect sensor should be able to detect the passing of a magnet within a limited range.