This is my first post and it is a long one; please bear with me :P I searched the forums for this kind of problem; most of what I found were threads where folks had issues with their code or had stuff wired up wrong. So I am going ahead and posting. Apologies in advance if it turns out I did a poor job of searching.
First the background info. I have an Uno r3 with 8 relays and two buttons attached to it. Here is a picture; it is kind of big:
I wrote a simple sketch that works like this. When you press and release the green button, the first relay activates (the coil energizes). Push and release it again and the next relay is activated, and so on until all 8 are activated. The red button deactivates them in reverse order. Here is the sketch:
The relay boards are these:
They are pretty nice; there is a flyback diode on each relay and also each relay is transistor-activated. Normally these relays pull 71.4mA per Songel's (the relay OEM) specs; with the transistors they only pull about 1.8 mA (I measured current going to the signal pin of an activated relay). When measuring current going to the breadboard from the Uno I saw that one relay accounted for about 70mA so that verified the doc FWIW.
The buttons are nothing special; I am using a 10K pull-down resistor on each one.
I have 9vdc and 12vdc regulated external power supplies, these:
OK here's the problem. When I run the Uno off the USB port of my computer, I can activate all 8 relays and they will sit there activated indefinitely. Well, longer than 5 minutes at least. If I use the 12vdc power supply (no USB) and activate all 8, they will stay activated for a couple of minutes and then the Uno will reset.
While I was messing around with it I happened to touch the little flat black rectangular thing by the barrel jack…according to at least one diagram on the Internet, this is the voltage regulator? Anyway, it was HOT. So I put a thermometer on it and I saw it was over 100 degrees F. I watched it rise to about 120 and then the Uno reset. Once it came back I quickly re-activated all the relays and watched the temp rise to about 140; then the Uno reset again.
With my meter between the Uno and the breadboard I measured about 540 mA with all 8 relays activated. At the Vin pin of the Uno I measured 11.45v with all 8 relays activated. With none activated, Vin was 11.66.
So I'm well under the limit per i/o pin. I'm at a little over 1/2 amp for the whole circuit which is not excessive (I don't think). I'm supplying plenty of voltage (12v is the top of the recommended range). And the voltage drop under full load is only about 1.8%. Everything seems OK except for the voltage regulator getting hot and, of course, the Uno resetting.
Next I tried the 9v power supply. I activated all relays and checked the temperature on the voltage regulator. It got to about 123 F and held steady. No Uno reset. I only gave it about 5 minutes or so but that was long enough for a reset with the 12v adapter so there's that. But I think the circuit will run off the 9v power supply for a good long while, if not indefinitely.
For comparison, the voltage regulator stays at about 81 F when I'm running off of USB.
So my questions are:
- Why does the Uno reset when I use the 12v power supply?
- Why does the voltage regulator get so hot with the 12v and 9v power supplies, but not the USB?
- Do you think best performance using an external power supply would be had with a 7v or 6v supply? I read that you lose about 1v to the regulator. But I see 6v is the absolute minimum per the spec, and 7v is the recommended minimum.
- Or maybe I should get a good 5v power supply and wire it right into Vin?
Thanks in advance for any words of advice you guys may have.