Add-on Hall Effect Sensors for Train Speedo

by coopzone in Circuits > Electronics

271 Views, 0 Favorites, 0 Comments

Add-on Hall Effect Sensors for Train Speedo

IMG_3933.JPG
IMG_3934.JPG

The original design for the train speedo uses IR sensors (pictured above) these work fine and have the advantage of using light as the sensor so you don't need to add anything to your train. See https://www.instructables.com/Model-Train-Speedome...

However they are large and difficult to fit on some layouts and can suffer from ambient light interfering with them. These sensors are tiny by comparison, not effected by ambient light. And you can trigger them selectively so it's possible to measure the speed of just one train even if the section of track is used by other trains.

You can use many type of hall effect sensor and plug them into the same connectors (different pins, see later). The software on the PIC chip does not need changing the original version works fine.

You do need to add a small magnet to the underside of the carriage to trigger the sensors.

Supplies

You will need the following:

4 pin dupont header (you only use 3 connections)

Neodymium magnet as thin as possible and small enough to fit under the carriage. I tried two types 1mm x 1mm very small and 3mm x 0.5mm (flat).

Hall effect sensors either latching or single switch type, things like A3144 3144E OH3144 Y3144 U18839

Try and select / use a "sensitive" version. These should work within 10-15mm distance of the magnet.

Building the Sensor Leads

Screenshot at 2021-09-19 15-01-05.png
Screenshot at 2021-09-19 17-08-48.png

Using the picture above, you will see the sensors have 3 pins, they are:

1 - +5v
2 - GND
3 - Out

These pins will connect to the PCB on the following connections:

Sensor	PCB
1	4 (labelled RC2/3 or RD0/RD1)
2	2 (GND)
3	1 (S)

As you can see from above, we use only 3 pins but you need a four pin dupont connector because we skip over pin 3 (+5v it's not connected). This is because the software needs to control the power to the hall effect sensor allowing the latching type to be reset by the software.

Cut three wires from a strip of ribbon cable

Using a sharp knife or wire cutters start by cutting the end of the ribbon cable along it's length, about 10mm will do it. You can now use your hands/fingers to pull the the split sides of the ribbon cable against each other to strip the three wires from the main ribbon cable. It should split cleanly when you have cut the first 10mm or so to help start the process.

Separate out the three wires using the knife or cutters at one end. About 15mm in length. Strip the last 2mm of the wires and tin then with solder.

Cut three small pieces of heat shrink tubing of a suitable size (about 10-12mm each) and place them on the wires you have just prepared.

Trim down the leads on the Hall Effect Sensor to about 10-12mm and tin the leads.

Carefully solder the wires on to the Hall Effect Sensors. You can use something like blue-tack to hold the sensors still while you solder them. Make a note of what colours attach to each pin so that later you can get the correct order on the dupont connectors.

Now slide the heat shrink tubing forward over your joints and shrink it using the heat of your soldering iron. You need to make sure the tubing goes all the way to the sensor. To remove the risk of the leads shorting out.

Now slide a thicker piece of heat shrink tubing from the other end of the cable and over the three small pieces of tubing. Shrink it down with your soldering iron. This will hold the wires in place as neatly as possible (see photo above).

Since the ribbon cable is flat you should be able to work out which wires connect to which pins.

Now attach the 4 pin (missing out pin 3) to the free end of the cable, pinout above.

And your done.

This article is not about how to connect dupont cables, there are plenty of articles on how to do that. For example https://www.instructables.com/Dupont-Crimp-Tool-Tu...

Test the Sensors

IMG_3998.jpg

Once you have completed two sensor cables, it's time to test them.

Connect the sensors to your speedo PCB.

Identify the poles of your magnet.

The Hall Effect sensors are polarity sensitive, that is to say, you have to use the correct poles on the magnet. So from one side of the sensor the south pole will be used and from the other side it's the north pole.

Try your magnet from both side on the sensor until in activates. Then mark the magnet with a permanent marker so that you know the correct way to mount the magnets on the underside of the carriage.

Attach the Magnets to the Carriage

c2655a9e-f94a-4108-8bc0-b9df8e0b6b35.jpg
Untitled.jpg

You probably want to use a cheap carraige for this that way to can move it from train to train when checking speed on the layout.

Even though you should have identified the correct polarity of the magnets by now at this first step use a small amount of blue tack to fix the magnet to the underside of the carriage.

Next run the carriage of the sensor and make sure it works.

Next use a spot of superglue to fix the magnet permanently to the carriage.