Hi All,
I need to drive some 12V DC motors using an Arduino Nano Every board. The motors can require up to 6 Amps. I managed to drive them using some opto-isolated relays, so there should be no problem on this side.
I am also using two different power sources: one for arduino and one for the motors. I have a shielded signal cable running parallel to the unshielded power cable of the motor (1 meter, more or less). At the motor side I added a 100nF condenser. The shield of the cable is attached to arduino’s GND. The signal cable is attached to a switch, in order to be able to stop the motor when required.
One side of the switch is attached through the signal cable to an Arduino’s pin configured as INPUT_PULLUP, the other one is connected to Arduino’s GND.
The problem is that when the motor is powered on, I have issues on Arduino’s serial connection attached to my PC through the USB port; also an LED of another component attached to a different pin, starts flickering. I believe the problem is an interference between the motor’s power cable and the signal cable.
My question is: how to reduce the noise?
Can one of the following help?
Changing from pull-up to pull-down strategy
Using a twisted-pair shielded cable (mine is shielded but not twisted)
You said you are using two supplies and opto isolation.
So did you not connect relay ground to the Arduino.
A hand-drawn diagram instead of words could have made things clearer.
If nothing else helps, add a 100n cap from switch pin to ground, close to the Arduino.
Leo..
The schema is slightly more complicated as described, because I'm using 2 relais to move the DC motor in both directions and the switches are 2 as well (one for each direction).
With the attached schema it's easier to understand.
The relais board and Arduino share the same GND.
To protect the relay contacts (from welding shut) you normally add a bridge rectifier.
(+) and (-) to (+) and (-) of the motor supply, and the two AC pins to the two motor terminals.
This is the link to the board: 8 CHANNEL 5V 10A RELAY MODULE
I also attach the documentation they sent me. The JD-VCC jumper is open and the board is attached to Arduino exactly as in the very last image of the documentation.
This is good ONLY is one end, only, is grounded and that is at the lowest impedance ground. Is the Arduino ground also connected to the mains ground, through the power supply? Should be in order to be effective.
That shield will not protect from magnetically induced noise form your power cables. ONLY twisted pair in your data cable will protect from that. One wire signal and it's twin being a ground wire.
You currently don't have opto isolation.
For that you must power the Arduino from a different supply than the relay board.
And remove the jumper, and connect relay supply to JD-VCC and relay ground, and only connect the Arduino to VCC and relay inputs (no ground connection between relay and Arduino).
But you might not have to go that far with just the motor diodes and 100n cap on the switchpin.
Didn't read through this post, but it has the pictures for motor diodes.
Leo..
Edit:
The 600mA supply is in theory under-rated for an 8-relay board + Arduino,
which can draw 8*80mA + 50mA = 690mA.
But if you don't activate more than 5 or so relays at the same time it should be ok.
Ok, I can add one more AZ-Delivery power supply for the Arduino.
The jumper is already removed and the power supply is attached to the GND and JP-VCC pins of the board.
From what I understand from the documentation, the GNDs of the board and Arduino should be connected:
I'm driving only 2 relais at a time: one for the direction of the motor and the second one to turn on the motor-power-supply (or better to turn it off, when not needed for a longer period).
Hi Paul,
yes the shield is connected to the GND of the Arduino, and that one is connected to the GND of the power supply. So basically the GND of the power supply is connected to both Arduino's GND and the shield.
So the solution to the interferences should just be to change the cable with a twisted one, right? Like an ethernet cable or so?
EDIT:
Does it make sense to replace the power cable with twisted ones as well?
You understood wrong.
That image shows how to connect if you don't want or need optional opto isolation.
For opto isolation, you must not share grounds.
Leo..
Never expect something like that to fix something you have never characterized not found that source of. Right now you just doing stuff that should have been done in the initial installation, So, consider this just a training session. All signal noise could still be there, but this is just covering all the possible bases.
Don't change the power cable until you have determined it is the source of the noise. Quality power cables will already have twisted pairs. Who installed the power cable? It should be in metal conduit if done by a licensed electrician.
I probably expressed wrong what I wanted to say. With ‘power cable’ I meant the cable which connects the 12V power source to the relays and the relays to the motor (as opposite to the ‘signal cable’).
It’s not the 220V cable.
Don't think of other solutions until you have added the diodes and the 100n caps between the switch pins and ground.
I assume the switches are endswitches, because you have drawn them on both sides of the motor.
End switches should be "normally closed". Are they?
Leo..
Hi Leo, I think this is the point! My endswitches (yes, they are endswitches) are normally open.
Let me see, if I understood what’s happening.
I have most of the time one wire connected to GND and one to the positive pin (pull up). Both wires receive the noise from the motor (despite the shield), but while one wire ‘drains’ it to the GND, the other one sends it to the input pin.
If I changed the switch connection to normally closed as you suggested, both wires were most of the time connected to GND, and the noise would be mostly absorbed by the ground.
Only when the motor reached the end position, there could be noise on the positive wire (which would not be connected to GND anymore), but the diods would prevent heavy inductive noise from the motor and the cap between GND and the pin would absorb the rest.
Is this correct?
An opening switch is more reliable than a closing switch, especially when the switches get old.
And yes, a closed switch grounds the pin, so no LF (mains power) noise.
The wire could still pick up RF noise, so do add that 10-100n ceramic cap from pin to ground.
And use (Cat-5/6) twisted wire instead of shielded, and add the four diodes on each motor.
Leo..
Edit: Normally closed also detects a broken wire safely.