Powering 12V maglock over ethernet

I'm using ethernet cable to set up Gammon's rs485 network. My plan was originally to use one twisted pair for the A/B line and another pair for ground. Then I decided to try and send power to the Arduino over another twisted pair, which I think will work, based on what I've read so far.

I have one pair left, and I'm wondering if I'm really pushing it by trying to send power to a maglock, via a relay on the receiving end. I'll be using a flyback diode over the magnet.

It would just make my life easier if I could have a single ethernet cable going into my enclosure, but I'm wondering if the small wire would pose a problem (23 gauge). Or if 12V transmission alongside my rs485 communication will have any screwy effects.

Come to think of it, could I just dedicate 2 twisted pairs to the 12V power and power the Arduino from the same supply? I've always been nervous about the Arduino being powered from the same supply as a magnet, but again, the magnet will have have a flyback diode in place.

Thanks in advance for any advice.

Bump. (sorry)

Happy Thanksgiving, everyone.

No answers usually means one of two things:

  1. we don't know the answer to your problem.
  2. we have no clue wtf you're actually trying to do as you're just rambling on about seemingly unrelated stuff without showing images, schematic diagrams, code, explanations of the complete project or results of what you tried and what worked or didn't work.
    By the way, I know this is a great forum and the regulars are awesome and highly knowledgeable and fantastic when it comes to giving fast and insightful reples, but bumping after a mere 10 1/2 hours is not the best way of getting the attention you want.

I have one pair left, and I'm wondering if I'm really pushing it by trying to send power to a maglock, via a relay on the receiving end. I'll be using a flyback diode over the magnet.

Try it, what have you got to lose? A lot of my successes have resulted from trying stuff that might or might not have worked, or that I had been told won't work. A lot of failures too... Always learnt from each success or failure.

How long is the cable?

If you have problems you could try using a higher voltage power supply and a buck converter next to the maglock. Doing so would reduce the current in the cable and the buck converter would act as a barrier to nasties from the maglock getting into the cable.

As wvmarle says, don't bump posts, especially after such a short time. I saw this last night, it was late, I was tired, I thought someone would have a better answer than mine. This is an international forum, the person who has the answer you are looking for might be fast asleep on the other side of the planet to you when you post.

You are right in that the solenoid current passing in the same cable may cause problems.

The problem will be when the solenoid switches. You must ensure the switching transients do not propagate along the cable. This means you have to have a hefty electrolytic capacitor, say 1 mF - and for good measure, a ceramic 0.47µF - across the 12 V power connections adjacent to the switching FET and the "kickback" diode.

(I have not set them up yet with Arduino controllers, but I have provided a separate 12 V supply to the locks using household mains cable. :grinning: )

PerryBebbington:
Try it, what have you got to lose? A lot of my successes have resulted from trying stuff that might or might not have worked, or that I had been told won't work. A lot of failures too... Always learnt from each success or failure.

I guess my worry is that it will "work," for a while maybe, but would maybe burn out on me or introduce problems down the road. I'm struggling to determine what wire gauge is needed/recommended. The current draw is for one of these magnets is supposedly between 0.11A - 0.15A. It seems like 23 gauge (or two strands of 23 gauge) ought to be sufficient, but elsewhere I am seeing 14 or 16 gauge wire recommended. Is there a good rule of thumb out there?

PerryBebbington:
How long is the cable?

TBD, but aiming for less than 20 feet.

Paul__B:
You are right in that the solenoid current passing in the same cable may cause problems.

The problem will be when the solenoid switches. You must ensure the switching transients do not propagate along the cable. This means you have to have a hefty electrolytic capacitor, say 1 mF - and for good measure, a ceramic 0.47µF - across the 12 V power connections adjacent to the switching FET and the "kickback" diode.

Ideally, the switch would only happen once, when they solve the puzzle and the drawer opens (escape room application). I've only ever used relays to switch power to solenoids, just because I haven't felt super confident with my electronics knowledge and relays seem so simple and easy. Could you recommend a size/type of FET? It'd be nice to get rid of all the clicking noises :). And when you say adjacent, do you just mean across the magnet leads?

Sincere apologies for the bump. My post was towards the bottom of page 2, and page 3 tends to be a graveyard.

Paul__B:
(I have not set them up yet with Arduino controllers, but I have provided a separate 12 V supply to the locks using household mains cable. :grinning: )

Just the cable or was it still carrying 220V AC as well?

Bapstack:
Is there a good rule of thumb out there?

No need. You can calculate this.

A 5, 10 second Google search tells me 23 AWG has a resistance of just over 20Ω/1000 ft. Your 20 ft distance is 40 ft round trip, about 0.8Ω resistance. At 110-150 mA that means you can expect a 0.09-0.12V drop over the wire. If you think that's acceptable, no problem. If you think that's unacceptably high, go for thicker wire.

wvmarle:
A 5, 10 second Google search tells me 23 AWG has a resistance of just over 20Ω/1000 ft. Your 20 ft distance is 40 ft round trip, about 0.8Ω resistance. At 110-150 mA that means you can expect a 0.09-0.12V drop over the wire. If you think that's acceptable, no problem. If you think that's unacceptably high, go for thicker wire.

Okay thanks. I had previously determined the voltage drop and do believe that will be acceptable. I think I just had some vague notion that the load from the magnet could damage the wire if it was too small.

If it's too small most likely your magnet will stop working before the wires are damaged at these currents.

