Electronic – How to individually control electromagnets in a 16×16 matrix

electromagnetmatrixmultiplexer

I'm looking to be able to individually control each electromagnet in a 16×16 matrix. It's also important to note that I want to control these via an Arduino and maybe eventually a Raspberry pi – depending on the future requirements and environment I want to work in with my project. Both however, limit me pin wise.

To get around my lack of infinite pins, I was looking into multiplexing, but I'm not sure how I'd go about it completely for 16 columns and 16 rows. However, I'm also honestly not 100% sure that multiplexing with electromagnets is an ideal solution because I'm not sure how much that will effect how strong the magnet works, due to it turning off and on repeatedly. I'd assume I might only get ~6.25% potential output from the electromagnets due to multiplexing, but that's assuming electromagnets work well in a multiplexing environment – for all I know they need some "warm up" time – but again, I'm not a real electrical engineer lol. I imagine since electricity is flowing through the electromagnet I should expect the electromagnet to turn on/off almost as instantly as an LED.

The electromagnets I have on hand are ZYE1-P20/15's. 12V DC, 3W, 0.25A.

So, if you think multiplexing might work, could I get any good recommendations on what driver I could use to multiplex for a 16×16 matrix? Any tips and advice would also be welcome.

If you don't think multiplexing is a good idea, what other options are there?

Best Answer

You have two options. Power multiplexing - where you have an array of magnets and you pulse the power into them, or Control multiplexing - where you have an array of magnet driver devices, and you distribute the logic level control to them.

Power Multiplexing

It is theoretically possible to do power multiplexing with electromagnets. If you supply one electromagnet with 16x the rated voltage for 1/16th of the total time, and provide a free-wheel path round it with a diode, it will operate at more or less the same current as giving it the rated voltage for the whole time.

A 16x16 array can therefore be multiplexed driving a whole row at a time, each column for 1/16th of the time, with the PSU supplying 16x the voltage and 16x the current as for a single magnet.

That makes a number of assumptions about the magnets (a) the insulation will take the extra voltage (b) you are multiplexing fast enough to get a current smooth enough for your application.

The magnets will not turn on and off as fast as a LED, if fact your 'warm-up time' is closer to the mark. While the voltage is on, the current in the coil will increase rapidly. While the other columns are being driven, current continues to flow through the free-wheel diode, decaying slowly due to the voltage drop in diode and the coil resistance. The time taken to bring the current up, and to decay away, depends on the supply voltage, the inductance, and the resistance of the coils.

A big argument against multiplexing 16x the voltage to an array is what happens if when the software crashes and a column of magnets receives a continuous 16x voltage supply. Fuses or current limiting is needed, and/or a multiplex failure shutdown of the supply.

As you say in your OP that you are at best dangerous, building a 4A 192v system with some built-in failure modes is probably not the best way to go.

Control Multiplexing

The alternative control multiplexing would be far safer. The standard way that people expand their arduino or pi outputs is to use a string of HC595s, in your case 32, as they have 8 outputs each. They require 3 pins from the MCU to drive them, clock, data and a strobe. You can get standard software libraries for pi and 'duino that will handle this array for you.

One option for magnet driving is to use the ULN2803, an 8 channel darlington driver, capable of 30v and 500mA per channel, with built-in kickback diodes. However, package dissipation would limit each one to driving only four channels at the same time, so it's not necessarily a good choice.

If you use FETs for driving, and want to connect them directly to the 595 outputs, then make sure that they are 'logic level' input types. This means not only Vgsth << 5v, but also an RDSon specified at Vgs of 5v or less.

A large series gate resistor should slow down the turn-off transient through the Miller effect sufficiently to avoid the need for a kickback diode (as long as you do the calculations and measurement) though such diodes are only pennies, so would be sensible to include anyway.

While buying 256 single FETs seems like a lot, you'd get quantity pricing, and you already have 256 magnets, so are handling the scale somehow. You might want to design an interface board that handles (say) 2x HC595 and 16x FETs, gate resistors and kickback diodes, as a module, to simplify your integration and wiring. I usually use DirtyPCB for things like this, but plenty of other cheap, online, PCB suppliers are available. Having multiple small boards eases things like power distribution (a 4A wire to each board), and repairs (build a few extra boards, and swap one if needed), and bringup (just build one board, get it working, add another, rinse and repeat).