Currently a prototype is under test that implements a single axle sensor based on two light barriers for detection of wheel flanges and the direction of travel.
The light barrier mechanical implementation is described on the pages of Michael Weinert
Software update over LocoNet is available with the IPL protocol using a BootLoader.
The current test version supports software update, configuration over the SV protocol, 1kHz polling of the sensor inputs and display with status LEDs.
The main design driver is the fact that the light barriers have a distance of 3,5mm, which is space enough for a wheel flange to be in between without being recognized by the sensor. The detection zones do not overlap. Therefore tricky logic is needed to be sure to count in the right direction. The following graphic shows the nominal sequence of events:
The logic for evaluation of the input signals for generation of counter information is currently under review. The following state maschine is a request for comments:
The state names are choosen by the following rule: They begin
with a human readable part and are followed by the state of the
sensor inputs that lead to this state. H=blocked, L=free, left
one is sensor 1, right one is sensor 2. Example:
The transitions are composed of a name for the edge type (rising = getting blocked = L ⇒ H, falling = becoming free = H ⇒ L), followed by the number of the sensor that it applies to.
Paths through the chart
The nominal path for a flange that enters over sensor 1 as shown in
the diagram above is green-grey-green and leads to a counter decrement
(shown by action
In case of a direction change on a barrier or due to a
detection error, the state maschine cound get confused
and interpret wrongly, whether an axle is between the
barriers or not. This error situation can only be caught
by timing analysis. The idea is that the time the axle
stays between the barriers is much shorter than the time
between two axles passing the sensor.
Therefore the time is measured for
a flange staying on the sensor area between the two rising
edges - see actions
When the flange is assumed to leave the sensor and the end time
gets sampled, the state maschine does not directly go to
LocoNet message to report counter state
We need a LN message that can carry an address for the sensor and a counter value. The current plan is to abuse the message OPC_ANALOGIO for this purpose.
Usage of data fields