Go Down

### Topic: Solenoid matrix control circuit (Read 2189 times)previous topic - next topic

#### zikko

##### Jan 20, 2013, 11:45 pm
Hi!

I've got an idea that involves a whole bunch of solenoids, I was thinking 200 of them, set up in a 10x20 matrix, each one making up a "pixel". Now I'm still learning electronics, but I've tried to do my homework before posting as best as I could and I'll try to make my questions specific. That being said, bare with me if I'm coming across newbie, ok?

Now, I looked into how solenoid actuators work and it seems that they are usually pulled/pushed back into their "off" position by a spring, so they need to be energised for as long as they are to be in one of their possible two states. And solenoids that can be on for long periods of time are usually big and more expensive. For my setup, the solenoids need to be able to remain in either state for any amount of time, so I thought that the whole spring mechanism only seemed to complicate things and waste energy.

Then I read about "latched" solenoids that are springless and remain in position by a permanent magnet mechanism, but really I don't think I even need that. If I rig up the matrix standing so that each solenoid is horizontal, they won't have to hold against even gravity once moved into either state, right? They'd be held in place by mere friction.

So, in that case my solenoids could just be a coil and a plunger, I thought. They wouldn't have to apply very much force when energized either. Just a square piece of styrofoam, painted or paper-sheeted, say 10x10 cm, attached directly to the plunger would do. So just enough force to move the plunger with styrofoam on it 3-5 cm would be enough, haven't calculated it in newtons but you get the idea? Is that a long stroke for a solenoid given that it's springless?

