Track Sensor
Click images to expand
The track sensors are simply Hall Effect sensors that detect magnetic fields. In order for them to work, you'll need to attach magnets to the bottom of your engines. Some of my magnets are 2 mm thick and some are only 1 mm thick. It just depends on what vehicle you're attaching the magnets to as to what size you'll need. The A3144 sensors can detect a magnetic field about 1/2 inch away in plain air, but when placed under track, that distance is lowered, so you'll need to get them as close to the underside of the track as possible.
Basic Instructions:
Hardware:
A3144 Hall Effect sensor [click here]
Magnets. Search Amazon or go to your local hobby store to find what you need.
MCP23017 GPIO Expander [click here]
--Note: There are also mcp23017 breakout boards available now.
Example: [click here]
Review the datasheets:
A3144 data sheet [click here]
MCP23017 data sheet [click here]
Test the sensor:
circuit diagram [click here]
sample implementation [click here]
Attach magnets to engines/trolley. I used super glue, but I'm sure there's other ways that will work fine too. I wouldn't recommend the baking soda trick as you'll want to keep your engine or trolley nice and baking soda can get messy quick.
Attach the sensor to the bottom of the track [click here]:
Please test your sensor to make sure you know what the correct orientation is before attaching it to your track. The numbers in the image are the order of the pin numbers. Also note, I do recommend soldering as opposed to using the Dupont connectors like I did originally. Soldering is especially important if you plan to transport your train set in a vehicle. I used plain super glue to attach my sensors, but the next time I do this, I plan to use the super glue + baking soda tick as shown in this video: [click here]Schematic: [click here]
It may also be helpful to have the mcp23017 pintout handy [clik here]
Software: [click here]
Note that in the example programs, there is a "knob test" program that is very handy and will easily test if the sensors are working correctly or not.