Jump to content

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


LMSFan72

Recommended Posts

Hi All. Hoping for some help from an electronics expert to confirm a circuit to help me use a function to switch between day and night headlights. This would enable directional headlights at each end that would be switched between right and left depending on the 3rd function. I have attached a hand drawn circuit of what I think would work. I included diodes to protect LEDs when the alternate hand is switched on - not sure if they are actually required -  and I think my use of an NPN nad PNP transistor is correct..... Any help would be very much appreciated. I think this is defaulted to Night on as normal but switching to day when F25 is on...

 

/media/tinymce_upload/f649d018d59bfc8c541502fd7a83823d.jpg

Link to comment
Share on other sites

  • Replies 58
  • Created
  • Last Reply

LMSFan72,

.

Please find my revised (tested) circuit below:

.

Your circuit is close and a very good and brave design effort. But my assessment of it is that the NPN transistor will never switch off. The potential divider bridge created by the 10K and 47K resistor will keep the 'base' voltage of the NPN transistor in a forward biased condition whether the F25 green wire is either 'on' or 'off'. To switch the base of the NPN into the 'off' condition will require a voltage much closer to the -ve supply rail.

.

I have to admit I am not too sure about the concept of 'day' and 'night' running lamps, but if you want the two transistors to toggle between 'on' and 'off'. That is to say when the NPN is 'on' the PNP is 'off' and vice versa and be controlled by the application of a switched -ve condition on the Green F25 wire, then this modified circuit will do it.

.

As you have already identified the circuit will default to the 'Night' running mode.

.

When the F25 function is switched 'off', the voltage on the green function wire will be +ve (or may be floating on some decoder brands). Shown as brown on my drawing below. The NPN transistor will be 'on' because its 'base' is being saturated by the +ve supply rail via resistor R2 and/or via R3. The R2 & R3 resistors limit the 'base current' to protect the transistor against thermal runaway. The PNP transistor will be 'off' because the 'base' voltage is near +ve supply rail potential via R1 & R2 + R3. If R2 is omitted, then the circuit doesn’t switch correctly if the decoder green function wire should switch between being -ve and floating rather than +ve (maybe a possibility with a different brand of decoder). Keeping R2 in circuit is 'belt n braces'.

.

R2 being effectively in parallel (when F25 is ‘off) with R3 is not a major issue. The overall base current limiting resistance will be reduced to 910 ohms but this is still a low safe current value of about 12mA to 16mA.

.

When the F25 function is switched 'on'. The -ve (shown as blue on my drawing below) will ground the NPN 'base' and switch it 'off'. At the same time as providing a forward base current to the PNP transistor via the R1 & R3 base current limiting resistors.

.

The diodes in the dotted box are purely optional. There are no reverse voltages present in the circuit that could damage the LEDs.

.

Prior to posting this reply, I built this circuit on a breadboard (without the optional diodes) and can confirm it works just fine. With the F25 function wire connected to the +ve supply (or left open circuit [floating]), the NPN is 'on' and the PNP is 'off', and with the F25 function wire connected to -ve supply, the two transistors toggle their 'on' & 'off' conditions. I used the resistor values as per the drawing. The two transistors I used were BC549 (NPN) and BC556 (PNP).

.

/media/tinymce_upload/93f9f21bbac7082166f80054ed75bbc2.jpg

.

/media/tinymce_upload/e9529ba40d10cd63108034be0e32273b.jpg

.

EDIT1: If you want you could increase the value of R3 from 1K to 4.7K and the circuit still works on my breadboard. Increasing R3 will provide a greater safety margin with regard to lowering the transistor base currents.

.

EDIT2: Out of curiosity, I've just breadboarded your original design. My initial theoretical assessment was correct. The NPN transistor stays on permanently and doesn't switch off at all.

Link to comment
Share on other sites

LMSFan72.

.

I have just discovered by testing a Hornby R8249 decoder on my test rig that the F25 wire is not floating, but is +ve when 'off'. This is unexpected. I have therefore hidden the previous posts. Subject to incorporting a modification that I want to test on my breadboard first before publishing a revised circuit.

Link to comment
Share on other sites

LMSFan72,

.

Providing the F25 function wire switches between +ve (off) and -ve (on). Then this simpler circuit will work even better. Unlike the previous circuit, it won't work however if the decoder doesn't output a +ve voltage when the function is off (or a +ve voltage capable of sourcing the transistor base current). Note: I haven't breadboarded this design version, but I see no reason why it shouldn't function [subject to the caveat in ( ) above].

