Problem with encoder, causing resets and hot regulator

Hey guys, sorry if this has been asked before but I can't find anything by searching.

I am building a pwm lighting controller with a 328p chip, LCD display, ds1307 rtc, and a pca9685 pwm controller. Input is from a rotary encoder. Bourns PEC11R-4215K-S0024

I have built the 5v circuit, and display circuit so far, everything working correctly. I did the rotary encoder circuit last night and ran into a problem. The button works fine, but I am having issues with the rotary portion. When I turn the knob my power led goes out and the chip resets. The 5v regulator also heats up pretty drastically.

The rotary circuit is just as shown online. 10k to 5v on each of the 2 pins, with a 10k from each pin to the chip, pd2 and pd3. Center pin to ground. Also a couple .1uF ceramic caps on pd2 and pd3 to ground close to the encoder. I have verified everything matches what I can find online, at least from what I can see.

Any ideas on anything to check or look for? I have a scope if that would help. The only thing I was thinking about last night before bed was about where I'm getting the 5v from. I am tapping into the same line that the 5v of the LCD contrast pot feeds off of, I thought that maybe it could be causing some weird short or something, but not sure if that's possible.

As stated, everything worked fine before the encoder, no excessive power draw or anything. Adding the encoder circuit and turning the knob causes everything to freak out and the regulator to get really hot. Any ideas what to check or things to try would be greatly appreciated.

For sure, you have wired the encoder incorrectly and have a short to ground. Please post a circuit diagram or clear, well focused photo of your setup.

Here's the schematic and a picture of the board. I know its going to be tough to see whats going on. I thought it may have been a problem with a ground so I cut the line that leads the filtering caps to test, the ground line by the resistors that you can see, did the same thing.

The problem only happens when the knob is turned. Actually, if the knob is slightly rotated(making contact) the power LED and everything will turn off and the regulator gets very hot. If the knob is not making contact everything runs fine.

The circuit looks OK to me. The only things I can think of are a short circuit (solder blob) somewhere on your board or that one of the 10K resistors to 5V is internally shorted. I would disconnect the 5V supply line to the encoder and measure the resistance from that line to ground as the knob is rotated. If the resistance drops to near zero somewhere, that narrows the problem location down.

Thanks for the help. So for this to happen, 5v has to be going to ground. Since it happens when the knob is turned, its almost a certainty that its on either the a or b pin to 5v. Especially since everything works fine before the encoder. I'll let you know what happens when I get home and check it out.

I couldn't be certain from the data sheet, but it appears that the encoder alternately connects the a or b terminal to c (ground) as the knob is rotated. If so, the problematic short circuit (or very low resistance) has to be between either the a or b terminals and the 5V power supply. Are you sure that the resistors are 10K ohms?

Your encoder interface is way over-complicated IMO (I connect rotary encoder pins direct to inputs, with no resistors or capacitors), but it should be OK. It's hard to tell from the photo, but I suspect that one or both of your supposed 10K resistors between the encoder pins and Vcc is much lower than 10K, perhaps more like 10 ohms. Either that, or you have a short-circuit between one of the encoder pins and Vcc.

AFAIK, that's the "proper" way of hooking up an encoder, short of using a one-shot buffer. The 10k resistors from encoder terminals to input pins are there for the cap, not the pin.

Thanks for all the help guys, in the end I can attribute the problem to stupidity/blindness. When I was placing the 10k resistors to 5v, I was using the extra pin material to help create traces. Apparently the long pins from the other 10k resistors were bridging the gap between the 10k->5v resistors, essentially taking those resistors out of the equation. Clipped off the extra material and it works great.

Also had a problem with the DS1307, but I was able to trace that out to a very tiny gap at a solder joint. So the controller is finally up and running.