Now, I realize that to move a solenoid from one state to the other and then back again, I would need to reverse polarity on the coil, or have two coils for each solenoid with different polarities. I found that a H-Bridge Motor Driver like L293D or SN754410 (https://www.sparkfun.com/products/315) could be used to reverse polarity. Those could in fact control two solenoids each. And if I understand it correctly, I wouldn't have to use any other transistor to do the current switching either. Am I wrong here? Is this IC unsuitable for any other reason? I guess it would depend on the current needed, I'll come back to a question on that.

I'd need two pins for each solenoid, so we're talking 400 pins here. 400/8=50 shift registers with 8 bits each. Could I pull that off on an Arduino Uno? How many of those can be chained really? Maybe the clock pins could all be connected to the same Arduino output pin? 5 chains with 10 shift registers each?

Time delay due to lots of shift registers wouldn't be a big issue as I see it. I would want to update the matrix at some not-so-tight time interval. Every solenoid would seldom have to change state every update, but the ones that change should all do it at the same time. So between updates, I'd switch off the enable pins on all H-bridges, take whatever time needed to shift in the control bits for the next update, then enable all at once for as long as the solenoids need to change state, then turn off all enable pins, and so on. If I connect 200 enable pins to a single Arduino output pin like that, would that require a transistor?

Now as for the solenoids: I haven't done much in-depth research on coil construction (sorry) but I've seen plenty of YouTube examples that it can be done. Given the parameters given before, what wire dimension, number of turns, and plunger would you recommend for a DIY solenoid here? Are we talking 10 turns, 100, 500? I have pictured a coil would around a piece of drinking straw with a thin iron nail inside, but maybe it's not that easy even with these low demands? I also don't quite understand how to think of current and resistance when it comes to coils, generally. It's DC, so a coil is pretty much a short circuit, right? Does that mean the current will be through the roof? Should there be a resistor involved? The H-bridges mentioned are for 1A max, but there might be sturdier ones.

My apologies for the wide questions in that last bit, but most tutorials don't go into the details, and are for single coils with higher demand parameters.

Are there things I haven't thought of here, or more parameters needed to answer my questions?

All constructive feedback is most welcome.

Erik
---
Check out my microblog on Twitter: @zikko_invents

#### Grumpy_Mike

#1
##### Jan 20, 2013, 11:59 pm
Quote
Are there things I haven't thought of here

Quote
Are we talking 10 turns, 100, 500?

Depends on the physical force but normally over 1000 turns.

Quote
If I connect 200 enable pins to a single Arduino output pin like that, would that require a transistor?

Yes, in fact several. You could use 74LS04 buffers and drive 20 shift registers with each one. There are six in a package.

Quote
I found that a H-Bridge Motor Driver like L293D or SN754410 (https://www.sparkfun.com/products/315) could be used to reverse polarity. Those could in fact control two solenoids each. And if I understand it correctly, I wouldn't have to use any other transistor to do the current switching either. Am I wrong here? Is this IC unsuitable for any other reason?

Yes this is a suitable way of doing things.

Quote
It's DC, so a coil is pretty much a short circuit, right?

No wire, especially thin wire, has a significant resistance when you have 1000 turns.
Quote
Should there be a resistor involved

No.

Quote
The H-bridges mentioned are for 1A max, but there might be sturdier ones.

Yes but they cost more.
Multiplying things by 200 gets expensive.

#### PeterH

#2
##### Jan 21, 2013, 01:11 amLast Edit: Jan 29, 2013, 11:53 pm by PeterH Reason: 1
I don't think you need 200 drivers. It doesn't sound as if you will need to power multiple solenoids simultaneously so you could multiplex then in a matrix. A 14x15 matrix would be enough to support 200 outputs.

That's still enough I/O channels to get expensive if you tried to use commercial motor drivers, but perhaps feasible if you just made up your own H-bridge  circuit to drive an output high or low and then control those from shift registers.

Before you get too far into the electronic side I suggest you have a play with the sort of solenoid you have in mind to see whether it's practical to make something that can produce the force and displacement you need, and start getting a handle on the time and money it'd need to make 200 of them, and the power requirements.
I only provide help via the forum - please do not contact me for private consultancy.

#### Docedison

#3
##### Jan 21, 2013, 03:34 am
Very likely the 'Throw' is going to complicate things, I read 'somewhere' that a solenoid shuttle (the moving piece) has to be 50 percent longer than it's 'throw' or one half of the shuttle must be in the "Magnetic" circuit to work. I think that 'Latching Solenoids' are going to be a must, that or gravity and to get the displacement to raise or drop the 'pixel' you specify, Have you considered a simple lever @ 1/4 amp/solenoid is 50A total and although you may never (hopefuly) have that condition occur the capacity must be there. (it is an effective and important part of back EMF control.) The lever concept and semaphores (as hinged flags) might simplify what appears to be a mechanically challenging task. IMO the control is trivial.

Bob
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

#### Krodal

#4
##### Jan 21, 2013, 10:38 amLast Edit: Jan 21, 2013, 10:45 am by Krodal Reason: 1
The most important thing is to buy and make and try a number of solenoids.

The metal moving core in a solenoid is not a magnet, so reversing the polarity won't change anything. The metal core will move in the same direction.

Chaining all shift registers is not a problem. I think that the total delay will be unnoticable. Making a circuit with all those shift registers and wires is a problem. You could make modules which drive 10 (or 8 or 16) solenoids each. And with a serial bus (for example I2C) to control the modules.

To move a large number of solenoids at once, you need a lot of power. A computer power supply could be used for that if you need +5V or +12V. They are normally 'off', but with the sense wire connected, you can switch them 'on'.

What about using servos ? They could be a little more expensive, but they are in the same price range. 200 servos at 5V with a computer power supply could be done.
To control 200 servos, you need controllable servo hardware drivers, or a number of Arduinos communicating with each other (for example via the serial bus).
The Arduino Mega can control up to 48 servos. So a few Arduino Megas is all you need.
http://arduino.cc/en/Reference/Servo

#### zikko

#5
##### Jan 29, 2013, 11:49 pm
Hello again!

Thanks a lot for your replies and feedback!

Quote

Doesn't have to be battery or computer power source, just a net adapter. Voltage would depend on what's needed to accomplish the task, I thought, but as I've seen 5V solenoids I don't know what would require me to go higher than that - but I'm sure there could be factors, please notify me if you can see any.

Quote
Depends on the physical force but normally over 1000 turns.

Yipes, having to wind 1000 turns would probably throw me off creating these myself.

Quote
Yes, in fact several [transistors]. You could use 74LS04 buffers and drive 20 shift registers with each one. There are six in a package.

Since it's just a logic signal where all 200 connections would be either high or low, why would I need shift registers for that? And what would happen if I tried to connect 200 enable pins directly to an Arduino pin? Would I get an over current condition or would the signal jus be too faint when spread out over 200 end points?

Quote
No wire, especially thin wire, has a significant resistance when you have 1000 turns.

Ok that makes sense! But consider this test I made:
I took an iron nail about 70mm long, put it in a thin plastic tube cut about the same length, then wound copper wire, about 1.2mm thick, just 20 turns around the tube from end to end. When I pulled the nail out a bit and connected the wires to a 1.5V battery, the nail was sucked back into the tube no problem. I could pull it out as far as two thirds of its length and it would still go back in in about a second. Not much force to spare I'm sure, but I don't need much more than that for my purposes. The wire and battery got hot quite fast if I kept them connected of course, but they would only energize for less than a second at a time with plenty of time to cool off between times.

So, what are the reasons a super simple coil like this wouldn't work? I mean I'm sure there are many but I want to understand it better.

The resistance in this case is clearly pretty much zero, so there would be a rush of current I guess, instantly cooking any transistors or other components involved? Couldn't they be protected in a smart way though? 200 relays, or can it be made easier, and cheaper? Or would I overheat my power source if I energized 20, 50 or 100 of these at once? How could that be prevented?

Lots of stupid questions there I'm sure, and you could of course refer me to chapter one of the book of electricity, but I learn these things much better when putting it into a context like this, so please bare with me.

Of course, I could wind the coils more than 20 turns and use thinner wire, I just used my test as an extreme example.

But if nothing else, this test gave me hope of being able to construct solenoids that run on as little as 1.5V!

Quote
I don't think you need 200 drivers. It doesn't sound as if you will need to power multiple solenoids solenoids simultaneously so you could multiplex then in a matrix. A 14x15 matrix would be enough to support 200 outputs.

Oh, interesting! I looked at a couple of examples of multiplexing for LED matrixes. But are you suggesting putting a motor driver before the multiplexing bit and then multiplex that driving current coming out of it? Seems like it would require some very sturdy shift registers for sourcing/sinking current? Also, do you think alternating between energizing all these different solenoids very fast would energize them enough to pull the plungers?

Quote
Have you considered a simple lever @ 1/4 amp/solenoid is 50A total

Yeah, that's a lot of current. I guess what I'm hoping for here is to find a way to design the solenoids so they don't require so much current, since they don't need to be very strong.

Quote
The lever concept and semaphores (as hinged flags) might simplify what appears to be a mechanically challenging task.

Quote
What about using servos ? They could be a little more expensive, but they are in the same price range. 200 servos at 5V with a computer power supply could be done.

I guess it's one way to go, I just liked the idea of making the actuators myself if the low requirements made it possible and practical. But using servos or even DC motors is not completely out of the question if it would offer a great advantage.

Quote
The Arduino Mega can control up to 48 servos. So a few Arduino Megas is all you need.

Oh, that's all? :-) Seems like a hell of a lot of hardware for a thing like this, doesn't it?

Quote
The metal moving core in a solenoid is not a magnet, so reversing the polarity won't change anything. The metal core will move in the same direction.

Now, THAT'S good input, thanks for pointing that out. Makes perfect sense, should've seen it myself. Guess I just misunderstood what role the permanent magnet played in a latching solenoid.

So, as a consequence of that, I'm now thinking more in the lines of two separate coils per solenoid, wound over slightly different segments of the tube but overlapping for the most part. Each coil would pull the plunger into the centre of that coil when energized, right? So I'd use one for pull and one for push.

And I would not need any IC's for switching polarity, but instead I would need twice as many transistors or something for switching the current, unless there some better way. Maybe there are three-way transistors, that can either connect a circuit this way, that way, or disconnect it. I'll have to do a little more research there.

And, as several of you have suggested, I'll do some tests and measurements before buying 200 of anything here. Good advice.

Thank you again for all your good input, and keep it coming!

Best regards,
Erik
---
Check out my microblog on Twitter: @zikko_invents

#### PeterH

#6
##### Jan 30, 2013, 12:02 am

Oh, interesting! I looked at a couple of examples of multiplexing for LED matrixes. But are you suggesting putting a motor driver before the multiplexing bit and then multiplex that driving current coming out of it? Seems like it would require some very sturdy shift registers for sourcing/sinking current? Also, do you think alternating between energizing all these different solenoids very fast would energize them enough to pull the plungers?

There is a difference between multiplexing (i.e. sending many signals down one conductor, for example using a shift register) and using a matrix.

I'm suggesting that you arrange your solenoids in a 14x15 matrix. That is, a grid with 14 columns and 15 rows (or vice versa) with each solenoid at the junction of a row and a column. Each row and column would be driven by an H-bridge driver (so that's 29 H-bridge drivers total). You would activate a single solenoid by powering the corresponding row and column. The 29 H-bridge drivers will probably need at least a couple of pins each so rather too many to control directly from an Arduino, but you could easily control that many via shift registers.

In this approach you would be limited to moving one solenoid at a time, but if each one moves fairly quickly then you could soon ripple a change across the whole display. Moving the solenoids individually also reduces your power supply requirements by a factor of a couple of hundred, which has got to be a good thing.
I only provide help via the forum - please do not contact me for private consultancy.

#### Grumpy_Mike

#7
##### Jan 30, 2013, 05:22 am
Quote
I took an iron nail about 70mm long, put it in a thin plastic tube cut about the same length, then wound copper wire, about 1.2mm thick, just 20 turns around the tube from end to end. When I pulled the nail out a bit and connected the wires to a 1.5V battery, the nail was sucked back into the tube no problem. I could pull it out as far as two thirds of its length and it would still go back in in about a second. Not much force to spare I'm sure, but I don't need much more than that for my purposes. The wire and battery got hot quite fast if I kept them connected of course, but they would only energize for less than a second at a time with plenty of time to cool off between times.

So you see that few turns take a lot of current. If you push enough current round a coil you can get as much magnetic force as you want. However the more turns the less current for the same force. Your battery was getting hot, that is because it has an internal impedance and that was limiting the current more than the resistance of the wire. You will also find that batteries do not last very long given that sort of abuse. It is the current requirement of your power supply I was referring to not the voltage.

Go Up

Please enter a valid email to subscribe