Prices given below are for each piece including shipping. In many cases multiple pieces were purchased together for bulk discounts and to save on shipping costs.

($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
3(pwm),7,8Motor control
4(pwm),11,12Motor control
5,6Coupler load sensors
9,10 (RX2,TX2)Reserved
DACSound output
13Power LED
14 (A0)Track voltage monitor
15 (A1)Motor load sense
16-19Additional: digital/analog/touch inputs; ditigal outputs
20-23Lights/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
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.


Desktop computer

Programming the teensy

The loader application needs to be installed on your computer. Please visit this page and select your operating system to download the software. Install the Aurduino software, then run the Teensyduino installer. Visit the basic usage page for instructions on setting finishing the setup, installing code on the teensy, and using the serial monitor.

Layout computer

Teensy 3.1


Adding Bluetooth capability to your project
Add bluetooth to your Arduino project
Connect arduino to android phone via bluetooth
Control DC motor via Bluetooth
Example source code
Using teensy UART

Signal communications

differential Manchester encoding