Optocoupler in model rail block occupancy detector

Thread Starter

ChrisPSR

Joined Sep 20, 2012
16
I did you a quick circuit, the values would have to be altered for a specific amp / comparator (I just used a generic one to try it out.)

Current is fed to the track via a sense resistor, 0.1 Ohms in my sim but I suspect you would need circa 0.5 Ohms in practice.

The two shotkey diodes limit the voltage drop to 0.5 volts whatever the current.

Depending on the polarity of the supply one of the two comparators will be on when even a small current is flowing and if either is on then the LED will light up.

Attached are circuit in 3 conditions.
Block unoccupied > no current - no light
Block occupied > high fwd motor current - indicator on
Block occupied > low rev current - indicator on (resistor on axle)

You could further mod the circuit to be supplied from the throttle and also the aux output of the controller.
It could then supply a limited current when the throttle is off so that block sensing works when nothing is moving and when the throttle is on the motive power would do the same job.

This is a simple mod requiring some diodes and a current source which is easily constructed from a voltage regulator and a resistor.
Hi Dyslexicbloke,

Built your circuit but I can not get it to work. You have not shown any power to the comparators, is this correct? I take it that the LH feed for the pot., is unused; the power for the relay I take it is meant to be delivered by the circuit live rail feed as is the power to the two switched outputs (?) with the coil feed returned to the -0v rail all given that the controller is delivering sufficient power to operated the relay's coil. Am I correct or just simply ignorant of the circuits power and purpose? Many thanks,
Chris
 

djsfantasi

Joined Apr 11, 2010
9,237
There is one basic question I have about this circuit. It shows that the 4 Amp bridge rectifier is placed across Rail - and Rail +. Is this both sides of the track? If so, the bridge rectifier is a direct short, and your supply will probably trip its internal circuit breaker.

This type of circuit is meant to be placed in series with one side of the track leads, so that the current passes from the power supply, through the bridge rectifier, then to one side of the track and then through the motor to the other side of the track, then from there to what I think you have labelled as "Rail -".

Does this make sense?

 

Attachments

John P

Joined Oct 14, 2008
2,063
JohnP

Many thanks for your input. In general I see where your coming from and it all looks very simple. I'm not too sure just where the PNP emitter(?) leg and the resistors to the left are coming from, is it earth? Do I take it that the lines shown to the right and above the controller are track?, and that the track at the top from which the polarity is determined is that same track?
Cheers,
Chris
The PNP transistor and resistor are receiving current from a positive voltage I labeled Vsense, and as I said, it has to be at a level higher than the throttle can ever produce.

The "lines shown to the right and above the controller" are a switching matrix. I just showed a set of intersecting lines, but the idea is that it can connect any throttle to any block. The matrix has to be capable of connecting a single throttle to several blocks, and also to allow this to happen for multiple throttles if more than one train is running.

The track at the top of the diagram is one sample block. Each block needs a reversing relay, a series diode and a current-sense network.

It really might be more productive for you to install DCC on your layout, because that's been very cleverly designed for people without much electronics knowledge to use. If that's not your background, you may spend a lot of frustrating time trying to get things working without knowing what's wrong.
 

Thread Starter

ChrisPSR

Joined Sep 20, 2012
16
There is one basic question I have about this circuit. It shows that the 4 Amp bridge rectifier is placed across Rail - and Rail +. Is this both sides of the track? If so, the bridge rectifier is a direct short, and your supply will probably trip its internal circuit breaker.

This type of circuit is meant to be placed in series with one side of the track leads, so that the current passes from the power supply, through the bridge rectifier, then to one side of the track and then through the motor to the other side of the track, then from there to what I think you have labelled as "Rail -".

Does this make sense?

Hi djsfantasi,

I have been telling people on this site that it is shorting out and tripping the Gaugemaster 100 controller/throttle. So thank you very much for this advice; I saw that the original optocoupler circuit showed the principal explained by you but I could not understand where the output/return was going from the opto. As I only have a project board made up I am unsure just where the return of the optocoupler should go, and still am. Perhaps you could explain to me just how to deal with the circuit when it is not attached to any more than a strip of twin rail road/track. I could only see that the other rail as being the place to make a connection to, hence the error that you have pointed out however I still cannot see how I can incorporate this circuit any other way, can I possibly ask for your help with this too please?

As you may have gathered I'm new to electronics but not to straight forward electrical circuits I think it's a bit akin to arithmetic versus mathematics or perhaps more like plain trigonometry versus spherical trig. Getting your head around it is not as easy as might be imagined.:)

Cheers and many thanks,
Chris
 

Thread Starter

ChrisPSR

Joined Sep 20, 2012
16
The PNP transistor and resistor are receiving current from a positive voltage I labeled Vsense, and as I said, it has to be at a level higher than the throttle can ever produce.

The "lines shown to the right and above the controller" are a switching matrix. I just showed a set of intersecting lines, but the idea is that it can connect any throttle to any block. The matrix has to be capable of connecting a single throttle to several blocks, and also to allow this to happen for multiple throttles if more than one train is running.

The track at the top of the diagram is one sample block. Each block needs a reversing relay, a series diode and a current-sense network.

It really might be more productive for you to install DCC on your layout, because that's been very cleverly designed for people without much electronics knowledge to use. If that's not your background, you may spend a lot of frustrating time trying to get things working without knowing what's wrong.
Many thanks for the response and explanation which I understand and can see that you understand model rail and its electrical scene. I'm more interested in getting just one block working with this overall concept rather than the one that is functioning and in place at the moment and then I can proceed to in corporate it into the layout in general.
My interest is though two fold; 1) in railways and model rail in general and 2) in learning about electronics.
Some things still puzzle me in electronics but I do have a fair understanding of Ohms law and arithmetic in general and am quite capable of working out values and constraints surrounding transistors and circuits such as voltage dividers and loads switched by transistors. But please don't misunderstand these statements as to being from a pig headed old chap such as I am, as I'm sure that I can make a mistake much more readily than you guys that fully understand the discipline. So if you can find it in your heart to not give up on me I would be very happy.
Cheers,
Chris
 
LM339 will be just fine. They are quad so 1 chip will do 2 blocks.
They will not source current though so you will need to hook the indicators to aux+ change to polarity and remove the cross connection resistors.
Apart from values all the input circuitry will be the same.

They do need power anywhere between 3 and 36 volts but you will want to fix it at whatever your aux supply is. Not showing power to chips is fairly standard for development drawings; there are no capacitors shown either but you will probably need some smoothing and decoupling.

LH end of the pot could be open or tied to the wiper

In my drawing there is a battery, below the relay contacts.
In practice that would be your throttle and it feeds everything not the other way round.

Don't bother with the reversing relay until you get the sensing working.
On my drawing the relay coil is fed from the throttle output with its ground leg switched but in practice it would need to be from the auxiliary supply along with the op amps.
I only showed it that way so that my simulation worked and I didn't require a second supply

you get that the resistors and switches between the rails are load simulators right, you don't fit those.
 

Thread Starter

ChrisPSR

Joined Sep 20, 2012
16
Dyslexibloke,

Thanks I'll answer your questions/statements below in blue if I may:

Statements:
They do need power anywhere between 3 and 36 volts but you will want to fix it at whatever your aux supply is 13.75vdc. Not showing power to chips is fairly standard for development drawings; there are no capacitors shown either but you will probably need some smoothing and decoupling. OK

LH end of the pot could be open or tied to the wiper. Wiper? Does it = the Variable leg in the pot?

In my drawing there is a battery, below the relay contacts.
In practice that would be your throttle and it feeds everything not the other way round. Took that to be a capacitor :confused:

Don't bother with the reversing relay until you get the sensing working. OK.
On my drawing the relay coil is fed from the throttle output with its ground leg switched but in practice it would need to be from the auxiliary supply along with the op amps. OK - understood.
I only showed it that way so that my simulation worked and I didn't require a second supply. OK.

You get that the resistors and switches between the rails are load simulators right, you don't fit those. Yep, I understood that.

No wonder that it didn't work!

Cheers,
Chris
 

John P

Joined Oct 14, 2008
2,063
OK, here is my design redrawn for a single block, with component values added. The diode and transistor are parts you can commonly get in the USA, but basically any small PNP and any diode capable of handling an amp or so would be OK.
http://files.myopera.com/John98wbr/albums/661338/blockocc2.jpg

