I'm working with Arduino Megas and Duemilanoves both of which automatically choose USB power or external power.
What happens when both both USB and external power are plugged into the board?
We are having some problems with our circuit blowing transistors. It has only happened while we're programming and the computer is plugged into the board. We are using 21 pins for solenoid valves and 21 pins for LEDs. We are using low amperage LEDs, so that we don't exceed the 200 milliamps that the board can run. We have diodes protecting the transistors. We've run the board for 3 straight 8 hour days without programming and have not blown a transistor.
So we are starting to wonder if we are having power fluctuations when both USB and external power are plugged in. Thanks for any insight!
External power will power a board when it is plugged in at the same time as USB (and exceeds a minimum voltage of around 6.7V).
During programming, the microcontroller sees a brief reset pulse. It is possible that during that pulse all of your pins are going high or low (it's not always clear during the actual reset transition) and turning all 21 solenoids on at the same time.
The details of what is blowing and why really depends upon the details of your schematic and wiring. Is that something you can post?
You have to upload the picture somewhere and post its URL. Try a free hosting site like Photobucket, Imageshack, etc.
I have not heard of other people having the issues you're having with both power and USB plugged in. There was a recent thread that indicated a small problem with that arrangement, but I don't think it applies to your situation (I can't find the particular thread at the moment).
--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons
If your schematic is hard to follow what makes you think a photograph is any easier?
You have clearly done something wrong either in design or execution. If you want the best help we need to see the schematic first to see if it is designed right. Then we need a photo to see if you have implemented the design correctly.
Good point Grumpy Mike. I'm posting these images (probably can't tell anything from them anyway) and my assistants will post a fritzing diagram later today.
There are a bunch more in parallel, all with their own resistor, transistor and diode, from the digital pins to the terminal blocks so that we can control them individually. We left them out of the schematic because that is when it starts looking messy
It is difficult to match up that schematic with that photo.
It is not clear what happens to the negative terminals, the schematic suggests you have the diode across the coil, if so where are the negative terminals going?
Or is the circuit doing more than just switching the solenoids?
The diode is across the solenoids to protect the transistor when we turn them off. It just makes the connection at the same time the solenoid connects to the transistor, and then rather then run another wire for each individual diode back to the positive terminal block, we are just jumping all the ends of the diodes and connecting them back with one wire.
We have done some testing and with some programs the circuit can run all day with no problems, including having all the solenoids on at once for extended periods. However it seems somewhere in the process of testing some new programs we will burn out some transistors. We have not yet narrowed it down to which programs.
What is the wattage or DC current rating for your 24vdc solenoids? A 2n2222A transistor is not really a power transistor and may not be the best choice for your solenoids.
The 24vdc solenoids draw 6.9 watts ( 0. 2875amps).
They seem to handle the power fine. Just getting warm evening running for extended duration, and based on the voltage measurement across them they shouldn't be having to dissipate more heat then tolerated.
Still not sure what happens to the emitters of the transistors. Are those connected all to the negative end of the battery and the ground of the arduino?
Do you really use 1000K resistors on the base of the transistors, as that schematic shows. If you do it is way too high, these need to be in the order of 1K to 10K.
2) The 1000kOhm resistors at the base of the transistors is really too large. To turn on a ~250mA solenoid I'd expect about ~3mA of base current (5mA to be safer) so a base resistor of about 1k would be an appropriate value.
3) I agree that 2n2222 is probably not the best choice, but ~250mA is within its current range, so let's leave this alone for now.
4) You say the problem occurs when the chip is being programmed. The Arduino pins are floating then, so the base of the transistors is undriven. There could be enough noise/leakage in your setup to partially turn the transistors on and perhaps set up a weird oscillation that turns your solenoid coils into resonant circuits that build up large voltages. If you replace the base transistors with 1k then I'd recommend a 10k resistor from base to emitter to keep the transistors off when the Arduino is in reset and the pins are floating.
5) Given all the long wires in your circuit, the diodes might not do a good enough job of protecting the transistors. I'd put a diode across the transistors collector-to-emitter junction too to prevent the collector from going excessively negative.