Easiest way to control 25 small solenoids with an Arduino?

As a total beginner who never worked with an Arduino before I want to control 25 tiny solenoids like https://www.aliexpress.com/item/33046259459.html with an arduino. Simple stuff, just turning them on/off individually. The solution should be space efficient if possible.

The solenoids linked above run with DC 3V 100mA 0,15W but I might have to use solenoids with DC12V 120mA 1,5W instead.

Can you think of any board/shield combination that allows me to just plug in my solenoids? If I have to build a custom solution how should I tackle it? Do you have any guides on the topic I should read through?

Use 4 TPIC6B595 shift registers. Outputs are open-drain, rated for 50V and can sink 150mA.
Or use N-channel MOSFETs of you think you might use solenoids that need more current.
I offer boards that support either one.
http://www.crossroadsfencing.com/BobuinoRev17/

Board with 12 x TPIC6B595 for up to 96 outputs. You'll need to add diodes across the solenoid coils.

Board with 32 x 1A (or more) N-channel MOSFETs. Has a diode across each output.

If you have 25 free pins on your Arduino (Mega?) a transistor, a diode and 1-2 resistors per solenoid will do that.

Or use port extenders like TPIC6B595 with 8 output pins supporting 150mA each at up to 50V. Look for common 74595 shift register applications for code and wiring.

Remember that 25*120mA sums up to 3A current from your power supply!

DrDiettrich:
Remember that 25*120mA sums up to 3A current from your power supply!

Maybe not. The coil resistance for those smaller solenoids is 27R, so the 100mA (actually 111mA) is the current at the moment the coil is energised. It will soon drop to maybe 20~30% of that. If you can stagger the energising of the coils, in your sketch, even by a quarter of a second, you can avoid all 25 solenoids pulling 111mA at the same time and use a much smaller supply.

CrossRoads:
Use 4 TPIC6B595 shift registers. Outputs are open-drain, rated for 50V and can sink 150mA.

DrDiettrich:
Or use port extenders like TPIC6B595 with 8 output pins supporting 150mA each at up to 50V. Look for common 74595 shift register applications for code and wiring.

Thanks a lot for the quick replies! The TPIC6B595 looks very promising with the open-drain outputs.

PaulRB:
Maybe not. The coil resistance for those smaller solenoids is 27R, so the 100mA (actually 111mA) is the current at the moment the coil is energised. It will soon drop to maybe 20~30% of that. If you can stagger the energising of the coils, in your sketch, even by a quarter of a second, you can avoid all 25 solenoids pulling 111mA at the same time and use a much smaller supply.

Thanks for the info! The coils will press/release the keys of a self playing piano (sort of). Only half the keys will be pressed at the same time at max.

I have the board (probably Arduino MKR WiFi), the solenoids, the shift registers and the fly back diodes. That's it pretty much.

What power supply setup (battery powered) would you recommend for all of this? Will I need 2 batteries anyway, 3,7V for the board and 3-12V for the solenoids?

2 batteries might be a good idea. In theory, you can run both the Arduino and probably the solenoids with 3.7V. But activating the solenoids could cause voltage variations which might crash the Arduino, so separate battery for that would be more reliable, I suspect. Common ground, of course!

You need to think how long you need the circuit to run on battery power. An 18650 size battery would probably run the Arduino for several hours, even with the WiFi running. The solenoids might need more than one 18650 battery to last long enough for your needs.

PaulRB:
Maybe not. The coil resistance for those smaller solenoids is 27R, so the 100mA (actually 111mA) is the current at the moment the coil is energised. It will soon drop to maybe 20~30% of that. If you can stagger the energising of the coils, in your sketch, even by a quarter of a second, you can avoid all 25 solenoids pulling 111mA at the same time and use a much smaller supply.

In addition, tell us the length of time each solenoid may be turned on over a minutes time. You will also have heat dissipation to take care of.

Paul

PaulRB:
The coil resistance for those smaller solenoids is 27R, so the 100mA (actually 111mA) is the current at the moment the coil is energised. It will soon drop to maybe 20~30% of that.

AFAIK solenoid current increases after activation. Do you confuse it with light bulbs?

Paul_KD7HB:
In addition, tell us the length of time each solenoid may be turned on over a minutes time. You will also have heat dissipation to take care of.

Paul

No single solenoid will be activated for more than a couple of seconds at a time, but it might be reactived pretty soon (some notes in a song could be almost always pressed, e.g. counterpoint) and the wohle apparatus should play for minutes.

So let's assume continuous activation. I don't need the solenoids to do a lot of work, they should move approximatley 20g of plastic 5cm (Likely less, I don't have the mechanical model yet).

I also hope to stack them very tightly together, 8mm per solenoid in width would be optimal. I need to find and operate solenoids that will produce this force continuously without overheating. I could build custom solenoids/coils if necessary, but of course prebuilt would be a lot less work.

What do you think?

DrDiettrich:
AFAIK solenoid current increases after activation. Do you confuse it with light bulbs?

Hmm.. no, but maybe with motors!

I didn't want to annoy you with unnessecary information, but here we go:

So I want to modify this lego model Grand Piano 21323 | Ideas | Buy online at . The existing self-playing mechanism only plays a couple of notes in a fixed loop. This is impressive for a lego model. But maybe it can be improved further:)

This is the existing mechanism, controlled by a camshaft:

Each solenoid needs to be strong enough to lift one of the key mechanisms:

Ideally everything should fit in the body. Although I can build a larger one, after all it's just Lego :slight_smile:

I think you need solenoids, not air valves like the ones you pasted a web page address for above.

Fat solenoids can be mounted in two or more rows with ropes or pins lifting the hammers.

PaulRB:
I think you need solenoids, not air valves like the ones you pasted a web page address for above.

Are you sure these are not just small push-solenoids? I was hoping they would behave like the one shown in this youtube video:

Edit: Wrong screenshot, changed it now to the "normally open valve"

DrDiettrich:
Fat solenoids can be mounted in two or more rows with ropes or pins lifting the hammers.

Ropes are a really good idea! Width is not a problem then :slight_smile:

kinkelin:
No single solenoid will be activated for more than a couple of seconds at a time, but it might be reactived pretty soon (some notes in a song could be almost always pressed, e.g. counterpoint) and the wohle apparatus should play for minutes.

So let's assume continuous activation. I don't need the solenoids to do a lot of work, they should move approximatley 20g of plastic 5cm (Likely less, I don't have the mechanical model yet).

I also hope to stack them very tightly together, 8mm per solenoid in width would be optimal. I need to find and operate solenoids that will produce this force continuously without overheating. I could build custom solenoids/coils if necessary, but of course prebuilt would be a lot less work.

What do you think?

I think you have a lot more testing to do before you make the final design.

Paul

An idea to think about/experiment with that might solve your space issues.

Glue a small neodymium disc magnet under each key, where the cam protrusions lift them currently (I assume this is under the red coloured part of each key seen on the pictures you attached?)

Place a small electromagnet under each key. When energised with the correct polarity, this should repel the disc magnet, pushing the key upwards.

I'm not sure, but it might be possible to use inductors of some sort as the electromagnets.

Or maybe make a line of iron nails in a strip of plywood or something that can be laid under the keys with a nail pointing up at the disc magnets under each key. Wind a small coil around each nail to make them electromagnets.

You should spend some time testing and experimenting, because without a moving core like a solenoid, the field produced by the electromagnets may need to be quite strong to repel the magnets sufficiently, and may also repel the discs on the adjacent keys.