Week two of spending all my free time trying to solve this, but I'm trying to stay persistent and keep my head down :/
This is a followup to what I learned in: http://forum.arduino.cc/index.php?topic=310381.0
Essentially, I have eliminated a lot of the voltage drop I was experiencing by moving my whole circuit to a small perfboard. No breadboards are being used any longer.
However, as I'm just trying to wire things up to get my power switch for the project working, I'm getting some awful flicker that goes away if I remove the 1N4001 diode shown at Vin:
Here is my reasoning for the circuit you see above:
I want to be able to tell when the 7.5V external voltage is present and powering the lights so I can consider the system "on". I initially had just NC on the power switch wired to Pin 43 (INPUT_PULLUP) on the Mega. When that pin went high, I knew the user flipped the switch. At that time, I'd bring pin 42 high to light the LED and indicate the system is on. (That LED has an internal resistor, that's why there isn't one indicated)
The problem with this was, it just detects the switch was flipped, not that the 7.5V DC is actually present at Vin. So, I added the turn pot voltage divider to 7.5DC, and set the resistance so that I would get slightly less than 5V out of it when the 7.5V is on. I connected this to Pin 41. (The voltage divider was because I had read an earlier post that you shouldn't read voltages higher than the supply voltage.)
I reasoned then that if Pin 41 was high, 7.5V was present. If Pin 43 was high, the switch was definitely flipped. I'd consider the system on iff these conditions were true. (The nice thing about using Pin 43 on the NC of the switch is that if you just try to use the voltage divider, when the power is switched off some current still drains out of the power supply caps and the so pin 41 would read high for a few moments. By anding these two conditions, you get a nice clean off when the switch is flipped off)
You'll notice there is a diode at Vin on the Mega. That is because when the Mega is plugged in to USB, some voltage ~4V DC is present at Vin. I wanted to prevent that voltage from going through the divider and to pin 41, because then the system would seem on when USB was plugged in, and I only want to consider on 7.5DC is present.
As far as sensing the system on, this all works great!
The problem is, I get this horrible flicker when controlling the 9 RGB LEDs that the 7.5DC is feeding when I have that diode at Vin! If I remove the diode, the lights work PERFECTLY, but now pin 41 isn't as useful for cleanly detecting system on.
What on earth is that diode doing that is causing this awful flicker?
-- I am switching ground on the power switch, connecting the regulator ground to Arduino ground when the system is on. I did this because I am using NC to sense the switch position. If I had 7.5DC on common, I'd have to use a few extra components to get it down to 5V so I could read it on the pin 43. Switching ground just saved me a few components
-- I am going to now try removing the diode and seeing if I do use an analog pin instead of pin 41, if I can reliably tell the difference between the 4 something V leaking out of Vin and the 7.5 from external. I'm concerned though that since there is still a little voltage drop from turning the lights on, I might not be able to find a good reliable threshold to consider "on"