Show Posts
Pages: [1] 2 3
1  Using Arduino / Project Guidance / Arduino leave me alone box on: December 07, 2013, 08:52:11 pm
Good evening everyone. I've had a lot of great help here before, I am thankful for such a great community. I have a new project that I am helping my brother with. It is one of these useless machine concepts but with a different approach. Rather than flipping a toggle switch, it would be opening a box that has a momentary, normally closed switch on it. You open the lid, it has a slight delay, then the arm from the servo closes the lid. My first thought was to copy the useless machine concept but after wanting to tinker with different output options (lights, sound, action!) I said, there is no easier way than to plug in an arduino and get some simple I/O going, completely flexible for tweaks and add-ons.

Anyhow, here is what I have laid out hardware wise:

- Arduino Uno
- Battery Pack
- Switch to cut power to battery pack easily to turn it off when not used
- NC momentary switch on lid
- Servo motor (3 lead with signal, geared typical hobby one)

What's the best approach programming wise for this?

My immediate thoughts:

- Switch on Pin 2
- Servo on PWM pin 9
- Switch as input with 5V, ground pulled down so that when the switch is open it isn't floating
- Logic is so that it reads this input, when the switch opens, delay(x ms to not be instantaneous) and then rotate say 90 degrees to close lid (would need to be tweaked to get it right). This is the part I am not sure of, since i am using one switch, can't I write logic so that I can say, when switch is opened, run servo until switch is closed again? Because the lid closing (servo is doing this) would close the switch at the end of the travel.

Thanks for all of your help!

2  International / Portugues / Re: Site pra comprar componentes para Arduino on: September 14, 2012, 01:38:27 pm
Obrigado gente. Eu tambem estava procurando algumas coisas na minha cidade e eu nao achei. Essa cidade e grande, mas e dificil. No meu pais (USA) gente tem lojas tao grande, entao voce achar qualquer coisa voce quer, tudo na mesma loja. Aqui cada loja vende outro tipo de componentes electrica. Por exemplo, ainda eu nao achei "shrink tube", aquela material para fazer conexoes (colocar encima dos fios) e jogar air quente para ficar menor encima dos fios. Dev-se muito menos comum no brasil, so no industria de controle/automacao. Comprei poquinho no Deal extreme mais eu acho que a qualidade e ruim. O melhor no meu pais e 3:1, maioria vende 2:1. Tambem tava procurando fio quem vem no tipo "plastic spool" 15M, 30M, bem flexivel para os paneis de controle, chama em ingles "multi-stranded hook-up wire". As lojas aqui so vende fio para casa, "solid core" ou se tem mais flexivel e tb e bem duro.

As precos aqui no brasil e obsurdo por os componentes, qualquer coisa electronico. Mais no USA a internet ajudou bastante para fazer estes precos melhor. Antigamente, os nossos precos nao erram bom. Mas depois a erra de internet, tudo baixou. Mais concorrencia, etc.. Principalmente eu acho e o imposto aqui. O governo aqui falar que o imposto e grande para proibir coisas importado; mais se voce quer vender aqui barrato, voce precisa fabricar aqui. E ai, a qualidade das coisas aqui e ruim de mais muitas vezes. O Brasil tem que despertar e perceber que tem que haver um equilibrio, o Brasil nao pode fabricar tudo bem e de forma eficient. Mais se nao tem bastante imposto, como os politicos vao comprar os sitios e mansoes deles?  smiley-grin
3  International / Portugues / Re: Site pra comprar componentes para Arduino on: September 09, 2012, 08:36:34 am
Valeu gente, muito obrigado. No gosto de dealextreme, ja tem problemas com o imposto? Precisar so faz comprars menos que $50 dollars para ficar tranquillo? E demorar quanto tempo, um mes mais ou menos? Obrigado!
4  International / Portugues / Site pra comprar componentes para Arduino on: September 08, 2012, 08:44:56 am
Sou americano mas eu estou morando em Minas Gerais. Normalmente eu comprar os componentes nos estados unidos no Newark, Mouser, Amazon etc. Para mim e dificil achar componentes electronicos, tipo resistores, luz de led, transistores etc aqui na minha cidade. Se voces saber alguns sites para comprar online, vc pode recomendo? Muito obrigado gente.
5  Using Arduino / Project Guidance / Re: Arduino has some strange reactions on: September 04, 2012, 04:34:28 pm
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;
  }
}





6  Using Arduino / Project Guidance / Re: Arduino has some strange reactions on: August 23, 2012, 07:37:01 am
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.
7  Using Arduino / Project Guidance / Re: Arduino has some strange reactions on: August 20, 2012, 09:41:20 pm
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.
8  Using Arduino / Project Guidance / Re: Arduino has some strange reactions on: August 20, 2012, 08:49:52 pm
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.
9  Using Arduino / Project Guidance / Re: Arduino has some strange reactions on: August 20, 2012, 08:45:57 pm
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.
10  Using Arduino / Project Guidance / Re: Arduino has some strange reactions on: August 20, 2012, 08:29:01 pm
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?
11  Using Arduino / Project Guidance / Re: Arduino has some strange reactions on: August 19, 2012, 03:45:43 pm
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!
12  Using Arduino / Project Guidance / Re: Arduino has some strange reactions on: August 19, 2012, 03:39:12 pm
Quote
The UNO responds in a way that isn't erratic as noise causes, it literally follows it's own logic, or gets screwed up and follows bits and pieces of my logic that I've written. Outputs aren't just fluttered or flashed, or held stuck open, they follow actual routines.
Yes that is noise induced erratic behavior. What happens is that, say a register, probably the program counter, gets a corrupt value in it and that sends the code off executing from some other place in the program. When a processor goes wrong it goes wrong in a big way not just fluttering outputs.

