PIC16F690 - Output Pin Rippling at High Level - Page 1
Forum section: electronics / general

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 05, 2011, 11:53:54 am
content: i programmed 2 output pins of the mentioned pic, pin 1 is (yellowtrace below) to output some pwm signal, and the other one, pin 2 (bluetrace) to be high at some point to act as Vref for adc's reading using trimpots, and switches (normally grounded) all of them using 10K ohm current limiting resistors. i dont think current draw will be too much from my calculation/estimation. the pic Vdd (3.3V) got smd capacitor nearby as V stabilizer, but unknown capacitance. you can see in the picture, the pin 2 (blue) is rippling but pin 1 (yellow) is ok. i dont think its because the inadequate capacitance of the unknown capacitor since pin 1 is ok. is there any other possible cause for this rippling?

author: deephaven
author_rank: Frequent Contributor
timestamp: October 05, 2011, 12:01:26 pm
content: Pin 1 looks a bit low in amplitude, is it being loaded?Try touching another capacitor between VDD and VSS to see if that has any effect on the ripple.

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 05, 2011, 12:33:00 pm
content: Quote from: deephaven on October 05, 2011, 12:01:26 pmpin 1 is connected to a transistor's base driving something. in between the transistor and pin 1 is a led and 2K ohm resistor. i was probing between the led and resistor (ie the led's lead (anode) closest to pic). so resistor is between the probe and pin 1, maybe a voltage division going on there, but i'm not sure, bugging me a bit though, but not as much as the pin 2. its quite hard touching with finger in that area, the pic and cap and ground plane below it is very small area, outside the pic perimeter are just another traces connecting to other pic's pins. and both my hand are occupied while trying to get this signal (by button press and holding to something). i'll see what i can do.i dont think (but i'm not sure either) that my poor board layout (pin signal running next to power supply line, poor grounding knowledge, poor diy etched pcb etc) cause this since this is just low speed circuit. pin 2 is probed directly (no component in between) but there's diy via there (soldered strip of wire from top to bottom through diy drilled hole)

author: amspire
author_rank: Super Contributor
timestamp: October 05, 2011, 01:44:36 pm
content: If it was a supply decoupling problem, you would see problems on both traces.Above Vdd-0.7v, the pullup is very weak, and at 3.3V out, pin2 would probably have very high impedance. So when you attach a probe to it, the probe acts as an antenna. If you add a 10K resistor (or 100K) from pin 2 to Vdd or Vss, the waveform will probably look a lot better.Richard

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 05, 2011, 05:42:44 pm
content: Quote from: amspire on October 05, 2011, 01:44:36 pmit is power supply coupling problem, i've probed directly into pin 1, its the same rippling pwm. power supply is using 12V small 23A battery, stepped down to 3.3V usingLTHT7333 ldo-vreg. the 3.3V supply is rippling. i'm working on it. i think its lacking the input coupler. its late will continue tomorrow. thanks guys for the thought. theLTHT7333 max current is 150mA, do you think this is enough for the pic general purpose?

author: metalphreak
author_rank: Frequent Contributor
timestamp: October 05, 2011, 08:21:02 pm
content: I think AcHmed99 has nailed it. I've seen similar output issues from an LM1117 that was just on the verge of thermal cutoff. You get very short bursts of cutoff at the start (so the voltage looks like a ~98% duty cycle square wave) which coupled with the supply capacitors gives you the ripple you are seeing. Easy test is to see how hot the regulator is gettingJust be careful not to burn a fingertip!

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 06, 2011, 04:45:56 am
content: sorry typo error, its HT7333, not LT

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 06, 2011, 05:56:28 am
content: i need a big 10uF cap on the small sot32 HT7333 output to avoid rippling, but still the signal will gradually moved down creating trapezoid shape instead of square. smaller or equal than 1uF (biggest cap in smd i have) will still rippling. what a bluff!HT7333 datasheet:http://www.datasheetcatalog.com/datasheets_pdf/H/T/7/3/HT7333.shtml

