Yes, I have had this problem also with a small switch-mode wall wart that I was using for PIC testing before I had my own "real" power supply. Could not understand why the AD readings off some tempurature sensors were inaccurate and "jittery" in the first couple of bits ... until I scoped the output voltage of the wall wart that is, very noisy ;) ... After I built my own big linear power supply (2 independant 0-24V @ 15A max. in the one box), which cost a small fortune to build, weighs a lot, but sits in my rack now and for which I would never be without ... all these problems disappeared. Take this as a warning about using small, cheap, noisy switch mode plug packs/wall warts for PIC testing, especially if using AD ;) Rgs Ian -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of John Pearson Sent: Tuesday, 14 October 2003 5:36 am To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC:] Low voltage detection I had mentioned earlier that at the slowest ADC clock speed, and a couple of sucessive samplings through 10 meg ohm resristors produced somewhat flakey LSbits, after trying it in my actual battery powered circuit, the numbers are rock solid. I guess my evaluation board, powered by a wall wart with all its extra chips and goings-on, was producing a lot of noise that the resistors were picking up. ----- Original Message ----- From: "Mike Harrison" To: Sent: Monday, October 13, 2003 2:06 AM Subject: Re: [PIC:] Low voltage detection On Mon, 13 Oct 2003 09:50:29 +0100, you wrote: >> > Olin wrote: >> > A better solution would be to only turn on the divider >> circuit for a short >> > time around each reading. It can then draw more current, >> but it's average >> > current draw will be very low For situations where the battery supply is higher than the PIC's supply (e.g. 9V battery), things get complicated by level shifting. Here's a neat way round this (use ficed pitch font): Vbat | +----+ | Q1 | | | R3 \| | C1 |--+--R4--||---Vsense (ADC/Comparator input) | R2 | +-- 0V Q1 = any PNP, emitter to VBat R1,2=10K R3,4 = 100K C1 = 100n R1/2 divide the supply voltage, e.g. both 10K for a 9V supply and 5V PIC supply C1 acts as a level-shifter The 'Switch' line is normally held high, and taken low briefly to turn on Q1 for long enough to read the voltage. The 'Switch' line can often be shared with other functions. Where space is at a premium, use a digital transistor for Q1 so R3 and R4 aren't needed. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu