Jump to content

Help :circuit to use DCC switch between Day and Night lights


LMSFan72

Recommended Posts

Thanks very much again Chris. I did think I might have drawn that wrong after I posted as I continued reading! Your theory makes a great deal of sense to me. It is interesting becasue I have come across a number of sources stating N-channel MOSFETS, so, I think bread-boarding will be the answer fro me. Take a look at this page, though, it is very clear on using N-channels:

 

https://www.stayathome.ch/aux3-4_verstaerken.htm

 

Now, I think this may be because the logic outputs may be normally 1 (5V I think) not 0, and when you operate the function it actually turns it 0. I think this is the case becasue if I connect an LED to the output with a 1K resistor that LED is normally lit and turns off when the function is turned on.

 

Link to comment
Share on other sites

  • Replies 58
  • Created
  • Last Reply

...the logic outputs may be normally 1 (5V I think) not 0, and when you operate the function it actually turns it 0.

.

That is correct....that is my understanding too. Hence why I highlighted (in yellow) the second sentence of the Loksound manual extract.

Link to comment
Share on other sites

Correct.....see symbol table halfway down this Wiki page. But I had to look it up to be sure, hence why I didn't commit to specifying component type in my earlier reply.

https://en.wikipedia.org/wiki/MOSFET#Circuit_symbols

.

However, having now identified the circled components as being N Channel Mosfets. This highlights a potential issue with your circuit operation. Go back to my earlier reply and review the new EDIT I have added to it at the end.

Link to comment
Share on other sites

Good find, but it is still a bit vague as in the article where he is measuring voltage and current in his test circuit, he still doesn't specifically state whether the Aux3 is switched on or off during the test. Plus your own testing with an LED (if you described it accurately) would indicate that when the Aux3 is on the output is negative. Plus ESU's own manual states that the Aux3 & Aux4 outputs operate functionally the same as the others.

.

But let us assume for a moment that the Aux3 output is indeed normally low (negative) and only goes high (positive) when the Aux3 output is on.

.

I still say that my circuit stands 'as is' for these reasons:

.

If I have understood your lighting circuit operation correctly (as documented in the EDIT in my earlier reply) then you need Aux3 to have a normally positive output to operate the red circled Mosfets. And then go negative to switch off the red circled Mosfets.

.

So this means that you would need to control the Aux3 output in reverse. That is to say, leave it switched on normally, but switch it off when you want to invoke the function.

.

At the end of the day you are still trying to switch the negative rail supply. Thus the P channel Mosfet is the more appropriate component to do that.

Link to comment
Share on other sites

Hi Rob, yes I have. He has about 3 different variations for a 67. That particulalr one is the ex-Lima model. His 2 versions of the later model use different decoders and do slightly different things. In both cases those circuits disable one end of lights whereas I want to be able to choose which end I have on (or indeed both). The decoders are different (one is  a ZIMO with full outputs on AUX3/4 and the other he chooses to use a second function decoder rather than the logic of the ESU). In reality I have a conversion board on order too, but, I rather like the idea of working this out to save info for the future!

Hi Chris, thanks again for your continued review and ideas. I will get there and when I do will update a final circuit and document those outputs as best I can! I may just do a test on one I have too... If I just but a voltmeter between VCC and AUX3 with the function both on and off, and no load attached, I don't think I will do any harm - is there anything else simple that you would do?

 

Thanks again, Andy

Link to comment
Share on other sites

I take it you have a breadboard Andy to save soldering up stuff then possibly having to undo it again.

 

The Bromsgrove site also covers those odd Hornby boards with either common cathode or common anode  circuitry.

Rob

Link to comment
Share on other sites

If I just but a voltmeter between VCC and AUX3 with the function both on and off, and no load attached, I don't think I will do any harm - is there anything else simple that you would do?

.

That should be fine.....I can't think off-hand of anything else.

Link to comment
Share on other sites

I take it you have a breadboard Andy to save soldering up stuff then possibly having to undo it again

Hi Rob, yes I do. I am also considering making up some little plug in modules for it so once I have working parts they are easy to re-use - small prototype board parts with components on and pins to locate into the breadboard...

Link to comment
Share on other sites

OK, so with my black, common probe on VCC and my red probe on AUX3 with the Function button OFF I read -5V. With the function button ON I read 0V

.

I believe that VCC is normally a permanent +5V to be used as a logic level power source to power external logic chip circuitry. It is not the same voltage that appears on the Blue wire (which is nearer 12-14 volts).

.

The red meter probe (rather than the black probe) should have gone on the VCC connection, but no matter as your readings still make sense to me.

.

Your test confirms that the output of the Aux3 is opposite to what the ESU manual infers. In other words, the Aux3 output is normally at ground 0 voltage (when off), and goes to +5 volts (when on). It read -5 volts because the red & black meter probes were reversed. I appreciate that at first glance this seems opposite to what you wrote in your reply, but that is because you used the VCC pin and not the Ground pin. For example the 0V reading you got was zero because you were comparing it against VCC (+5V), thus the 0 reading was actually +5V.

.

You can prove the above by doing the test again but this time, put the Black meter probe on the Ground terminal instead of VCC and the Red meter terminal on the Aux3. You should then find that when Aux3 is OFF you should read 0 volts and when Aux3 is ON you should read +5 volts. This would fit exactly with the documentation given in the last web link you provided.

.

It would appear that the Aux LOGIC functions of the Loksound decoder do indeed follow normal LOGIC level output expectations. That is to say ON means Logic 1 (+5V) and OFF means Logic 0 (0V).

.

Although these Aux3 reversed output voltages would fit in nicely with using a N Channel Mosfet. That is to say Aux3 going +5 volts when ON switches on the N Channel Mosfet. The issue still exists with a Aux3 Logic output that you haven't got a positive voltage when Aux3 is OFF to keep the red circled Mosfets switched ON. Plus there is no 'pull up' resistor path anyway, because the Source of an N Channel Mosfet (where the resistor is) would need to be on the 0 volt Ground side of the circuit.

.

This means that for your circuit operation you will need to keep the P Channel Mosfet design and implement my suggested 'reverse operation' policy. That is to have Aux3 ON normally and switch it OFF to invoke the Aux3 function. This I would suggest is just a minor inconvenience.

.

 

Link to comment
Share on other sites

Hi Chris

Testing confirms that common probe on ground pin and red to AUX3 returns:

AUX3 OFF = 0V

AUX3 ON = 5V

I will try with a P-channel when i get one - I am going to be away for a fortnight now so nothing much more will happen for a bit.

 

If I were to put a pull up resistor in (just like R10 in the previous circuit on page 3 of this thread) that should also work, shouldn't it? I like the idea of less resistors though so it would be good to get the P-Channel working!

Link to comment
Share on other sites

If I were to put a pull up resistor in (just like R10 in the previous circuit on page 3 of this thread), that should also work, shouldn't it?

.

If you mean this circuit on page 3, then No.

/media/tinymce_upload/80660ac23972224b226ddd311d4ab5c6.jpg

.

You show a N Channel Mosfet with the Drain going to the Aux3 output and the Gate going towards the load. Remember it is the Gate that switches the Mosfet on and off, so that circuit in that orientation is never going to work, resistor or not.

.

Even if you swap the Gate and the Drain connections (leaving the Source connected to the ground line). The Gate discharge resistor goes between the Source and the Gate, so would end up being on the wrong side of the Mosfet.

.

