Pages: 1 2 [3]   Go Down
Author Topic: Arduino has some strange reactions  (Read 3344 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

May want to try this:
Add a 10uF cap between the reset pin and ground on the Uno board.

From what I think I remember reading in the past this keeps the board from resetting on com port usage? What did you have in mind with this for this situation? Thanks!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Long shot, but maybe some of the interference is triggering the auto-reset circuit.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the suggestion, I tried it for kicks with the same results. Just the contactor coil even causes arduino resets when switching off the load.

I really want to say it's being reset because the arduino drops the outputs without logic or input to do so and prints this in the serial monitor:


"Water TýSystem Initialized"

It's sort of a half baked between Water Tank, and my serial begin printLN "System Initialized".

What else could cause this to happen if not a ripple in the supply? If the DC supply was perfect with no dip, are there any other things that can cause the uno to show that?
Logged

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 24
Posts: 1766
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
These EMC problems are hard to debug!

Here's some possible help from http://arduinoinfo.info

http://arduino-info.wikispaces.com/RelayIsolation

I think you need transient suppression across that solenoid coil.  A MOV (Metal Oxide Varistor) would be good.  A series combination of resistor-capacitor may work.  Try .1 uf (rated at 400V or more) in series with 47 ohms to start...
« Last Edit: August 22, 2012, 07:58:34 am by terryking228 » Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also I tried a new arduino for kicks, mostly because I wanted a second one and needed an excuse. Same things but I kind of expected that. My problems still lie within the system as a whole.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
These EMC problems are hard to debug!

Here's some possible help from http://arduino-info.info

http://arduino-info.wikispaces.com/RelayIsolation

I think you need transient suppression across that solenoid coil.  A MOV (Metal Oxide Varistor) would be good.  A series combination of resistor-capacitor may work.  Try .1 uf (rated at 400V or more) in series with 47 ohms to start...


Thanks for the links. I've tried a redlion suppressor module with the same values you mentioned, in the past and it didn't seem to help at all. The contactor with a suppressor on the coil seemed better, but the water solenoid wasn't phased by it.
Logged

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 24
Posts: 1766
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hm....

Wither Ground?  How are you powering Arduino? Is the ground side of Arduino connected to "Building Ground"? How?

If it's just back through a USB cable, that can be trouble. Ground can be bouncing..
Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

12VDC for the arduino and my general 12VDC bus is from an adjustable AC-DC power supply (din rail mount). I am only using a USB connection when trying to de-bug with the serial monitor.
Logged

Topsham, Vermont USA
Offline Offline
Edison Member
*
Karma: 24
Posts: 1766
... in The Woods In Vermont
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you're down to physical separation between those power / solenoid devices, and possible shielding of the cables that go to Arduino.

Solenoids are, by definition, large inductors and when they are disconnected there is energy that has to go somewhere. MOV / R/C suppression across the solenoid is the usual answer.  Also, you might try switching the solenoid with an optically-isolated zero-crossing TRIAC type solid state relay (like these: http://goo.gl/RbCNb).  But sometimes the inductance of the solenoid make the voltage a current not be in phase. These should work at the 24VAC level OK with most solenoids.

People have beat these problems in lots of automated machinery.  The physical layout and shielding are often important.

Let us know how you're doing!

DISCLAIMER: Mentioned stuff from my own shop...
« Last Edit: August 22, 2012, 08:07:30 am by terryking228 » Logged

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you're down to physical separation between those power / solenoid devices, and possible shielding of the cables that go to Arduino.

Solenoids are, by definition, large inductors and when they are disconnected there is energy that has to go somewhere. MOV / R/C suppression across the solenoid is the usual answer.  Also, you might try switching the solenoid with an optically-isolated zero-crossing TRIAC type solid state relay (like these: http://goo.gl/RbCNb).  But sometimes the inductance of the solenoid make the voltage a current not be in phase. These should work at the 24VAC level OK with most solenoids.

People have beat these problems in lots of automated machinery.  The physical layout and shielding are often important.

Let us know how you're doing!

DISCLAIMER: Mentioned stuff from my own shop...

I've tried a solid state relay with little success, a Carlo Gavazzi with zero cross switching. I will try some good probing with my scope in the coming days and see what I can find. Thanks.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Another few things that are important to indicate:

- Adding RC Suppressors do help a lot, one across the contactor coil and one each across the solenoid load directly at the load. The frequency of mysterious events drops significantly, almost enough to say screw it and go with the system as is. Yet the false triggers still make me want to find the issue at hand.

- The two ac loads in my system, a contactor and ac solenoids can function what appears to be perfectly if they are used individually. That is to say, with rc suppressors in place, if I only engage the contactor, or only switch the solenoid, one or the other, there are no problems apparent. It's the combination of the two that causes problems. Again, not nearly as much with the RC networks.

I've rewritten the code slightly, and enclosed it below. I've checked the DC supply to the arduino with my scope and only see a clean dc supply with no significant drops/ripple in the supply. I'm open to suggestions on perhaps probing the I/O to see what's actually happening. I would still really like to know how the arduino is having these seemingly random events, even with suppressing the ac loads. Thank you.

Code:
/*
  Water Controller
 
 This system controls water flow with 1 pump, 3 Water Solenoids, 2 water tanks, 2 water level float switches, and 2 manual switches.
 Conditions are set so that the pump is only feeding one source at any given time; to not choke the water supply or overload the pump.
 Only the manual switch can activate it's solenoid to bring water in as it is feeding from one of the tanks. If two switches are low
 at the same time the system will hold the others until the first one is high again.
 
 Sketch Created July 7, 2012
 by Brian
*/

// Digital Input Pin Constants
const int S1 = 2;    // Float Switch 1
const int S2 = 3;    // Float Switch 2
const int S3 = 4;    // Manual Switch 1 (Junction Box)
const int S4 = 5;    // Manual Switch 2 (Enclosure)
// Digital Output Pin Constants
const int K1 = 6;    // Relay K1 - Solenoid for Tank 1
const int K2 = 7;    // Relay K2 - Solenoid for Tank 2
const int K3 = 8;    // Relay K3 - Solenoid for Manual Use
const int K4 = 9;    // Relay K4 - Water Pump Relay
// Delay Times
const int DT1 = 3000;  // Solenoid/Debounce Delay Time
const int DT2 = 20;     // Manual Switch Delay Time for Debounce
// Variables that will Change
int curS;

void setup() {
 // Initialize the pins, define digital I/O Pin Usage
   //Inputs
  pinMode(S1, INPUT);
  pinMode(S2, INPUT);
  pinMode(S3, INPUT);
  pinMode(S4, INPUT);
   //Outputs
  pinMode(K1, OUTPUT);
  pinMode(K2, OUTPUT);
  pinMode(K3, OUTPUT);
  pinMode(K4, OUTPUT);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, HIGH);
  digitalWrite(S4, HIGH);
  Serial.begin(9600);
  Serial.println(F("System On"));
}

void loop() {
// Begin Water Tank 1 Logic
  if (digitalRead(S1) == LOW && curS == 0)
  {
    Serial.println(F("Water Tank 1 Low"));
    digitalWrite(K1, HIGH);
    Serial.println(F("Solenoid 1 Open"));
    delay(DT1);
    digitalWrite(K4, HIGH);
    Serial.println(F("Pump On"));
    Serial.println(F("Filling Water Tank 1"));
    curS = S1; 
  }
  else if (digitalRead(S1) == HIGH && curS == S1)
  {
    Serial.println(F("Water Tank 1 Full"));
    digitalWrite(K4, LOW);
    Serial.println(F("Pump Off"));
    delay(DT1);
    digitalWrite(K1, LOW);
    Serial.println(F("Solenoid 1 Closed"));
    curS = 0;
  }
// Begin Water Tank 2 Logic
  if (digitalRead(S2) == LOW && curS == 0)
  {
    Serial.println(F("Water Tank 2 Low"));
    digitalWrite(K2, HIGH);
    Serial.println(F("Solenoid 2 Open"));
    delay(DT1);
    digitalWrite(K4, HIGH);
    Serial.println(F("Pump On"));
    Serial.println(F("Filling Water Tank 2"));
    curS = S2;
  }
  else if (digitalRead(S2) == HIGH && curS == S2)
  {
    Serial.println(F("Water Tank 2 Full"));
    digitalWrite(K4, LOW);
    Serial.println(F("Pump Off"));
    delay(DT1);
    digitalWrite(K2, LOW);
    Serial.println(F("Solenoid 2 Closed"));
    curS = 0;
  } 
// Begin Manual Switch 1 Logic
  if (digitalRead(S3) == LOW && curS == 0)
  {
    Serial.println(F("Misc. Water Valve Open"));
    digitalWrite(K3, HIGH);
    delay(DT2);
    curS = S3; 
  }
  else if (digitalRead(S3) == HIGH && curS == S3)
  {
    Serial.println(F("Misc. Water Valve Closed"));
    digitalWrite(K3, LOW);
    delay(DT2);
    curS = 0;
  }
// Begin Manual Switch 2 Logic
  if (digitalRead(S4) == LOW && curS == 0)
  {
    Serial.println(F("Manual Pump Switch On"));
    digitalWrite(K4, HIGH);
    curS = S4;
    delay(DT2);
  }
  else if (digitalRead(S4) == HIGH && curS == S4)
  {
    Serial.println(F("Manual Pump Switch Off"));
    digitalWrite(K4, LOW);
    delay(DT2);
    curS = 0;
  }
}





Logged

Minnesota, USA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ideally when using AC loads you want a device that can time the shut off to the point where the wave makes the zero crossing or choose a DC Solenoid due to all the pain AC loads cause. DCs are easy to rectify.

If nobody has mentioned it yet try winding/twisting the pair of wires going to your solenoid as tightly as possible (if you do not have enough slack to do so run new longer wires) chock the wires up in a cordless drill and spin. This will have a magnetic cancelling effect that will help impede the inductive spike, while you're at it loop this wire through a couple ferrite beads.

To repeat what others are saying, separate your power supplies and keep your signal and power wires as isolated from each other as possible.

and this app note repeats what others have been saying, coil suppression is a common application in relays because the same voltage causes arcing and welds relay contacts shut.

http://relays.te.com/appnotes/app_pdfs/13c3311.pdf
Logged

Pages: 1 2 [3]   Go Up
Jump to: