Go Down

Topic: Voltage Drop Followup - Diode Causing Flicker? (Read 2690 times) previous topic - next topic

syr123

Hi there,

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:


Full Size Image of my schematic

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?

(Notes:

-- 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"

syr123

Update: The second idea from my notes is no good.

If I remove the diode:

When powered off of USB only (power switch off, wall wart not plugged in), the analog read returns a value of about 917.

If turn the power switch on without having the wall wart plugged in, it reads 561. ( I assume that is because turning the switch on connects the other side of the pot to ground, thus turning it into a voltage divider rather than a resistor and cutting the reading almost in half.)

If I then plug the wall wart in, it reads 979. (I assume because my voltage divider is putting out closer to 5V than the power at VIN was, so we're seeing a reading close to the 5V the Arduino is running on)

If I have the wall wart plugged in and the power switch off, it reads 355. (No idea why - I guess this is a analog reading of 7.5DC passing through a resistor)

I am open to any other ideas of how to rearrange the circuit to solve this problem, but I'm also very curious why the diode might have been causing flicker because that makes no sense to me.

With the diode, this all worked, just I got that awful flicker.

Grumpy_Mike

#2
Mar 30, 2015, 10:50 am Last Edit: Mar 30, 2015, 10:51 am by Grumpy_Mike
You will kill your arduino by feeding 7.5V into the analogue input.
A resistor alone will not reduce voltage. The pot needs to be connected between a power source and ground, you are not doing this.

ALL GROUNDS MUST BE COMMON - you have been told this many times and yet you still keep doing it.

You loose 0.7V across a diode so you are feeding 7.5 - 0.7 = 6.8V which is a tad low for Vin. This could cause instability in the power regulator.

Do not switch the ground of the Arduino to power it. This leaves it floating when not powered, I am surprised you have not blown it up.

syr123

#3
Mar 31, 2015, 10:30 pm Last Edit: Apr 01, 2015, 08:40 pm by syr123
Ok, ok. Good points. I guess I thought since I had seen some other posts about switching ground to provide power to a system, I could choose to do that, but I understand now from your post that perhaps that's only an option when you only have a single power source, and you are switching ground, but ground is still shared and common for all elements of the circuit at all times.

I changed my schematic above and last night so the 7.5V was connected to common on the switch. In increased my regulator to output 9V DC, (the lights take 5.5V -> 9V DC) I put a voltage divider on both NC and NO and set the resistance so they'd both output about 4.9V DC and connected them to digital pins in pinMode INPUT.

I left the diode in, and measure the voltage at Vin both with the lights all on and all off, and it never dipped below 7V, so I don't suspect the problem about instability in the Arduino regulator is the issue.

Here is an updated view of the changes I made to address Mike's comments:

Changes

I am thinking of using the switch to control a relay to connect the external voltage to the lights and Vin, so I have a cleaner digital on/off indication.

Despite all these changes, I still have flicker.

I've tried putting caps across the power to the lights.

I'm going to try:

* writing a sketch that just turns the lights on and off and see if I get flicker powering the Arduino and lights completely off the external supply. The flicker seems to be somehow related to providing power at Vin. Sometimes plugging the external voltage in an Vin completely eliminates the flicker, sometimes not.

* Seeing if somehow the lights are getting to hot: reduce current? Add a fan?

* Buy a new power supply instead of using wall wart to buck converter. Maybe this:  http://www.adafruit.com/products/352


Anything else you guys can think to try? Reminder, these are Macetech Megabrites

TomGeorge

#4
Apr 01, 2015, 01:33 pm Last Edit: Apr 01, 2015, 01:37 pm by TomGeorge
HI,
Why isn't there a current limit resistor in series with the power on LED.

I find it hard to work out what you are trying to do.
 I gather you are worried about plugging you fruitpad into the arduino while it is powered by the supply that you have for the led chain.

Can I suggest a simple solution?
Take a USB cable you use to connect the fruitpad to the arduino.
Strip the cable back in the middle to expose the four wires.
Find the wire that carries the 5V from the fruitpad and cut it.
Separate and isolate the ends.
Then fix the cable in the chassis with the arduino, permanently plugged in so only way to connect fruitpad is the extended lead.

Now you have a USB cable without fruitbox 5V connectd to the arduino, but gnd and the signal wires are.


Tom...... :)
Forget all this complicated voltage sensing and gnd switching.
To tell you the truth, that switch in the gnd of  the arduino worries me.
(danger, you will loose you arduino)
Everything runs on smoke, let the smoke out, it stops running....

Grumpy_Mike

This is why you should not have started a new thread because this one does not contain the information about what you are trying to do and what equipment you have.

syr123

#6
Apr 01, 2015, 08:17 pm Last Edit: Apr 01, 2015, 08:19 pm by syr123
Yes, well, lesson learned there, my apologies. I thought people might be happier with a separate topic since I was sort of changing to talking about the power supply switch. On the plus side, I've never heard anyone call a Macbook a Fruitbox, and that made me laugh.

If you have any thoughts about other tests I could do or things to look at to eliminate sources of flicker, I'm all ears.

Here's what I'm trying:

Can try lowering current via dot correction
Can try altering latching delay in software
Can try Adafruit power supply
Can try big cap directly across supply to chain
Can try Arduino sketch without USB connection to rule out interference from USB power/gnd/data/serial

Grumpy_Mike

You are best updating the schematic so we can see if you have addressed the problems we have identified so far.
Why is that diode there anyway?
You also have no resistor in your power on LED.

syr123

I addressed that above. The resistor in the power on LED is integral. I should indicate it in the schematic, but it is built into the casing and I don't know to measure its resistance.

I posted the updated schematic above, but I will post again here. Coincidentally, I omitted the power on LED from this schematic since that part is very simple.


http://s22.postimg.org/d8ys2wk0w/image.jpg

Grumpy_Mike

#9
Apr 01, 2015, 08:51 pm Last Edit: Apr 01, 2015, 08:53 pm by Grumpy_Mike
That diode is still there what do you think it is doing? If you want to keep it in then increase your voltage on the regulator to 8.2V.

Also note there is a danger of over voltage at certain settings on those pots. That is not a good idea, best to have a fixed resistor as well to limit the adjustment you can make. 

syr123

#10
Apr 01, 2015, 09:36 pm Last Edit: Apr 01, 2015, 09:36 pm by syr123
The diode is there to prevent the USB 4~V from showing up where I'm trying to sense the external voltage. I described above that I had increased the voltage to 9V because the lights can take it and I measured to make sure the voltage drop on the other side of the diode was not too low for the Arduino.

I agree about the over voltage. If this circuit *worked* I would replace those with fixed resistors. The pots are helpful for now b/c I've been experimenting w/ 7.5V, 9V etc and I can adjust them.

Since the caps discharge out of my external supply when I unplug it, I can't cleanly detect the unplugged state, which is kind of a bummer. I do a digital read on pin 41 to look for that external voltage, but it stays high for a second after it's unplugged. I'd like to instantly turn the lights off, but maybe I'm just being too crazy about that. (This situation is made worse without the diode, because then I need to use an analog input to read that, so I can tell the different between the 4~V USB and my external voltage through the divider)

Anyway. The flicker is still the issue. Lots of people seem to report this various situations with these Megabrites, but often get it worked out one way or another. Just not sure what else to check. A friend offered to lend me a scope and logic analyzer, not sure what I'd look at with it.

syr123

Interesting that this page on a shield for the Arduino to go with these lights:

http://docs.macetech.com/doku.php/shiftbrite_shield

Mentions that the power screw terminal connects directly to power/ground on the lights to "minimize any problems that could be caused by inline diodes or thin power traces on the Arduino board"

Now, my diode is not inline I don't think, and I am also running power directly from my external V+/GND in to the lights, but I thought the specific mention of diodes and "problems" was interesting :)

Maybe they're just talking about a voltage drop across the diode and avoiding that.

Go Up