User Tools

Site Tools


GCA141, Octal Wheel/Axle counter or hall sensor input


By Robert Evers, Gerard Remmerswaal and Peter Giling

LocoNet® is a trademark of Digitrax, Inc.


In the real world, the most used way of train detection is done by a so called wheel or axle counter.
This counter is a magnetic system, positioned between the rails and close to it.
Mostly there are two, one on each rail.
A passing wheel will be detected, and in this way a passing amount of wheels is counted.
Entering the next block, the wheels are counted again, and if the amount is the same as previous, the previous block can be entered by a following train.
This is a rather simple explanation of what is happening in the real world, but is gives some idea how it is done.
Some examples :
How does a level crossing work?/Wie funktioniert ein Bahnübergang? (german)
A system like this would be ideal for model railroading, since we all have experience with lost waggons or couches, many times causing damage to our precious materials.
The axle counter would be able to cancel that problem.
The counter must send the right amount of wheels of the train. If this number does not comply with the previous counted number,
Rocrail will keep the block occupied, and the train will not continue to a next block.
An addional step is to use Hall- sensors and magnets.
More about that seee below under 'using Hall sensors.' .

The Model railroad equivalent

This magnetic system is hardly possible in model railroad.
The most important reason for that is that many wheels are made of non-iron materials or even some kind of plastic.
So here we are going to use an Infra Red gate to make it work.
The sensor is placed somewhere outside the rails, the distance can easily be between 10 - 300mm, which makes it very easy to hide it somewhere, in buildings, or anyplace your imagination can come up with.
The transmitter, an IR-led, (SMD type), is situated between the rails, about 1.5 mm from either left or right rail, and facing to the rail.
If the led is placed on top of a legger, the top of it will be just level with the top of the rails.
This avoids that any locomotive or waggon will touch the transmitter. More about this item later (see GCA141-c).
The transmitter sends an infrared beam that has a radiation angle of 20 degrees.
Because the transmitter is more or less 'hiding' itself behind the rails, the receiver must be positioned slightly higher in a way that the angle from
transmitter to reciever has an elevation of approx 10 degrees.
This avoids that low hanging parts of mostly steam loc's are also blocking the IR Beam.
All we are interested is wheels. And because the beam is very low over the rails, anything that is > 1 mm above the rails, will be ignored.
As seen on the picture below, the test is setup with Maerklin C-rail, meaning that the loc is equipped with the ugly slider.
This slider can pass the transmitter without any problem.
The combination of transmitter and reciever is the same as used for GCA133, exept for the SMD shape of the transmitter.
8 Counters can be connected to the unit.
The unit is connected directly to the LocoNet with the same connetors as standard for D-con-LocoNet units.
No additional GCA50 is needed.
Rocrail will be adapted with settings, to handle this unit, and using this wheel number information as an extra safety guard for freeing a block.
A block can only be given permission for new entrance when all wheels are counted in the following block, so no waggons are lost!
This will turn out to be the most reliable system to avoid collision with lost waggons.
No other system is known, that can give this 100% guarantee!
Also for fiddling and sorting waggons this unit will give an extremely nice solution.
Please keep yourself updated by coming back here!
Another important use can be a railroad crossing.
With contacts, the contact that enables crossing the railtracks again, is set to such a distance, that also the longest used train has passed before freeiing the crossing.
This axle counter could als be used for this option, letting Rocrail freeing the railroadcrossing when the correct amount of axles has been count.
This means that the railroadcroosing will be opened right after the last wheel has passed the counter.
The combination with a GCA136 special edition for railroadcrossing will be something you never have seen before.

The test setup

Be sure that top of the IRled is not higher than top of rail.
In that way, nothing under trains or waggons can hit it.
Distance between IRled and rail should be close to 1.5mm.
The IR beam where we are interested in, is only passing approx 0,5mm over the rail, in an angle of 10 degrees elevation.
In this way, only wheels are seen, nothing else.
The distance can vary between 50 and 300 mm as long as the vertical angle of +/- 5..10° is taken into consideration.
With bright daylight, the distance should be no more than 50 mm, but very easy to find out by experiment.
It is very important to avoid that the IR beam can pass under the rails.
Therefore like on the picture the best position is on top of the legger.
The GCA141 is equipped with a led for every port.
The led will lit when a signal is received.
In that way it is very easy to adjust the position of the receiver.

The Protocol

The use of Loconet® PE in this unit makes it possible to send all 8 counters to the computer.
But of course the computer needs to know which counter is send.\\
Also there must be some way of resetting the counter, after the correct amount of axles of a passing train has been tranferred.
For that purpose , each counter needs an adress.
This address is used for both stated issues.
Rocrail will receive these counter values and process them to the according train controlling task.
Rocrail supports the setup with a programming dialog.

Hardware description

The GCA141 consists of a standard Loconet® interface.
The processor generates a solid frequency of 9.216 MHz.
Internal dividing with 256 will produce an exact 36 KHz, to drive the Ir Leds.
This 36 KHz is the frequency the receiver SFH5110-36 is expecting.
That makes the IR gate formed by IRLed and receiver very resistant to daylight.
The tests even have been made in direct sunlight, but there is a limit there.
In practice, direct sunlight into the receiver should be avoided.
Being zero, the first count of each input will be send immediately to LocoNet.
In that sistuation, the wheelcounter is doing axactly what a normal feed-back input will do.
After the first count of each input, GCA141 will send each change in a counter with an interval of 1 second, to avoid too much LocoNet traffic.
Each counter can individually be reset using LocoNet.

The final result

The assembled board The pcboard, factory made

The hardware/firmware

:!: As from Rocrail revision 3618 the firmware must be update to version 1.9.

The sensor and emitter board GCA141-c

To avoid any problems on longer connections between sensor and GCA141 board, the sensor is mounted on a little driver board.
The GCA141c is equipped with connectors like on the GCA141.
The outside of IRled , positioned between the rail, is liable to be short circuited to the rails by train wheels.
Precautions have been made to avoid that this will cause damage to the IR-led, or any other parts in the system.

Using Hall-Sensors

The use of Hall-sensors is a next extension to this project.
The connectors originally used to connect the GCA141c boards, are pin compatible with the standard TLE4905 Hall sensor.
The combination of Hall-sensor and magnets is doing basically the same as wheel counting, counting just the amount of magnets passing by.
The exceptional function in Rocrail to count these magnets provides a very simple and reliable way to have some extra security on your railroad.
Loosing one or more waggons or couches is no longer a thread.
Starting at version 5199, Rocrail will keep the route , in which these cars have got lost, occupied, and will stop the train from automatic running.
After collecting and positioning the lost items, simply free the route and start the train again.
Collisions are one step further from being banned,!
More information about the use of Hall-sensors can be found on this page.
The following drawing explains how to connect hall-sensors to GCA141.

Hardware of sensor and emittor board GCA141-c

Programming the Atmega 8 processor.

Kits , as delivered from GCA, are always with programmed processors.
For do-it-yourself situations, you need to programm this processor.
Can be done with a wide variety of programmers.
The most common is probably the ponyprog.

One other option is the widely available mySmartUSB programmer.:

mgv141-en.txt · Last modified: 2021/05/11 04:27 by rainerk