Do place your flyback diodes right at the coil, not the other end of the wire. You don't want those current spikes to radiate out - that wire is one big antenna!

Several things I’d be reading and thinking about...
1 - POE: Power Over Ethernet (there are standards)
2 - Adding a decent electrolytic capacitor at the remote end, to absorb the pull-in current.
3 - Using 100% PWM to pull in, then ‘relax’ the holding drive to the mag lock.

lastchancename:
2 - Adding a decent electrolytic capacitor at the remote end, to absorb the pull-in current.

That will only make things worse, as it will increase the inrush current upon switching on the solenoid: now the cap also wants to get charged!

I was assuming the lock driver will be at the far end, not over the CATx
Only a control to say lock/unlock to be sent over the pair ??

Ah, right. In that case you need some good decoupling indeed.

To me it sounded more like there's an Arduino somewhere taking some inputs of whatever escape room puzzle there is, and when it's OK sends power to a lock (as in signal from pin to MOSFET) which happens to be on the other end of some longish wires.

The Arduino that sends the unlock signal will be on the same end as the magnet. It's actually all inside an old cash register, and there are sensors underneath some of the buttons, so it was easier to stuff it all inside there.

So in that case, I do want that capacitor at the far end of the run? Across the 12V and ground?

You want the capacitor at the power supply - where the power supply connects to your project, so close to the Arduino and the related hardware it controls. 100-470µF will probably do. To an extent, more is better.

Do get a 12-5V buck converter to power your Arduino from that 12V source. Don't rely on its built-in regulator, it's prone to overheating.

I was a bit of both, thinking of a chunky reservoir electrolytic cap close to the lock solenoid.
Decoupling is a given, wherever there is logic/control circuitry.

wvmarle:
Just the cable or was it still carrying 220V AC as well?

Very funny! :grinning: Just the 12 V and draw just under half an Amp. Presently, the magnets are merely controlled by a switch adjacent to the door.

wvmarle:
At 110-150 mA that means you can expect a 0.09-0.12V drop over the wire. If you think that's acceptable, no problem. If you think that's unacceptably high, go for thicker wire.

Also funny!

wvmarle:
Do place your flyback diodes right at the coil, not the other end of the wire. You don't want those current spikes to radiate out - that wire is one big antenna!

This common but completely wrong advice stems from failure to comprehend the situation. Here we go!


I find it surprising that even educated engineers can resort to "magical thinking" about the situation, with assertions about "current surges" and putting the diode as close as possible to the inductor because the inductor "generates" the surge.

That turns out to be an absurdity. What generates the transient is not the inductor but the switching device, either a mechanical contact or a semiconductor. The inductor - as a response - acts to maintain the instantaneous current flow by generating the "back-EMF". So you provide an alternative path for it to do so through the diode. It is still the case that the current through the inductor and its connecting wires does not change rapidly.

What does change rapidly is the current through the switching element and the power supply which suddenly drops to zero, and the current through the diode which as a consequence suddenly rises from zero to that same current.

The significance of this is that if interference is going to be caused by electromagnetic radiation from a suddenly changing current, that suddenly changing current is located in the loop formed by the power supply (or the local bypass capacitor), the switching element and the diode but not the wiring between the diode and the inductor. The need is thus to minimise the length of that supply - switch - diode loop by placing the diode as close as possible to the switch and power supply bypass - the capacitor mentioned above. It is these three that must be close together. Suggesting you need to place the diode close to the inductor (or motor) is actually quite wrong! :astonished:

On the other hand, there is a voltage transient caused by the switching which can capacitively radiate interference. This impulse is - again - caused not by the inductor but by the switching element so it actually radiates - possibly counter-intuitively - from the switching element to the inductor however to all intents and purposes, all points on the wire connecting switch, diode and inductor experience the same transient so this is not affected either way by the location of the diode.

I find it surprising that even educated engineers can resort to "magical thinking" about the situation, with assertions about "current surges" and putting the diode as close as possible to the inductor because the inductor "generates" the surge.

Very good explanation Paul and one that got me testing things. I am guilty of the same mistake, but more through carelessness than any magical thinking. I would have said put the diode next to the inductor and I now know I would be wrong. I guess the logic is that I have always seen them there and, mostly, the inductor is close to whatever is switching it so putting it next to the inductor is the same as putting it next to the switch.

I also emailed your explanation to a friend whose electronics knowledge I admire; his response was long an waffling, which suggests it's long overdue he and I have a curry and a beer together :slight_smile:

++Karma; for teaching me something I thought I already knew all about.

In fact, the magnetic latch that I cited actually does include the diode. Well, my version does, as well as an indicator LED. The listing cited refers to a "MOV", but I would imply from the red and black leads, that it is actually a diode.

But that is not a problem, just a backup which will protect the switching transistor if not entirely avoid nasty transient interference. Another diode adjacent to the switching transistor will "kick in" earlier to minimise the transient. There may in fact, also be some contribution to the transient from the inductance of the cable between switching transistor and the magnet.

I would simply drive it with an avalanche rated MOSFET used as a low side switch. Connect the Source to ground, both the arduino and the coil grounds must be connected. The gate to the Arduino and the drain to the coil. The other end of the coil to the power supply. With this configuration your on voltage will be 12 Volts when you turn it off your transient voltage should be less then 0.5 with a reasonable sized MOSFET. The nice thing about this solution there is no polarity to worry about. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil