Arduino malfunctions w/ multiple devices connected

Hello all. First time post, but I have been looking through these forums a lot as problems arise on my arduino project. This is one issue that we have not been able to do find a solution for.

What my group is trying to do is build an automatic cooking machine for a school project. The Arduino is obviously the controller of the machine. The components it is controlling right now are 6 actuators, a hotplate, and a motor. Power for all components is provided through a computer power supply. The actuators and hotplate are activated by Arduino through 12v relays (12v acheived by setting relay ground as -12V instead of ground). The motor is controlled through a transistor scheme featured in the Playground (minus a resistor that seems to do nothing). The motor setup works great. Wewere able to get an actuator and the hotplate to fire individually.

Now the first problem that my group has not been able to figure out is that when we attached more than one actuator and the hotplate, the Arduino malfunctioned. Instead of running the timed program, the arduino would "fire"/activate every thing all at once, and hold it activated. We have no idea what is causing this, or how to fix it.

The second problem is that when we did fire the hotplate and actuators independently, there was an initial surge when the Arduino activated which would partially fire everything, then run the program. W/ the hotplate, no big deal, but we can't have the actuators fire before they are intended to. Upon further research, we found the schematic for connecting relays to an Arduino (can be found in the playground) and realized we should not connect the arduino directly to the relay. We assumed that this would fix our "surge" problem, but our attempt to implement had horrible results. The first transistor we used was somewhat large(had no idea how big the transistor should be), but nothing got activated/worked at all using it. I was not sure if it was broken, or too big so I went to Radioshack and got a bunch of smaller transistors. We connected those, and after a few seconds the transistor started smoking. Tried a slightly different version and that transistor lit on fire. The worst result however was that our Duemilanove was toast... Would not run any code, not even blink.

We've just got a new Uno, but do not want to destroy it as well. Any suggestions of what is going on with the two problems?

A schematic of how we connected relays to try and fix the surge:
Edit: won't let me post any links w/o having posted before. I can provide a link to the schematic if needed.

Sorry for the marathon post, just want to be descriptive. Have more schematics if needed.

Ouch. It sounds like you might have your Arduino output pin connected through a (burning) transistor and a relay coil to -12V. I can imagine that would definitely smoke the CPU. Hope the relay wasn't miswired, giving you AC line voltage into your control circuit...

The Arduino output ports can supply up to 40 mA current and that's it. Not enough to drive anything but a very small relay, so normally you use a power transistor to drive the relay coil, making sure the transistor is rated to handle whatever current is needed. If you have big currents or big voltage drops across the transistor, you may need a heatsink too. Anyway, it's hard to say anything without looking at your schematic.

http://cid-186af0c23833c8cd.office.live.com/browse.aspx/Public/Relay%20Schematic?uc=1

Click on the "Arduino Surge Solution" PDF.

The Arduino is only supposed to switch the relays on/off. Does so fine with just one, but when we have more than 1 actuator connected... Arduino starts to fritz.

You need to have a resistor from the Arduino to the base of the transistor else there will indeed be excessive current flow and things will start to smoke. The resistor size depends on the amount of current you are switching (and the transistor) but I don't recommend anything below 220 ohms.

I'm also concerned about your relay driving system...it sounds dangerous too for the Arduino. Do some more careful research on how to interface with these high-current devices else there will be more smoke in your future.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Ok... maybe I just don't understand that circuit. You should have a resistor in series with the base of the transistor, but even if you don't, I would be surprised if that alone would cause the smoke.

I assume the large rectangle with 30,85,87a,86,87 labels is your relay. I assume the coil is between pins 85 and 86. I assume further that "-12V Reference" is really your +12V power supply...? What is the 87a pin going to ground, is this an opto-isolated relay, or solid state AC device (eg. triac)? A standard SPST mechanical relay would not need a ground connection, just four pins: two for the coil (driven by your transistor), and two for the relay contacts to supply power to your heater element, actuator, etc. Ok, well if you have a SPDT relay, and are switching your actuator input between +12V and GND, then that would make sense.

Anyway, if that really is -12V relative to ground as you labelled it, you've got trouble! An NPN transistor should have the collector voltage larger than the emitter voltage to be forward biased. (See that transistor emitter pointing down to ground? That indicates a NPN transistor, and the arrow shows the way current is supposed to flow). If what you have drawn is the true hookup, you have connected your Arduino pin to -12V through one diode drop (transistor base->collector junction) and that would explain the smoke.

After replacing your transistor, and your Arduino, please use a +12 V supply instead of -12 V. Also please use a series resistor, say 240 ohms between the Arduino and your transistor. That will limit the current into or out of the CPU pin, and even if you hook it up wrong, at least you will probably avoid serious damage to the Arduino. Unless you plug the CPU pin direct into the AC wall outlet...

That is negative 12volt on the relay. Yes, 85 and 86 are the coil pins. the reason we have tried connecting the device this way is because we see no other way to activate a 12 volt relay with the 4 to 5 volt outputs of the arduino. using the negative 12 volt (instead of ground) provides a 16 volt difference across the coil of the relay.

if anyone has any idea how to activate a 12 volt relay with an arduino, please let me know!

The usual circuit is here:

the relay coil supply shown need not be the same as the arduino 5V supply

PS: as shown i your schematic, I think the kickback-preventing diode is backward if your coil supply is really negative...

I'm suspecting the -12vdc is your problem and your kickback diode is wrong. The transistor is most likely fried since you don't have a base resistor.

Since you're working near AC circuits I'd recommend an optoisolator to drive the transistors or go with solid state relays for anything controlling AC. There are several SSR's that can be driven directly off an Arduino digial pin, the rest can be driven with a properly wired transistor at with +5V collector voltage and a current limit resistor.