Single power supply for Arduino, electromagnet and linear actuator (12V)

Hi,

I’m hoping to create a setup with my Arduino where I use it to control a rectangular electromagnet, a linear actuator (and I will be adding a bluetooth module as well). The electromagnet and linear actuator are 12V parts, so what would I need to buy in order to have a single power supply that powers everything? I’d like the whole setup to be portable with a rechargeable battery, though as a last resort it may be connected to a power outlet as well. The linear actuator doesn’t require controllable speeds but does require it to be at the right positions in between the range of movement.

The linear actuator I’m thinking of getting is (is it the right one to buy in order to be able to control the positions? 2" stroke length is all I need):

The electromagnet I’m thinking of getting is (my preference is that it is rectangular):

Any help would be much appreciated.

Regards,
Lok Sang

Hi Lok,

Welcome to the forum, thanks for posting!

I’d recommend looking into a Sealed Lead Acid Battery or SLAB, that’ll kick out more than enough current and sit at the appropriate voltage level:

I’d suggest asking at your local Jaycar what capacity and charging pair they’d recommend for your set up, based on weight, size, and battery-life requirements.

You’ll want a fairly high-powered shield to deliver enough current to both the electromagnet and the linear actuator, something similar to the M2S24v14 ought to do the trick although smaller less expensive motor drivers that have slightly different form factors and modes of operation could certainly work as well, just ensure they have excess max-current capabilities compared to the maximum draw of your gear.

I’m suggesting this as it is just a simple, neat option and has the ability to back power your Ardunio off of the battery by closing an optional pin that is initially open, at least on the older models:

(This is the closest that is currently in stock)

3 Likes

Thank you, I just ordered it (the Motor Shield)!

I also ended up getting the linear actuator with feedback as I need to control the positions of the actuator.

1 Like

How would I reverse the polarity of the linear actuator and electromagnet programmatically? Both elements can be reversed at the same time so would I be able to get away with a single 2 channel relay module?

1 Like

Hi LokSang

To reverse the polarity with a relay you would need a DPDT relay or possible 2 SPDT relays operating together. Total 2 DPDT or 4 SPDT.
Cheers Bob
PS. I have not looked but I would be surprised if that motor control board you linked did not look after the reverse switching for you.

2 Likes

Hi Bob,

Yes it appears there is a forward/reverse feature on that board, thanks very much.

Regards,
Lok Sang

1 Like

You can see here too: Arduino Linear Actuator Position Control // Linear Actuator with Position Feedback Return to Center - YouTube

2 Likes

Thank you Rooppoor, that’ll become really handy later!

1 Like

Hi Lok,

From the sounds of the above, you need a potentiometer for your Arduino to read the position of the shaft, otherwise it won’t be able to seek to a specific position! These are listed on our site as “with Feedback” as shown below.

If you need us to swap this out of your order (i.e. you ordered one without feedback and believe you need it), reach out ASAP by replying to your order email. If it’s already gone out we’ll let you know and you can perform a change-of-mind return.

-James

Hi James,

I actually did order one with feedback (this is my order: “1 x POLOLU-2317 - Glideforce LACT2P-12V-05 Light-Duty Linear Actuator with Feedback: 15kgf, 2" Stroke (1.97" Usable), 1.7"/s, 12V (1 require a lead time)”), though I realise that the product that I quoted in the original message did not have feedback.

Thanks.

Regards,
Lok Sang

1 Like

Hi Lok,

Excellent, just saw the one you linked and panicked! I’d hate for a small difference like that to trip up your cool project :slight_smile:

-James

I was able to set up my linear actuator and electromagnet with the Motoron M2S24v16, and it’s working fine with the USB cable plugged in, but the moment I use the ‘optional pin’ connecting AVIN and VIN on the Motoron (taking away the USB power but providing power with a 12V SLA battery), it errors out with the red LED showing.

Any idea on what could be causing this? Could it have something to do with the battery not providing enough current to the motor controller shield, or something else? It’s hard to debug this via the Arduino software as it works fine when connected to the computer but does not work when connected only to the SLA battery.

Hi LokSang
There is something wrong with your battery connection. What flavour of Arduino are you using and exactly how is everything connected together. A drawing or sketch would be useful as any diagnostic information would be only guessing with the info you have provided.
Cheers Bob



Here are some photos and a sketch

Thank you!
Lok Sang

I’m using the Arduino UNO R3. Thanks Bob!

Lok Sang

Hi LocSang
The sketch is a bit hard to read with that reproduction but I think I can make it out.
Check that that motor driver is suitable for that Uno R3. The pins don’t seem to add up.
The R3 has in order 3.3V, 5V, Gnd, Gnd, Vin,
The motor driver has 3.3V, 5V, VM, Gnd, AVin.
Now if that VM means Motor Voltage you are shorting the motor volts to ground via the Arduino ground pin. You will have to recheck the suitability thoroughly before you go any further in case you do some damage. Possibly damage has been done.

Perhaps one of the Core support staff can jump in here as I am not familiar with that motor controller.
Core please look at this as it could be a grave error if this board is meant to sit on any Arduino. These pins in that order are on all Arduino of that format I think. There again I might be altogether wrong here.
Cheers Bob

Hi,

I should have included this here, but the pinout diagrams are as linked below:

I think you’re looking at the second row of the board which does not exist on the Arduino. The row connecting to the Arduino remains the same on the Motoron board, as far as I can tell.

I’ll try and produce a better sketch.

Regards,
Lok Sang

See that now. I was only going on the pics of the boards.
Cheers Bob
Add.
Sorry I did not go further than the pics. I assumed (wrongly) that the board connections connected across, silly me for thinking they might. I did not look in enough detail as I have no immediate intention of using this board.

Here is a computer sketch of the wiring setup:

Do you think it’s safe for me to plug in the USB while connecting AVIN to VIN? That way I can see what the error is. There is a warning on the website:
“To avoid shorting two power outputs together, do not connect anything to the Arduino’s DC power jack while supplying power to AVIN through the Motoron.”

But I don’t know if that applies to the USB port as well.

Lok Sang

No problem, Bob, thanks for your input anyhow.