Thank you everyone for your suggestions. I had the exact circuit described below, but it suffers a lot of variation from unit to unit and also under different temperature. I will try a new circuit that Olin suggested. Will let everyone know the result. Regards, Thomas >From: Russell McMahon >Reply-To: pic microcontroller discussion list >To: PICLIST@MITVMA.MIT.EDU >Subject: Re: [EE]: Cheap voltage detector circuit >Date: Thu, 10 Apr 2003 16:11:42 +1200 > > > I am running the PIC on 5V power supply (using the LM7805 regulator). I > > want to be able to detect the input voltage of the LM7805 when it falls >down > > to around 6V. I don't have any ADC port left on the microcontroller. >All >I > > have is a digital input. My goal is to build the simpliest and cheapest > > circuit possible. Maybe with one transistor and few resistors. Do you >have > > any idea? Thank you in advance! > >Small npn transistor. >Emitter to ground >R1 from Vin to base. >R2 from base to ground. >Collector to PIC pin. >Pullup resistor (say 100k) from pin to Vdd or internal pullup on. > >When voltage in is such that Vin x R2/(R1+R2) is more than 0.6 volts or so >the transistor will be on and its collector will be pulled low. > >eg for R2 = 10 and R1 = 100k the transistor will be turned on for Vin > >ABOUT 6.6 volts >Vary R1 and or R2 to suit. > > > RM > >-- >http://www.piclist.com#nomail Going offline? Don't AutoReply us! >email listserv@mitvma.mit.edu with SET PICList DIGEST in the body _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body