.

/media/tinymce_upload/9dd06cf783e1ee4dbfe9f8fc24ea53b4.jpg

.

Link to comment
Share on other sites

Chris

The green wire on an R8249 is controlled by F1. (Purple wire controls on F2).

 

If the OP is talking F25 to control the green wire then it must be a TTS diesel decoder, (which doesnt have a purple wire).

 

Is this project not very similar from a circuit point of view to the independantly controlled red lights discussed a few days ago.

Rob

Link to comment
Share on other sites

True, but that had no bearing on my R8249 testing as I was checking the voltage on the green wire when the function was off just to see if it was floating (open circuit) or +ve. It was +ve. Thus, I didn't need to issue any function command from my test bed controller to switch the green function on. That doesn't however mean that the same +ve 'function off' condition will be present on a TTS decoder. Thus the 1st circuit I documented accommodates that possibility.

.

Is this project not very similar from a circuit point of view to the independantly controlled red lights discussed a few days ago.

.

Yes, very similar. I did wonder if that was where LMS got the circuit idea from.

Link to comment
Share on other sites

The circuit has similarities to the post from a few days ago but is quite different in that in this case the light flip-flop: only one is on at any time. The other circuit enables one of 2 to be turned off but, always the same one. The assumption of a TTS decoder is correct although this is part of a bigger project that will use a second decoder for 4 other light functions. The limitation in not being able to reprogram F0 to be non-directional on a TTS is the driver here: I need to use the TTS for the headlights as they will be the only directional lights. I will use 4 other functions for complete independent control of markers and tails. Thanks for all the help.

Link to comment
Share on other sites

Chris, out of interest what do you use as the supply on your bread board rig?

I've got another interesting circuit I am working on too, that will be for a different loco which has LEDs on board wired differently. I have a newer Class 67 that I want to separate the marker and headlight switching on. The problem is that the lighting board (X6511) has a common negative for markers and headlights and already incorporates an n-mosfet to switch between day and night lights. My idea is to then add another transistor to that to be able to turn both day and night off (it's a theory at least!). I will be sharing that over the next day or so for more help!

Link to comment
Share on other sites

For my breadboarding, I use a variable bench power supply. It has a variable voltage output of 0 to 30 volts DC with a 'current' limiter to adjust current from 0 to 2.5 amps. In addition, there are two fixed voltage outputs of 5v & 12v limited to 500mA max. I bought it, if I recall correctly, as a special promotional offer from CPC [model MANSON EP-613].

.

/media/tinymce_upload/bd8e1589c750ca2a4b8d802571675e78.jpg

.

However for my decoder test rig, I use an ESU 53900 decoder tester connected to the output of a SPROG II v3 controlled by JMRI / DecoderPro

.

/media/tinymce_upload/585adf99abb2d2da81e2135c3b5fc2ec.jpg

.

/media/tinymce_upload/ef4d70df87e29cf3a6dc464213200be9.jpg

.

For monitoring DCC packets. I use an Arduino based 'DCC Packet Sniffer' that I gave a complete constructional 'How To' in the forum 'Off Topic' section. In the form of a downloadable PDF.

.

/media/tinymce_upload/4bc75e2e6041edf48eba701184454235.jpg

.

The PDF download link can be found on this forum page (click link below) and it is still valid as I have just tested it. The PDF contains download links to the software (SW) to run on the Arduino and instructions on how to install the SW and make the simple interface circuit.

.

https://www.hornby.com/uk-en/forum/post/view/topic_id/16982/?p=3

 

Link to comment
Share on other sites

Andy, circuits always have room for improvement, particularly after a good nights sleep before looking at the circuit again. This version 3 circuit, has all the features and functions of circuit 1 (i.e functions with green function wire being floating as well as +ve) but with the balanced symmetric simplicity of circuit version 2. I highly recommend basing your prototype on this one instead of circuit 1.

.

/media/tinymce_upload/977b2109f03b497fd23492839767b058.jpg

.

Link to comment
Share on other sites

Well, thanks again to Chris, circuit installed and working! Schematic below. This enables me to:

F2 - end 1 marker lights

F3 - end 2 marker lights

F9 - end 1 tail lights

F11 - end 2 tail lights

F0 - day head lights

F25 - toggle from day to night head light when F0 is on

Yard mode (markers and tails if light engine) with (F2, F11) or (F3, F9) depending on direction

