0
Offline
Newbie
Karma: 0
Posts: 9
Arduino rocks
|
 |
« on: May 24, 2010, 04:24:22 pm » |
Hello all colegues!
On my arduino mega I have 8 optocouplers and then transistors to drive electromagnetic valves. The problem is when I reset or power up the board all the pins get triggerd and all my valves get also triggered. I dont want that!
So I bypassed the problem with a main relay that in NC state cuts the supply of 12v for the valves so they do not get triggered at startup. And then later on the code after the first seconds connects the relay and lets the power to all the valves that can now be triggered via optocouplers/transistors.
Is there another way to bypass this - with code - bootloader - a simple trick...
Thanx!
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15320
Measurement changes behavior
|
 |
« Reply #1 on: May 24, 2010, 05:10:52 pm » |
We would probably have to see the wiring schematic you are using showing how you are driving the valves, it's possible you require pull-down resistors on your digital outputs.
Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Phoenix, Arizona USA
Offline
Faraday Member
Karma: 27
Posts: 5083
Where's the beer?
|
 |
« Reply #2 on: May 24, 2010, 05:16:43 pm » |
I believe (and I hope someone corrects me if I am wrong) that you could hook an electrolytic capacitor to ground at the point where your base current resistor connects to the transistor controlling the valve (that, or before the resistor - between it and the microcontroller pin).
Basically, the idea is that for a transient pulse signal from a pin from the microcontroller, the current would be driven to ground via the capacitor because it can't charge quick enough (you would need to add a resistor in series with the cap to control the rate, the size of the cap will play a role too - you can find online how to calculate what resistor, etc is needed for charge times); but a steady output would charge the capacitor and finally allow it to pass to the base of the transistor when fully charges (because at that point the capacitor looks like a large resistor to the current, when it is fully charged).
So transients won't affect it, but a steady output from the pin will turn it on.
I think.
:-?
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #3 on: May 25, 2010, 03:50:14 am » |
The basic problem is that on power up all the pins are set to be inputs. Therefore they float. Depending on the circuit design this can look to the driver like a signal and thus look like the outputs are pulsed. So simply design your driver circuit not to switch on a floating output. As was mentioned before pull down resistors are a simple modification that normally work.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 9
Arduino rocks
|
 |
« Reply #4 on: May 25, 2010, 04:33:44 pm » |
 Thats the basic schematics. I have tested it with solenoids, motors and relais. I did some experiments and the pulsation only happens when i plug in the arduino to usb or ext power suply. Thanks for all the answers. A
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 9
Arduino rocks
|
 |
« Reply #5 on: May 25, 2010, 04:34:22 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #6 on: May 25, 2010, 04:41:22 pm » |
and the pulsation only happens when i plug in the arduino to usb or ext power suply. Did you try pressing the reset button?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 9
Arduino rocks
|
 |
« Reply #7 on: May 25, 2010, 04:47:43 pm » |
Yes, at the reset everything is OK, no triggering.
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #8 on: May 26, 2010, 08:01:53 am » |
So it is not a problem with the arduino itself but your external drivers. You need to post a schematic of what you have in order for us to help you from here.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 9
Arduino rocks
|
 |
« Reply #9 on: May 26, 2010, 09:46:04 am » |
I have posted the schematics for one valve in the link in the post above. Basically it does not matter what you have connected, I can connect only one LED and it does not matter on which port. On the powerup it blinks.
I have 3 Arduinos Mega and it is the same on all of them. :o Andrej
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 9
Arduino rocks
|
 |
« Reply #10 on: May 26, 2010, 05:19:40 pm » |
Aha!
For the LEDs and for the optocouplers I have used the same value of resistors (330R).
I have tried to change the values of the resistor on the optocoupler (330R) to higher (1k or even 10K) and there was no more pulsating at power up. (if i tested with >=2 drivers) And I have distributed the gnd connections (before on single gnd pin) to other avaliable gnd pins. I think that the problem lies with the current that passes through the optocoupler to arduinos gnd. Too much?
Andrej
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 11
Arduino rocks
|
 |
« Reply #11 on: May 27, 2010, 04:11:59 pm » |
I have noticed this, but only when connected via USB, can you confirm if this is happening for you only over USB, or for mains also?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 9
Arduino rocks
|
 |
« Reply #12 on: May 27, 2010, 04:39:01 pm » |
Yes I am going to test everything again tomorrow in "the lab" and I will let you know. There is also difference in the way on how many GND pins you have distributed the circuit.
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25556
Solder is electric glue
|
 |
« Reply #13 on: May 28, 2010, 06:27:16 am » |
think that the problem lies with the current that passes through the optocoupler to arduinos gnd. Too much? No that's wrong.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 9
Arduino rocks
|
 |
« Reply #14 on: May 28, 2010, 04:15:42 pm » |
Hello dear colegues, i spent my afternoon experimenting and researching the problem and i found something that similar: Its a topic about reseting when driving a motor: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1192655807
|
|
|
|
|
Logged
|
|
|
|
|
|