Quote
but I've isolated the power sources as far as I physically could
Maybe it is not enough?

Quote
I've purchased another UNO that I will try Monday
It could be you have a faulty processor, but I still think it is a interference problem. What about the case? Is that grounded to a solid mains ground?
What you are seeing is not usual but it is not unique either.
Quote
However, as far as I can see, the "reset" and I use this term loosely is no way by that I can see caused by a ripple in the dc supply.
Often this can be difficult to actually see. You need a good storage scope to catch the impulses. Have you probed round the rest of the circuit to make sure the waveforms are as you expect them to be?

There is only a limited number of things I can suggest remotely, it might be time to get a good consultant in to actually examine your system.



Mike,

Thanks for the info, still new to this microcontroller tech and appreciate your advice. Other than using a battery to "isolate" the dc bus what would you do for true isolation of the arduino / relay board supply and the solenoid? (In a way that would be theoretically impossible to cause inductive issues)

I think the next thing will be getting in there with a probe and as you said try to capture different problem areas to get a better idea of what it's doing. I feel like I'm so close that I can't give up now.  smiley-cool
13  Using Arduino / Project Guidance / Re: Arduino has some strange reactions on: August 18, 2012, 10:32:55 am
Mike,

I understand what you're getting at but I've isolated the power sources as far as I physically could. So let me describe my latest test results.

1. I isolated the AC transformer power to a precision lab grade power source, and I isolated the DC bus to another BK precision dc power supply. I left off the 120VAC bus because after that, the pump is the only thing needing AC power.

2. With the power sources provided as such the problems are just as apparent. I get misfires on outputs, followed by erratic output switching, it really takes a mind of it's own, all while keeping the input switch closed. I get multiple cycles as though it's latching onto the solenoid until the arduino appears to drop all and flicker the outputs on the way out, which I thought was a reset. However, as far as I can see, the "reset" and I use this term loosely is no way by that I can see caused by a ripple in the dc supply.

3. My earlier statement of this never happening on a LV level is false (just dc relays and arduino, real vanilla). I proved that yesterday and was stunned. I could get 20 program cycles with different inputs (no ac loads) and it works flawlessly. Then randomly it goes through a cycle of bad ones, flickering, misfires, wrong outputs switched etc as described above. Then I will get through a cycle of say 30 button presses, logic works flawlessly. It's completely random, has a mind of its own and has no consistency what-so-ever.

4. What is consistent and quite constant is that adding any AC coil load such as the solenoid or contactor, pump, severely magnifies that issue. So it's obviously two fold, there is a problem with my microcontroller internally and maybe some downstream stuff I need to deal with too. We are talking about the arduino switching one relay, and that relay switching another relay, two sets of dry contacts. The smaller relay only carries the load of a tiny led pilot light load and a relay coil, it's so small it's inconceivable to imagine that is being affected by flyback. The UNO responds in a way that isn't erratic as noise causes, it literally follows it's own logic, or gets screwed up and follows bits and pieces of my logic that I've written. Outputs aren't just fluttered or flashed, or held stuck open, they follow actual routines. Inconsistent routines, but routines none the less. I also tried a different but similar load inductive load, same problems. I also tested with the same value load but a resistive load, same erratic problems.

I've purchased another UNO that I will try Monday, but I'm baffled. Again I love the arduino and I'm not trying to state that it's the source of the problem but I want to rule it out. I'm totally open to suggestions, I think I've tried just about everything on my list.
14  Using Arduino / Project Guidance / Re: Arduino has some strange reactions on: August 04, 2012, 09:25:05 pm
So I did some more testing and tried a few things. I have to buy some ferrite beads/chokes to play with, but I still wanted to isolate the power sources. This time I took it a step further, which I've detailed below.

1. The most apparent problems occur when the solenoid is switched off, however the contactor has some less noticeable issues.
 
2. Sometimes the AC contactor with no load, being switched “off” resets the arduino or ripples the DC supply enough to reset it. This isn’t noticable by eye but by the way it reacts, it drops all outputs in a way (in my limited experience with the arduino) that could only be done by a reset, and prints the serial in a way that could only be done by reset.
 
3. Simple DC/AC Relay switching causes no apparent problems. (IE: Switch + Relay Board + Relay, no Load)
 
4. I tried adding an addon Contactor RC Snubber to the coil, no #2 problems with it installed, same as simple LL, LV operation. No resets apparent at all and no half flashes of LEDs on the relay board, it seems perfect.
 
5. Keeping the RC snubber in, and powering the dc bus from a bench supply on House Circuit 1, AC Transformer on House Circuit 2, and the rest of the power for the box on House Circuit 3, the problems are just as apparent if not worse than before. Sometimes causing up to 3 cycles on the solenoid inadvertently until it appears the arduino gets enough ripple to reset itself and de-energize the outputs, so to speak.

Any ideas on how this tiny AC solenoid load is causing these problems? Even being isolated on completely different circuits? I'm confident that the RC snubber has alleviated the problems on that side, and I even put a considerably larger inductive motor load on the contactor and it works flawlessly. Everything leads back to these darn solenoid valves! I will try the decoupling circuit when I get some of those components in from mouser.
15  Using Arduino / Project Guidance / Re: Comments on EBay Arduino "compatible" boards? on: August 01, 2012, 04:39:00 pm
I bought an ethernet shield on ebay. It works fine and it's a great close for a third of the price but usually like most knock offs is you see the fine details where they either didn't care or didn't get it right. It was shipped in a bubble wrap envelope, no static bag, and no real protection, all the way from china. Its pins were all bent out of shape, and the hole to hole center from one header to the other was wrong so I had to bend the pins to get them to fit. I would just use your best judgement, for all the hassle I wouldn't do it again, I would just buy a genuine shield up front.
Pages: [1] 2 3