Super shunter (all end and all tails) - (F2, F3, F9, F11)

Light running day - (F0, F2, F11) of (F0, F3, F9)

Light running night - (F0, F25, F2, F11) or (F0, F25, F3, F9)

Train in day (F0, F2) or (F0, F3)

Train at night (F0, F25, F2) or (F0, F25, F3)......

.... you get the idea!

/media/tinymce_upload/62ab9ef13fdbb14d919b060e665d0e2f.png

Link to comment
Share on other sites

Thanks Chris. I spotted the error in the first one last night after I had posted. I also think that's partly the problem I had with fitting the transistor the worng way round. Helps if I draw the circuit right first!!

 

I will try again on the second circuit later. :-)

Link to comment
Share on other sites

Andy, I've noticed a schematic error on your drawing. The PNP BC556 transistor on the right is shown on the schematic the wrong way round. It is the Emitter of a PNP that goes to the +ve supply rail. Obviously, it is the right way round in the actual circuit as it works, thus the error is just purely on the diagram. Compare my modification below to my original schematic earlier in this thread for circuit design version 3.

.

/media/tinymce_upload/6addadd1ed54ae29959b5a04fd5e508b.jpg

.

 

Link to comment
Share on other sites

Andy, this second circuit you are working on seems to have more resistors in it than are strictly necessary. I have modified the PNP 'Base' bias resistor configuration to the same as the previous circuit that you now know works.

.

Note: I have left the 1K & 2K resistors in-situ for the time being as the resistor values in the light green X6511 box are not marked with their values, but if these values are greater than 1K then I would do away with these two indicated resistors as well.

.

/media/tinymce_upload/08e2f7301d82976aa70b3662c8558260.jpg

.

The only reason I can see for Hornby using a N channel Mosfet on their X6511 board, is that when switched 'on' it offers an extremely low resistance to current flow. It is analogous to having a physical relay contact acting as a switch at that particular circuit location. As far as I can tell looking at the Mosfet's connectivity, it is acting as a 'changeover', to switch between 'Night' and 'Day' LEDs.

Link to comment
Share on other sites

Thanks Chris. The onboard resistances are tiny and are there to balance the loads as I understand. The additional ones were put in because of that.

 

Do you have any thoughts on being able to turn the day and night lights off completely. You have determined the mosfet use correctly, that's exactly what it does. I was wondering if there was a way to add another transistor switch that enables the volts to be dropped across another resistor so that both the night and day lights could be off but the markers still on. I cant figure a way because of the common negative! Thanks again Chris, Andy.

Link to comment
Share on other sites

Not without breaking the common +ve supply rail between 'markers' and 'day/night' lights within the domain of the X6511 board itself, and bringing out the 'day/night' light +ve rail to a third function controlled PNP transistor.

.

If the onboard resistor values are tiny i.e about 10 to 50 ohms 'give or take' a bit. Then they are balancing the forward bias voltages of the individual LEDs. This would be particularly important when the individual LEDs are different colours, as different coloured LEDs have different forward bias voltage requirements. Without these small balancing resistors, then you can get situations where red LEDs will light up but white ones in parallel will not. A white LED needs typically about 3 volts to light up whereas a red LED can light up on less than 2 volts. Once the red LED forward bias voltage is achieved (i.e 2v) then the white LED will not receive its 3v trigger 'on' voltage. These on board balancing resistors allow each individual LED to manage its own specific required forward bias voltage.

.

In that scenario i.e very small on board resistor values then I concur that larger external value resistors should be included to provide the bulk of the current limiting LED protection. As an analogy, think of it as a 'Master' volume control on a multi-channel audio mixer where each channel has in own 'fine volume' adjustment control.

Link to comment
Share on other sites

Thanks Chris, saw it just now. Having looked at the board I think I can break the common positive by removing the SMD resistors to the 2 headlights. Then I can put a bypass wire in rather than have to cut tracks.... I would then have to wire a resistor back in anyway. Measuring the onboard resistance I am getting about 1K from the small resisitors - they appear to be marked 102 but that's all I can see. I don't think there's anything else in the circuit I am measuring......

 

Anyway, building up the courage to take a resistor out but business takes me away for a week now so it will have to wait.

Link to comment
Share on other sites

