mosfet 'chaining' for modle railway point switching

Hello everyone

I have an electronics question

I wish to operate 17 solenoid units. Each unit consists of two opposing solenoids.

There are therefore 34 solenoids; each solenoid paired with another into 17 units.

Each arduino powered switch (using outputs from a shift array) will operate one of the opposing solenoids.

Is it possible to have 17 mosfets, in a parallel column, each of which has an output ‘feeding’ into a second ‘column’ of two mosfets .

to operate, therefore, one of the 17 first column mosfets is switched on and one of the two mosfets in the second column is switched on.

The first column therefore ‘selects’ which unit to operate and the second column ‘selects’ which of the opposing solenoids of the ‘selected’ unit to power.

My question is - is this feasible?

Can anyone help please.

Yep, that's matrixing. Just make those 17 MOSFETs N-channel (and connected to GND) and take two P-channel for the commons. Only thing is, if the voltage of the solenoids is higher then the Arduino voltage (which it is :p), you can't drive them directly. Drive the gate of those transistors LOW with a simple NPN transistor and pull it high with a pull up resistor on the gate to the solenoid supply.

Yes it is. It's actually a very common technique use in keypads, LED matrixes, and even larger LED cubes.

What you have reinvented is called a matrix, where M + N control lines (in your case 17 + 2) are associated with M x N (17 * 2) elements.

17 x 2 is not the best way to arrange them though, since that takes 19 MOSFETs and 19 output pins. A better arrangement is to arrange 12 MOSFETs into a 6 x 6 grid, for a total of 36 controllable elements. 5 less FETs, and 2 spare elements in the matrix. The mapping between matrix position and servo hardware is not as straight forward this way, but you can create translation functions in your code to handle that.

Thanks for your prompt replies.

I was hoping it was feasible.

I will stick with the 17x2 matrix. It will be easier on these aging eyes.

One more quick question - should I put diodes between the first and second set of mosfets?

thanks again guys

colubridae:
One more quick question - should I put diodes between the first and second set of mosfets?

thanks again guys

I don't think that's necessary.

I assume you're talking about something different than the flyback diodes you always need when switching a coil.

You could indeed do something other then 2x17 but that already is a saving and is easy (set direction, set number). Especially because the high side mosfet need another driver transistor. Although you could do 4x9 which is still not hard.

And every coil still needs a flyback diode over the coil :slight_smile:

Jiggy-Ninja:
I don't think that's necessary.

I assume you're talking about something different than the flyback diodes you always need when switching a coil.

I was not referring to flyback diodes, but thanks for the heads up

(are you talking about what shotky diodes are normally used for?)

and thanks for reply.

septillion:
You could indeed do something other then 2x17 but that already is a saving and is easy (set direction, set number). Especially because the high side mosfet need another driver transistor. Although you could do 4x9 which is still not hard.

And every coil still needs a flyback diode over the coil :slight_smile:

thanks for the flyback diode heads up.

and thanks for the advice

Not sure what you mean with "opposing solenoids".
Do they have two coils (three or four wires), or a single coil that needs a H-bridge.
What voltage/current/resistance.

So you are using shift registers (74HC595 ?) now.
Why not replace them with something like the TPIC6B595 (buildin mosfets and clamping circuit).
Leo..

@Wawa, that's a model railroad thing. One turnout has two coils. One for straight, one for diverging which makes the opposing :wink: And they always have 3 wires, one common and one for each coil. So no H-bridge necessary.

And using a TPIC6B595 is a nice solution for the side with the 17 turnout commons :slight_smile: Although you can even use two outputs of those (because he, 17 divides a little bit terrible by 8 :smiley: so you have spare) to drive the two high side common straight / diverging mosfets (instead of separate NPN).

The TPIC6B595 is $4.00 on ebay shipped to your door for 10 of them.
Not a problem if the last chip only drives one coil.
I suppose you could also switch other things (e.g. lights) with the same string of shift registers.
Leo..

I didn't mean it as a problem, but just as a "now you have a spare output, you can put it to use" by letting it drive the high side :slight_smile:

A little message from Paul__B came in via PM. Don't know why Paul has the bad habit of answering by PM so here is the message (but I'm to lazy to add the quotes back in...). Also, Paul is now enjoying a place on my ignore list and all his PM's to me will be automatically be deleted. :slight_smile:

Paul__B:
Ah! Now that is the critical question! :astonished:

Because ...

That thing is, this is talking about model railway points. The solenoids require a current pulse of between two (Peco) and three (Hornby) Amps to operate. The TPIC6B595 might be useful to drive the 12 V High-side drivers, but nothing else. You would need some serious FETs to do the actual switching and in case the software glitches, it would be best to use a capacitor discharge system in any case.

