Current Sensor/Circuit Detection Model Railway

I am looking for a recommendation for a Current Sensor/ Circuit Detection which will raise HIGH if any current detected on a circuit The requirements is for a model railway block detection. The section of rail is isolated at both ends and is permanently powered with a maximum of 16V DCC. The maximum current would be 2A. A loco when idle on the track would draw around 0.03A and 0.5 A when powered. To ensure that it detects that the block is occupied when the loco has left the block but the coaches are still in the block, the end coach axle would be fitted with 10k resistor across the axle to draw a minimum current.

The objective is to determine if any object which draws a current is on the track to return the response to JMRI. I have seen other posts using Reed switches or IR sensing in and out of the block which is also possible. However, I would prefer to detect presence by current. The other methods are not user friendly on start up as users do not know what blocks are occupied when powering the system or if coaches become detached in the block.

I have around 40 blocks over a loop 6m x 3m and am planning on using the Mega with a Sensor Shield. I have investigated the ACS712 5A, however, this was not sensitive enough. The INA219 is a possibility, the I2C Bus could support the number of devices. I understand that the INA219 and similar sensors return multiple values proportional to the current flow and that I can read the values and raise a High or LOW, but I believe this is inefficient and that there must be a simpler circuit detection method which I am not aware of.

Is there a simple digital “is there a circuit? Yes/No” module which will raise HIGH if there is a circuit/any current flowing. Or suggestions on an efficient method to meet the requirement.

Wiring distance maybe another topic, I am not against having more than 1 Mega/UNO.

Please excuse my terminology, I am not very familiar with electronic terms.

Thank you.


If you want to detect only 2 current levels, maybe with a shunt resistor, a differential amplifier and 2 comparators with trimmer potentiometers it will be possible. You will hardly find ready-made modules, but if you understand a little about electronics, you can make them yourself. Why not just use small magnets placed on the train and a Hall sensor mounted below the line?

Did you check the datasheet of the ACS709 current sensor?
As I understood you will use this sensor as state detector only.

Thank you, I am afraid, whilst I have heard of the components, I would have no idea of how to build them into a circuit. With regard to your second comment regarding using small magnets and Hall sensors. This would be similar to using photoresistors or IR. The issue is that each block is around 3m in length and a train could be anything from .25m to 1,2m. It would require a lot of sensors, otherwise, there would be times when the train would not be near to the sensor and the entire system would not be accurate on start-up. Thank you again.

How have other enthusiasts approached the problem?

Yes, done done and done over here. I used a current transformer such as is used to monitor power line currents, sensed by an analog input. But you say you have no idea how to assemble components into a circuit. If that is the case, you are much better off just buying a commercial track occupancy board.

Reliable train detection requires a combination of both track current and optical/magnetic position sensors.

Transformer based:
Diode based:

If you can handle learning to assemble circuits, my transformer circuit uses the transformer, and two resistors. But I don't have the circuit in front of me right now, it would take some digging because I set it aside a while ago to work on other projects.

I tried the ACS709 and the sensitivity was not nearly good enough.

To follow up, there are commercial products, these are around $40 per block. 40 to 50 blocks is a tidy sum and they are also proprietary, which then requires the suppliers train control infrastructure. In some case a block is split into sub virtual blocks to detect the train location within the block and this would therefore double the cost.

As has been stated above, to do this properly, I also need to understand the general position of the train in the block for example when stopping at a station, this would require a mixture of current detection and IR detection at specific locations in order to command the train to stop at a specific point, I am in control of the IR part of the process.

I do not require to know the current values. My thought process is that there must be a simple sensitive component that detects if there is a circuit, but I don't know what it is. But maybe I am wrong.

Thank you

The commercial detectors are not proprietary. All the ones I have ever seen, apart from those that are integrated into a system, provide generic open-collector outputs that you can connect to either a computer interface, or directly to simple signalling circuits.

If there was a stupidly simple way of doing this, it would have dominated the hobby by at least a decade ago or more, as microcontroller costs and features improved. But there really isn't. But the commercial boards I have didn't cost $40 a block. They detect 4 blocks each, and sell for about USD$35.

I can tell you what my (very slow) development rests on. I can detect one block for each analog input, so depending on the number of analog inputs, that is how many I can attach to a given Arduino. In most cases, eight. I haven't actually tested multiples but I can't see any reason why it wouldn't work. The transformers themselves are not super cheap, so that is a minimum investment along with some Arduino, but then the total parts cost could be something like USD$15-20 for an eight detector board. But that is not an assembled unit, it's a hobby project.

Thank you. The pricing appears reasonable. I am not clear of the product that you are referring to, please can you share more information on these block detectors

Sorry, which ones, as I referred to several? Possibly this "Quad Occupancy Detector"?

I do use them, I'm not endorsing them other than to say that they do work well. There are others. I have 3 of them installed now, for 12 blocks.

Thank you, I am in the UK and have not seen these in my searches.

In regard to the comments regarding such a search for a solution. I believe that this is the purpose of this forum for users to search for alternative solutions to an existing process. I am not sure that users here stop because an existing commercial solution exists. I do appreciate your comments and links provided, all information is helpful.

Yes, however some proficiency or basic experience with hardware and software is assumed, when alternative solutions are sought. Hence it is not helpful to hand out suggestions which really are not feasible for an inexperienced person to actually design and build. Electronic designs aren't abstract things, they are real world constructions that depend on a myriad of techniques and factors, or they don't work at all.

You are quite right, I am sure I will back again to seek further advise as I hopefully develop my skills, I am looking forward to the challenge.

Everyone has "a path". They are similar but individual. Generally though, it follows a pattern of fully mastering certain topics, with gradually increasing difficulty. If you want to DIY, why not try building the circuits I linked to? Those can be connected to an Arduino input.

Oh, and stay away from "brag and run" sites like YouBoob and Destructibles.

I would be interested to receive any other suggestions.

If any one has experience of the INA219 and if that may be fit for purpose.

Thank you

Not sure why you're shunning current transformers. They really work better than anything else, most DCC track occupancy devices use them now for that reason.

I am not shunning your suggestion. I do not wish to disclose my own pros and cons of any suggestions as people become defensive of their proposed solutions.

I would like to receive other comments and suggestions, I will then review all the suggestions and determine how I wish to move forward.

Thank you for your comments.

I'm only saying, look at what the industry is doing.

Have you looked at the MERG website they sell kits which are about £6 for 2 block unit and the do an 8 block kit easy to solder and work with jmri very easy. if you like them you will need to join 1 year membership £16
i have 15 units so far on the layout and not had any issues.
click on the download list for info

Hi John,

Thank you for your comments, I have checked with MERG and the Block Unit looks ideal
Thank you.