author: deephaven
author_rank: Frequent Contributor
timestamp: October 06, 2011, 07:58:30 am
content: Quote from: Mechatrommer on October 06, 2011, 05:56:28 amI had a situation the other day with a similar regulator but a different make. I had 10uF ceramic decoupling capacitors on the input and output but it's output had oscillations on it. I found that if I put a 10uF Tantalum in place of the original output capacitor, it fixed the problem. I can only think that the chip didn't like the low ESR of the ceramic capacitor. Depending on clock frequency, I can't imagine your PIC taking more than a few milliamps. So do you have anything else running off that supply that would take much current? If not, I can't see dissipation being a problem.

author: metalphreak
author_rank: Frequent Contributor
timestamp: October 06, 2011, 09:20:40 am
content: As with most LDO regulators, the TPS73xx family requires an output capacitor for stability. A low-ESR 10-µFsolid-tantalum capacitor connected from the regulator output to ground is sufficient to ensure stability over thefull load range (see Figure 42). Adding high-frequency ceramic or film capacitors (such as power-supply bypasscapacitors for digital or analog ICs) can cause the regulator to become unstable unless the ESR of the tantalumcapacitor is less than 1.2 ? over temperature.This is from a TI datasheet for a similar part.

author: Simon
author_rank: Unknown
timestamp: October 06, 2011, 12:00:34 pm
content: your ripple is at 5 KHz what is the PWM frequency ?

author: ChrisKiwi
author_rank: Contributor
timestamp: October 06, 2011, 12:20:19 pm
content: When you refer to pin 1 and pin 2 what Ports.bits are you referring to as physical pin 1 is VDD. Some Port bits are not designed to drive loads (usually RA3) and can only be used as Input.

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 06, 2011, 12:25:04 pm
content: i'm not sure about current consumption, hard to measure on that circuit and the signal is not continuous, only on some occasion and button press, the signal only alive for 20ms and the mcu will go sleep. but from my rough calculation, its should only few tens mA max. most other power is retrieved directly from the 12v battery. tantalum or any other through holes are not tolerated, space not allowing. maybe i just live with the ripple or find replacement for the vreg which is sot-89-a pin compatible. any suggestion that needs only like 1uF coupling cap?while quick tinkering and snap shot 8 hours ago, iirc:1st pic:10uF at vreg inputweak battery2nd pic: 10uF at output and/or both? cant rememberstrong batterybut thats using electrolytic cap... through hole... not accepted@simon: its actually serial data like.. 10kbps... so, taking hi and lo as complete circle... its 5KHz fundamental, a coincidence? but when the signal is turned off, i still can see the supply ripple to infinitum (out of scope view), havent snap the screen for that, but can assure you it is.@chris: its arbitrary assignment. to be precise, pin 1 is rc0, pin2 is ra0 on pic16f690. both set as output

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 06, 2011, 12:37:16 pm
content: just re-rough estimate the current is 8mA something, lets just say 20mA, still way below the ht7333 spec, so its coupling problem.

author: ChrisKiwi
author_rank: Contributor
timestamp: October 06, 2011, 01:11:18 pm
content: Quote from: Mechatrommer on October 06, 2011, 12:25:04 pmAccording to my datasheet pin 1 is VDD and pin 2 is RA5. RC0 is pin 16 and RA0 is pin 19. But since neither is RA3, my original post would not apply. Are you using #define RC0 pin1 // or something like this if you were doing it in C or to put it another way are you assigning a variable "pin1" to RC0 ?

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 06, 2011, 04:36:04 pm
content: Quote from: ChrisKiwi on October 06, 2011, 01:11:18 pmi will be a hero if i can output PWM out of Vdd pin.i dont assign or define it. pic is a mess when you want to set a pin in assembly (TRIS, PORT, PIN).

author: ChrisKiwi
author_rank: Contributor
timestamp: October 07, 2011, 03:32:08 am
content: Quote from: Mechatrommer on October 06, 2011, 04:36:04 pmSo you are programming in assembly, I didn't pick up on that fact. When you referred to pin 1 I took that to mean physical pin1 on the actual IC which, as you point out, can't output PWM as it is VDD. The only time I use assembly is when I really really really have to. Anyway the problem seems to be solved so that is the main thing.

author: metalphreak
author_rank: Frequent Contributor
timestamp: October 07, 2011, 09:44:56 am
content: If you can't use through hole components I guess you must only be using SMD components?Tantalum caps are available as small as 1206 (3216 metric) "Type A" case. Plenty of surface mount aluminium electrolytic caps available as well that aren't too hard to solder.