Go Down

Topic: Reverse Voltage Issue (Read 4293 times) previous topic - next topic

Miro80

Hello everybody,

Need your assistance ASAP.
I've built a small project using Arduino Mega and I think that I have a reverse voltage issue.

Attached in a sketch of the problematic part in my setup.

I have 2 power supplies of this kind: http://www.ebay.com/itm/231667699743?_trksid=p2057872.m2749.l2649&var=530894013663&ssPageName=STRK%3AMEBIDX%3AIT

One provides 5V which drives the relay module and the second one provides 12V which drives the Arduino through the 12V input jack and the ElectroMagnet through the relay module.

The ElectroMagnet is of this kind: http://www.ebay.com/itm/60KG-132lb-Electric-Magnetic-Lock-Fail-Secure-DC-12V-for-Door-Entry-Access-36L7-/131678535197?hash=item1ea8a6fe1d:g:3KsAAOSw~otWcTIO

The relay module is of this kind: http://www.ebay.com/itm/331859710240?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

5V from Arduino is connected to the 16 channel relay module (didn't connect the ground because I don't want the Arduino to drive the relay module). The Arduino controls the specific relay with digital output.
I also have a micro-switch connected to other digital pin and controls other stuff.

The problem started when I connected a switch between the ElectroMagnet and the relay module. Theoretically it has no connection to the Arduino but when I press it (it's in normally closed mode) and the ElectroMagnet is turned off the other switch, the one connected to the Arduino  is toggled and switches on whatever it should turn on. When I turn off the Magnet using the Arduino's digital out everything works fine.

I believe that I have a debounce issue caused by reverse voltage coming from the ElectroMagnet whenever I manually turn it off.
I can try enlarging the debounce delay (currently 50 milliseconds) and perhaps it will solve the issue but I would like to get to the route cause and try to prevent the reverse voltage coming back to the Arduino.

I connected a Schottky Diode (1N5819) in series to the electro magnet: between Vcc-in of the magnet and Vcc-out of the relay module and it didn't help.
I connected a Schottky Diode (1N5819) in parallel to the electro magnet: between Vcc-in and GND and it didn't help.

I'm not sure what is it I'm doing wrong, the diode should prevent the reverse voltage but it doesn't, perhaps I should use other Diode?
Perhaps I need to connect it differently? Perhaps other (simple) solution, like maybe connecting the Arduino to a different power source and not to the same one the electro magnet uses ?

Your help would be greatly appreciated
 


weedpharma

I don't see any common gnd between the power supplies and Arduino.

Weedpharma

Miro80

You mean connecting the 5V power Supply's GND to the 12V power Supply's GND ? How will it solve my issue ?

raschemmel

#3
Aug 09, 2016, 10:29 am Last Edit: Aug 09, 2016, 10:41 am by raschemmel
Quote
The problem started when I connected a switch between the ElectroMagnet and the relay module. Theoretically it has no connection to the Arduino but when I press it (it's in normally closed mode) and the ElectroMagnet is turned off the other switch, the one connected to the Arduino  is toggled and switches on whatever it should turn on. When I turn off the Magnet using the Arduino's digital out everything works fine.

I believe that I have a debounce issue caused by reverse voltage coming from the ElectroMagnet whenever I manually turn it off.
I can try enlarging the debounce delay (currently 50 milliseconds) and perhaps it will solve the issue but I would like to get to the route cause and try to prevent the reverse voltage coming back to the Arduino.
I don't understand what you are trying to say (the problem is)

Try describing the problem again.

You post title mentions reverse voltage, but you haven't posted any voltage measurements.

Don't you have a meter ? Do you know how to use a meter to detect reverse voltage ?

I don't understand what the problem is.

Try describing your problem like this:
Condition-A: [etc]
Condition-B: [etc]
Condition-C: [etc]
Observation: [etc]

Quote
I connected a Schottky Diode (1N5819) in series to the electro magnet: between Vcc-in of the magnet and Vcc-out of the relay module and it didn't help.
I connected a Schottky Diode (1N5819) in parallel to the electro magnet: between Vcc-in and GND and it didn't help.
Well, of course this seems to indicate that you are not aware the diode should always be in parallel with the coil generating the back-EMF (what you are calling "reverse voltage")

If I knew what the problem was I might have a comment.

what is the problem ?

I don't understand it the way you described it in the quote above.

Quote
I don't see any common gnd between the power supplies and Arduino.
 
Yeah, that's a good point but since he has the Opto-coupled relays, if he wired it correctly , he should not need a common ground. Based on the post:

A-links are not working links (OP is not familiar with the forum toolbuttons , like the LINKS button)
 This indicates lack of time spent learning how to use the forum.

B-no schematic (indicates lack of experience with electronics)

C-poor description (same as above)

it would seem whatever the problem is , is related to a miswire somewhere.

In general, I think the problem is the cart is before the horse. The OP should have posted here to ask HOW connect everything BEFORE connecting it.  Why ? Clearly he does not know how and that is exactly the purpose of this forum.






@OP,
Is it possible for you to draw a schematic or block diagram on a blank sheet of printer paper and post a photo of it ?

Miro80

what is the problem ?

I don't understand it the way you described it in the quote above.

Yeah, that's a good point but since he has the Opto-coupled relays, if he wired it correctly , he should not need a common ground.
The problem is:

When I turn off the ElectroMagnet using the switch labeled as "Manual Switch" in the previously attached picture of my setup, the other switch in the sketch (the one connected to the Arduino) is triggered though no one is touching it.

Could you possibly think of any reason other than EMF and can cause this issue ? I mean, Arduino isn't "aware" that there's a switch that can open the circuit between the Magnet and the relay module but still, when I use that manual switch the Arduino detects that other, totally independent switch is triggered.

By the way, as I mentioned in my previous message, I did try to connect the diode in parallel to the Magnet's coil but it didn't help. But you are right, I don't have much experience with diodes and that's why I'm seeking other people advise here.



raschemmel

#5
Aug 09, 2016, 10:58 am Last Edit: Aug 09, 2016, 11:02 am by raschemmel
First of all , you are breaking the first rule of power distribution.
You are powering your microcontroller from the same power supply that powers the inductive coil (the electromagnet). This is a big no no.
The arduino should NOT be powered by the 12V supply for TWO reasons:

1-It is the electromagnet power supply
2-12V is too high for an input to the Vin of the Mega. It causes the onboard 5V regulator to overheat.

The Mega should be powered by the 5v supply using the 5V pin on the Mega.

The 12V supply should ONLY power the maget.
You should have separate GNDs between the two supplies because you have an opto isolated relay board.

I am not really sure how everything is wired because your image file is such poor resolution.
Post a larger file size (1 Mbyte) .

or post a wiring list (preferred ) that references pin labels . (like N.O., N.C. COM, etc)

Quote
By the way, as I mentioned in my previous message, I did try to connect the diode in parallel to the Magnet's coil but it didn't help. But you are right, I don't have much experience with diodes and that's why I'm seeking other people advise here. 
I really don't care what you tried. The fact of the matter is back-EMF diodes ALWAYS go IN PARALLEL with the inductive device, PERIOD. The fact that doing that didn't help only indicates your problem is somewhere else, not that you shouldn't do it. This is what I meant about lack of experience with electronics. If you google "flyback diode" or "back-emf diode",
THIS is what you get.

Did you do that ?


outsider

There is no ground wire from E-magnet to 12V supply.

Miro80

First of all , you are breaking the first rule of power distribution.
You are powering your microcontroller from the same power supply that powers the inductive coil (the electromagnet). This is a big no no.
The arduino should NOT be powered by the 12V supply for TWO reasons:

1-It is the electromagnet power supply
2-12V is too high for an input to the Vin of the Mega. It causes the onboard 5V regulator to overheat.

The Mega should be powered by the 5v supply using the 5V pin on the Mega.

The 12V supply should ONLY power the maget.
You should have separate GNDs between the two supplies because you have an opto isolated relay board.

I am not really sure how everything is wired because your image file is such poor resolution.
Post a larger file size (1 Mbyte) .

or post a wiring list (preferred ) that references pin labels . (like N.O., N.C. COM, etc)
raschemmel, thnx for the quick responses.
As you understood, I'm new to this forum and to Arduino but you confirmed my suspicion regarding the: Same power source driving the arduino and the ElectroMagnet and I will connect it to a different power source and see if the problem continues but I have an additional question:

As per what I read on the official Arduino Mega page and here: https://arduino-info.wikispaces.com/ArduinoPower

I can drive an Arduino Mega by connecting it to 12V power source through the regulated
DC power jack (7 - 12V), you say I better connect it to 5V power supply instead ?


raschemmel

#8
Aug 09, 2016, 11:31 am Last Edit: Aug 09, 2016, 11:58 am by raschemmel
I know what it says on the product page.  I have 35 years experience with electronics and I'm telling you 12V will cause thd 5V regulator to run hot. Connecting the 5V p.s. 5V DIRECTLY yo the 5V pin (NOT Vin pin) of the mega and GND => GND of ths 5V supply and NOT connecting the 12V supply GND to the Mega GND will allow the 12V supply to power the magnet eithiut effecting tgd Mega. Since you are electronics challenged,, FYI, you should NEVER tufn OFF power to the Mdga with ANY  voltage on ANY I/O pins. The proper SHUTDOWN procedure is EVERYTHING gets turned OFF FIRST snd Mega gets turned OFF LAST.. Proper POWER UP procedure is Mega gets turned ON FIRST, and THEN everything else.. Just do it without asking why. You're not ready to understand thd reason yet.

If yiur relay bd has  a JD-VCC jumper, remove it.
( see opto relay schematic I posted)

Wawa

I have bad experiences with 16-channel relay boards.
No JD-VCC jumper, and optos but no opto isolation without serious hacking.
They had onboard 5volt buck converters.
A separate 5volt supply would be not needed (bad) for that board.
But this seems to be a different model.
Post clear pictures of both sides of the relay board.

Use a diode across the inductor.
You don't want a spike of a few hundred volts across an opening relay contact.
Leo..


MarkT

There is no ground wire from E-magnet to 12V supply.
This has (wrongly I believe) been pointed out already.

These opto-isolated relay modules take a common-anode supply from Arduino 5V, and
each input is pulled low by the Arduino to operate the opto-isolator.   

If you connect the grounds you will bypass the opto-isolation completely, so don't do that!

Of course I'm assuming its one of the common cheap eBay relay modules in saying this,
but it makes sense that it is
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

MarkT

BTW this is a massive electromagnet, the chances are STRONG that operating it without a free-wheel diode has
trashed something.   Never ever do that.  BTW a large electromagnet like this can easily generate a shock
that is life-threatening if you don't provide a diode or other protection device?

It is also possible, given the wires are colour-coded, that the device has a built-in diode (this is a wise
precaution), but unless you know this for sure, use a free-wheel diode.  Use one anyway, they are cheap
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Wawa

These opto-isolated relay modules take a common-anode supply from Arduino 5V, and
each input is pulled low by the Arduino to operate the opto-isolator.   

If you connect the grounds you will bypass the opto-isolation completely, so don't do that!
As I already pointed out, 16-channel relay boards are different. They DON't have opto isolation.
Common ground comes from the other supply, so you might as well run the Mega off the 5volt supply of this relay board and forget about that other 5volt open frame supply.

The picture of the link shows the board I know, but without the caps and 5volt buck chip shown on the picture. Not sure what's going on there.
You can find the datasheet of that relay board on the Sainsmart site.

Measure the diode that you have used in series with the solenoid.
You might already have fried it.
Leo..


dlloyd

#13
Aug 09, 2016, 02:28 pm Last Edit: Aug 09, 2016, 02:29 pm by dlloyd
Checked the SainSmart Wiki and the PCB pdf for the 16 Relay Module still shows the version dated 2011/5/11 ... its unchanged. Judging by the many relay modules out there with crippled isolation through the opto circuit, it's safe to assume this problem remains.

Even if the electromagnet was configured properly, using a different relay module that has true opto isolation, powered with a separate DC supply, arc suppression installed across all switched contacts and proper reverse suppression (flyback diode) across electromagnet coil, I would never place the electromagnet in close proximity to the Arduino or problems can still be expected due to EMI emissive energy/RFI.

Miro80

Thank you all for the replies.

So, to summarize what I should do with my setup:

1. I need to separate the Arduino P.S from the E-Magnet P.S.

2. It's better to drive the Arduino with 5V P.S and not 12V.

3. The 16 Channel relay module isn't the best choice but that's what I have and it looks like it does have optocouplers but the opto isolation isn't the best there is so:

      A. I do NOT need to connect the grounds of the 12V P.S which drives the loads connected to the relay
          module with the 5V P.S which drives the relay module itself.

      B. I must add diodes in parallel to every E.Magnet connected to that relay module (Yes, in the 
          overall setup I have more than one) and that will guarantee that any reverse voltage coming 
          back to the relay and from there to the Arduino is eliminated.

Additional question regarding the free-wheel Diode to use, can you please advise regarding the 1N5819, will it be sufficient ?
According to the specs of the E. Magnets I use, they are all 12V and consumes between 100mA-430mA so the 1N5819 should handle the EMF isn't it ?

Go Up