Even if you did try putting a 'pull up' resistor between the Gate and the Drain (not that I'm sure that would work anyway). You STILL have the issue that there is no positive voltage on the Aux3 to 'pull up' to when it is in the OFF state.

.

Remember the crux of the issue (repeating myself for the third time) is that you need a positive voltage to hold the red circled Mosfets ON when the Aux3 function is not invoked (I am purposely using the term 'invoked' and not using the term on & off here). The positive voltage is only present when Aux3 is ON. Thus the circuit can only work (if using that particular Loksound decoder) if you operate the Aux3 functionally in reverse. If the Aux3 function is used in reverse, then the Mosfet trigger condition then has to be a negative voltage.

.

To remind you.

N Channel Mosfet is switched ON with a positive voltage on the Gate

P Channel Mosfet is switched ON with a negative voltage on the Gate.

.

Link to comment
Share on other sites

Hi Chris, no I don't mean that circuit and I do understand the orientation of the mosfets now and the positive voltage at the drain to switch the N-channel, I think I have got it :-0

I am referring to the previous 67 that I did many months ago that started this thread, just not sure how to show it again...I will try and quote it

 

EDIT: I have quoted it in the next post but as it has an image it is now subject to moderation

Link to comment
Share on other sites

Do you mean the very top drawing on Page 3 that does not have any form of Mosfet shown against Aux3. Although that shows a MTC21 decoder I assume that is a non Loksound decoder and that Aux3 on it is a totally standard (non Logic) Aux output that is High (Off) and Low (On).

.

EDIT:

I have quoted it in the next post but as it has an image it is now subject to admin approval.

.

That now won't show before Monday at the earliest.

.

...positive voltage at the drain to switch the N-channel,....

.

Note: Gate not Drain to switch the N Channel

 

Link to comment
Share on other sites

Yes, that diagram, but I'm not being clear in what I mean!

 

I am simply proposing a pull up resistor between the common positive and the gate of the N-channel mosfets on the end lighting boards, with the wire heading to the AUX3 mosfet coming off on the lightboard side of the pull-up resistor.

Link to comment
Share on other sites

OK understand.

.

I would avoid that. Remember the Loksound Aux3 is a +5 volt Logic output. If you inadvertently connect a 12/14 volt supply rail voltage even via a resistor (basically anything above 5V) to the Aux3, then there is a high probability of damaging the Loksound.

.

In fact I would go as far to say that for 'high probability' read 'certainty'. Logic chips are very sensitive to over voltage, been there, done that, got the T shirt. Not Loksound, but I have blown a couple of +5 volt chips in the past.

 

Link to comment
Share on other sites

Your comment about the alternative location for the 'pull up' resistor got me thinking. You can't put a resistor from the Blue wire positive supply rail to the Aux3 / Mosfet Gate, as you suggested for the reason I outlined (see later EDIT below). But I had a 'light bulb' moment. I see no reason why you couldn't go back to using a N Channel Mosfet so that Logic 1 (5 volts) can be used to switch it on, and then put a 'pull up' resistor from the Blue wire positive supply rail to the Mosfet Drain instead.

.

The idea is very similar to the one you suggested**, it is just the termination location of the non 12-14 volt positive supply rail end of the resistor that changes.

.

EDIT: Note** On re-reading your previous replies again a few more times. I see that the Aux3 / Mosfet Gate junction was not actually what you were suggesting at all. You were suggesting something far closer to my newly documented option in this reply. It was just the Mosfet connection details weren't clarified in your earlier reply and I misunderstood.

.

If this idea works it gives the advantage that the Aux3 pin on the Loksound is isolated from any potential damaging voltages AND you wouldn't need to operate the Aux3 function in reverse. ON is ON and OFF is OFF.

.

Main overview schematic

/media/tinymce_upload/b60ba3537b18b6639357dcec2df871b4.jpg

.

Close up detail.

/media/tinymce_upload/aad430999e9e0262f77f15ef9cf82426.jpg

.

The 4K7 resistor is the 'Pull Up' resistor to provide a positive voltage to switch the main light Mosfets ON (the ones originally circled in red) when Aux3 is OFF (Logic zero, 0 volts).

.

When Aux3 is ON (Logic 1, +5 volts). The N Channel Mosfet is ON and drops the voltage on the Drain to near 0 volts. The current through the 4K7 resistor when the Mosfet is ON, should be in the region of 2.5mA.

.

I have shown the 10K Gate discharge resistor in dotted lines. Try the circuit on your breadboard without it, and put it in if the N Channel Mosfet does not switch off reliably. The tutorial video I gave the link for earlier said it was a requirement, but I noticed that your web-link documentation pages never showed it. It may be that the Aux3 pin actually going 0 volts when 'OFF' (and not floating) provides the Gate discharge function, thereby negating the need for the resistor to ground.

.

I think that this is the best circuit so far that has been discussed to date. Let us know how the 'breadboard testing' goes in a couple of weeks time.

Link to comment
Share on other sites

Well, that makes sense to me, too. Thanks Chris.

As I build the test circuit I want to test that I have the MOSFET correctly installed. If I have nothing else done than putting the MOSFET gate to AUX3 and the Source to GND, no other conenctions other than track power,  would I expect to get the same Volts between GND and AUX1 as GND and the MOSFET Drain - everything else open circuit?

Link to comment
Share on other sites

...MOSFET gate to AUX3 and the Source to GND, no other connections...

.

Whether you meant to say the above or not I'm not sure, but what you wrote infers that the Drain would be 'open circuit'.

.

I would think that the Drain would have to have resistive load to +ve. I don't think that the Mosfet will function correctly if the Drain is left open circuit.

.

Don't forget that Aux1 is not a logical output, so the voltages on Aux1 [0 or 12-14 volts] won't be the same as Aux3 [0 or 5 volts].

.

You haven't said what the states of Aux1 and Aux3 would be during this test. Assuming that both Aux ports are 'OFF', Ground to Aux1 would read +12-14 volts. Aux3 to Ground would read zero. As to what Mosfet Ground to Drain would read. Well if the Drain had a load resistor to +ve and Aux3 was 'OFF' then I would expect +12-14 volts. However if the Drain was open circuit you might read something completely unexpected, what I couldn't say.

.

The honest answer to your question is that if the Drain is 'open circuit' as your query implies then I don't really know.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
  • Create New...