The Vsense voltage could come from the aux output of the controller, if there is one. It might not be at a high enough level to work when the throttle output is at its maximum, but it should demonstrate the principle, especially when the throttle output is zero. Note that this requires that the throttle output is positive (and the diode will prevent the train from reversing!) You must use the external reversing switch, though you can leave it out if you accept that the train will only go one way.
 

djsfantasi

Joined Apr 11, 2010
9,237
Hi djsfantasi,

I have been telling people on this site that it is shorting out and tripping the Gaugemaster 100 controller/throttle. So thank you very much for this advice; I saw that the original optocoupler circuit showed the principal explained by you but I could not understand where the output/return was going from the opto. As I only have a project board made up I am unsure just where the return of the optocoupler should go, and still am. Perhaps you could explain to me just how to deal with the circuit when it is not attached to any more than a strip of twin rail road/track. I could only see that the other rail as being the place to make a connection to, hence the error that you have pointed out however I still cannot see how I can incorporate this circuit any other way, can I possibly ask for your help with this too please?
I have attached this diagram to show you how this type of circuit is often hooked up. As others have pointed out, soldering resistors across the wheels of cars will allow them to be detected as well, at the cost of increasing the amount of power your Gaugemaster 100 will have to supply. For passenger cars, including internal lighting will serve the same purpose.

You will have approximately 1.4v drop across the bridge rectifier, reducing the voltage to your engines motors. While often not a problem (as top speed is usually too high), it may be annoying as you will have to crack the throttle wider to overcome this initial voltage loss. One can include a DC offset into your power supply, so that there is always a minimum of 1.5V supplied, but the details for this will have to be worked out depending on how you have blocked/wired your layout.

So for now, here is a simple diagram showing how to wire in the bridge rectifier to detect a motor or load across the rails. This will work in both directions, so that you will need only one reversing switch for many blocks, plus additional reversing switches for reversing blocks as required. Of course, DCC eliminates much of these problems.
 

Attachments

Guys a 4N35 only has 1 diode, this will work in one direction and isn't drawn correctly.
http://pdf1.alldatasheet.com/datasheet-pdf/view/26143/VISHAY/4N35.html

A wiper is the variable leg, yes.

The single transistor solution should work, given enough voltage, but the transistor has a gain of 100, which will make the system fairly insensitive and difficult to set up.
I don't like nit picking but how can you specify a current limit resistor for an led without specifying the voltage?

And why a 555 connected like that it isn't going to time anything, at best it will work a little an op-amp but not well, if at all

I cant believe how long this thread has got given the relative simplicity of the task.
Am I missing something?
 
Last edited:

Thread Starter

ChrisPSR

Joined Sep 20, 2012
16
Does Block power = the power delivered by the controller/throttle as that is the only power that I have going directly to the metals/rails an if so is this the positive supply with the negative side going to rail. Else what could I use or do I need to introduce an external power source?

Chris
 

Thread Starter

ChrisPSR

Joined Sep 20, 2012
16
Dyslexicbloke,

So sorry. I don't mean to take anybodies time unnecessasarily. I will retire from the forum tonight.

The LED., is simply a red which I just thought people would understand to be red having a 1.8-2.0v forward voltage and the transformer is running the standard UK., model/motor(auto)/rail 12v/walkie talkie transformer providing smoothed 13.75v input.

The 555 was used in order to provide a high (Vcc.) output rather than a comparators low output.

Chris
 

Thread Starter

ChrisPSR

Joined Sep 20, 2012
16
Dear djsfantasi,

I am worried by others comments that I am taking up too much very important time within this forum so I am going to retire from the post as of now. I thank you kindly for your help in this matter and I assure you that I have listened and printed out everything that you have so kindly provided. I hope to get the scheme off the ground even if it means failing with this scheme and having to go back to using my old block detection by LDR., which I see as spot detection rather than "Train in Section". Thank you once again, I remain yours,

H Chris Spreckley.
 

dataman19

Joined Dec 26, 2009
135
So as I see it - Everyone thinks that "basics" don't warrant explanation or clarity?
No wonder we don't have any engineers or engineering jobs in the US Anymore - we are too preoccupied being pios...
...
I too like Model Railroading, and I enjoyed all the inputs and views...
..
Now have to go back to my tinkering..
..
This interesting thread died too early...
..
Dave
Phoenix, AZ
 
Top