Yes you are correct. SMD resistor 102 code is 1K ohms. Replicating the SMD resistor function off board, and soldering 'take off' wires to their pads (LED side) instead, rather than cutting the PCB track would be my preferred methodology too. Apart from which the +ve rail on the PCB track may continue onwards to other parts of the circuit. Thus in that scenario, two cuts would be required and the two outer cut ends would need joining together again. Just removing the SMDs and connecting take off wires in their place is the easiest option.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

Well, I am now working on converting another class 67 - this time Royal Sovereign. I plan on simplifying this installation by using the light boards as is rather than splitting the headlight positive. My Loksound decoder only has logic output on AUX3 so I need to amplify that up to full out to operate the night headlights. My proposed circuit is attached. I haven't yet bread-boarded it (waiting for the N-Channel MOSFET to arrive!), but, does anyone foresee any problems? I haven't used MOSFETs before but I also wonder with I can replace the "normal" bi-polar transistors with them too - mnaybe this is one for Chrisaf to help again!!

Many thanks for any help, Andy

 

/media/tinymce_upload/7071a82bab07cb5e6634e3d42c0a6b00.png

 

Link to comment
Share on other sites

Andy,

I am no brilliant expert on Mosfets either. But I know enough about them to suggest that your circuit won't work with a N Channel Mosfet. Reason why is decribed below:

.

This extract taken from the Loksound decoder manual

.

/media/tinymce_upload/2bd0d30078f42cee0c717fc34cbd49fa.jpg

.

So the manual says (as you have already correctly identified) that Aux3 needs a semi-conductor interface to the load. It goes on to say that Aux3 is functionally equal to other outputs. This I take to mean that the Aux3 output is switched negative the same as normal Loksound Aux outputs.

.

So if I understand your requirement correctly you want a semi-conductor that when switched on by a negative voltage on Aux3, connects another circuit to negative ground that can provide a suitable load current.

.

It is the Gate voltage that switches the Mosfet on and off but your circuit had the Source connected to the Aux3 switching output. The Mosfet symbol you used is for an 'Enhancement Mode' Mosfet. These Mosfets must have a discharge resistor between the Gate and Source, else the Mosfet will not switch off (see the video & the 10K resistor in my drawing). The other issue with your circuit, was that the Drain went to negative ground (which is fine for a P Channel Mosfet, but not any good on a N Channel Mosfet) and the Source (not the Gate) went to Aux3 switched negative. Thus there was no Positive voltage on the Drain. A N Channel Mosfet needs a positive Gate switching voltage. A P Channel Mosfet uses a negative Gate switching voltage.

.

This video gives a pretty good description of how to use Mosfets.

.

I can't guarantee that my circuit alternative below will work (see edit below), but it has a better chance of working than your circuit. Do note though, that it uses a P Channel Mosfet and not a N Channel Mosfet you have on order.

.

You need a P Channel Mosfet so that the Drain can go to the negative rail and so that the Gate can be negative switched.

.

/media/tinymce_upload/67506fb261288429664d711c4a3ecddc.jpg

.

EDIT:

A possible operation issue I have just seen with your proposed modification. In your earlier circuit. The one before you added the Mosfet to Aux3. The Aux3 output would be positive in the off state (you stated that was the case in a follow up reply after performing an LED test). That positive would turn on the two N Channel Mosfets circled in red, which in turn allows the LEDs directly above the Mosfets to turn on if the other appropriate Aux outputs controlling the transistors are also on.

.

When Aux3 goes negative, the two circled Mosfets switch off (extinguishing the LEDs directly above the Mosfets), but at the same time the negative on the Mosfet Gate turns on the LEDs to the right of the the ones just extinguished (again only if the Aux outputs controlling the transistor switching are also on).

.

In other words these LED pairs, when lit, would toggle state. Not being familiar with day / night running, I assume that is what the circuit is originally designed to do.

.

However. If you add the P Channel Mosfet to the Aux3 output. You could potentially lose that off state positive voltage that the Aux3 output is providing in the circuit operation described above.

.

Another however. There is still a high possibility that the circuit will still work. Because the 10K Mosfet Gate discharge resistor can potentially provide a path for the Aux3 output positive voltage to hold the two red circled N Channel Mosfets on when the Aux3 output is in the off state.

.

The 10K resistor therefore potentially has a dual function. It provides a Gate discharge path to allow the P Channel Mosfet to switch off when required to be off, at the same time as being a 'pull up' resistor to the Aux3 positive output voltage when present.

 

.

Link to comment
Share on other sites

Archived

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


×
  • Create New...