And yes, it makes much more sense to use a six by six array, not just in terms of cost of components, but practicality of wiring and assembly. There is an excellent argument for using ready-made relay modules (eBay) instead of MOSFETs. In either case, you only need one diode for each switching device, not per solenoid. As I am fond of saying, "lead dress" of the entire layout is absolutely critical if you propose to use a microcontroller.

(And in fact the answer to that critical question was "four to six Ohms". :astonished: )

Alright, in my head a TPIC6B595 could switch more so yeah, it might be a little bit underrated. But 2A is already a lot for most turnout drivers! Drivers from Roco and Fleischmann will stay under that with ease. And luckely, you only need to give a pulse :slight_smile: But yeah, I would search for others. I like to use the IRF7313. Cheap, can switch a decent current and two in a single package but it's SMD.

And you don't save that much with 6x6 which uses 18 transistors where 2x17 just uses 3 transistors more. And the wiring is a heck more clear I would say. Just two common straight/diverging wires for the whole layout and a single wire per turnout. And very easy to expand.

And relays, possible. But it's more clunky and noisy. On the other hand, you would only need a single DTSP relay for it with 2x17.

And how would the single diode work?

Thanks for all your help guys.
It is massively appreciated. :slight_smile:

I’m going to go with the 17x2 array of mosfets. It will be easier to wire and debug.

FYI
These point motors (solenoids) are powered at the moment by a CDU (Capacitor Discharge Unit). This is charged via a voltage booster from 12V line (polyfused) from my power unit (my whole layout is powered from a PSU taken from my last PC. The CDU operates at just over 26V to supply enough ‘kick’.

I’m using IRF360 n-chan and IRF963 p-chan mosfets from rapid online.
I’ve already connected a point motor to one of these mosfets in a test stand. And with a voltage of 5V on the gate not enough current passed to throw the point. So I then connected the gate to an NPN collectored at 12V. Enough current then passed to throw the point.

If I understand correctly I should connect the p-chann mosfets as a low-side switch to the solenoids and the n-channel mosfets to the high side of the solenoids.

Is this correct?

I think that the mosfets I’m using have built-in flyback diodes but I’m not sure from the spec. Can anyone help with verifiying this from the spec below?

please help if possible :slight_smile:

colubridae:
The CDU operates at just over 26V to supply enough ‘kick’.

I know CDU's but how do you get 26V?

colubridae:
And with a voltage of 5V on the gate not enough current passed to throw the point.

They are not logic level mosfets so at a limited gate voltage of 5V they have a limited drain current. Switch to mosfets that can pass enough current at logic level :slight_smile:

colubridae:
If I understand correctly I should connect the p-chann mosfets as a low-side switch to the solenoids and the n-channel mosfets to the high side of the solenoids.

Is this correct?

Exactly the other way around :smiley: N for low, P for high.

And like I said, you need a voltage close to the supply voltage to turn the P-channels off which an Arduino can't directly do if that's 26V. Easiest way is to pull the gate of the P-channel high via a resistor and pull it low via a simple NPN transistor (may also be a mosfet but are more expensive).

colubridae:
I think that the mosfets I’m using have built-in flyback diodes but I’m not sure from the spec.

No they don't, they have a body diode. A flyback diode goes across the solenoid.

26volt is too high for the gate of the P-channel fet.
See diagram 4 on this page.
https://www.gammon.com.au/motors
Leo..

Depends on the mosfet :wink: But generally, yes. But because we don't need high speed, I would just go for a resistor divider :slight_smile:

I was referring to the mosfet links in post#13
Leo..

Thanks again all
:slight_smile:

for septillion:-

I get 24V on the CDU from a voltage booster on a dedicated 12v line from my PC PSU.

(using an old PC PSU gives me separate lines for the different components - I know they are sourced together inside the PSU but it makes the unit separation much easier under the baseboards, plus all the grounds are connected).

Thanks for the n-chann/p-chann hi/low spotting.
As I said I’ve rigged this up on a test stand powered from the layout supplies and it works as a manual switch. It’s just the arduino connections now.

I’m still working on the arduino code and circuitry

I’ve got the inputs board ready (using HC165s) and the coding for obtaining the switch states.
I will let you know how things progress, if you are interested.

Regards TJ

:slight_smile:

I forgot to mention this explicitly, and I didn't see anyone else mention it, so here it goes.

The pin-saving feature of a matrix arrangement comes at a downside, which is that you can only have one column or row of devices active at a time.

For keypads and displays this isn't a problem. Human fingers are glacially slow compared to the rate a microcontroller can scan a keypad, and our eyes average out the flicker of a multiplexed display to provide the brain a consistent image.

If you only need to energize 1 solenoid at a time for a brief moment to move something, there won't be any problem. But if you need an arbitrary arrangement of multiple solenoids to be held energized at the same time, a matrix arrangement like this is much more difficult to work with.