Searching \ for 'How to measure 0 to 0.24 VDC with a PIC16F877A ?' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=16F
Search entire site for: 'How to measure 0 to 0.24 VDC with a PIC16F877A ?'.

Truncated match.
'How to measure 0 to 0.24 VDC with a PIC16F877A ?'
2003\02\25@021211 by

Hi Group,

May you guide me on how to measure a source from 0 to 0.24 VDC with a
PIC16F877A ?
The 0 to 0.24 VDC is a source from a VU meter (0.24 VDC means full scale)
What I need is to measure the voltage then when it is over 0.17 VDC need to
set on a pin to drive a relay.

Any idea is wellcome.

Regards,

Augusto, OA4CVT

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu>
I think a simple non-inverting amplifer, a comparator + a few discretes is
all that's needed to achieve your purpose.

Chun Chiek
{Original Message removed}
I have some ideas, using a comparator built into the 16F877.

Get a 1.2V voltage reference unit
(http://www.national.com/pf/LM/LM385-1.2.html will do) , and divide the
voltage using resistors in serial. You'll have to use 1% tolerance resistors
for this to work well. Since you want to switch the relay when the voltage
exceeds 0.17V, I'll work on that value. the 0.17V will be 14.2% of the value
of the voltage reference. Use, lets say a 12k and a 82k resistor, the 12k
connected to ground and the 82k to your voltage reference. The centre tap
and common point for the two resistors will then be 0.153V. Connect this to
the voltage refence of the PIC, and the VU meter's signal to the positive
input of the comparator. In code then program it to trigger the relay when
the comparator triggers the Vin > Vref state. This should work.

I've never used it myself before, but the operation is rather straight
forward. You should also compensate in code for fluctuations, as I assume
you'll using the sound source for this purpose, and that is obviously a
variable signal which goes poth positive and negative in respect to ground.
But never the less, I hope this helps somewhat.

Cheers
Werner

{Original Message removed}
The Analog to Digital converter will give you 19.6 mV resolution steps
unmodified.
So you could use it to find .17647 volts or higher.
If you need finer resolution you would have to add an op-amp (Gain of 20)
and then read the result with the A-D.  That would get you .98 mV
resolution.

*
|  __O    Thomas C. Sefranek   WA1RHPARRL.NET
(*)/ (*)  Bicycle mobile on 145.41, 448.625 MHz

http://www.harvardrepeater.org

> {Original Message removed}
On Monday 24 February 2003 11:09 pm, Augusto Yipmantin - OA4CVT wrote:

> May you guide me on how to measure a source from 0 to 0.24 VDC with
> a PIC16F877A ?
> The 0 to 0.24 VDC is a source from a VU meter (0.24 VDC means full
> scale) What I need is to measure the voltage then when it is over
> 0.17 VDC need to set on a pin to drive a relay.

If you don't need too much resolution, you could just connect it to an
A/D input and read it with the A/D converter.

If you use a 5V reference (i.e. not adding any extra components), at
0.24V input you'll have 1024*0.24/5V full scale, or a reading of

well smoothed is this voltage?).

--
Ned Konz
GPG key ID: BEEA7EFE

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu>
Hi Ned,

I4m trying to "read" the voltage from a Audio Decibel meter, when the needle
of the VU meter is at middle of scale ( 0.17 V ) I need to check it for
about 30 seconds and then set any other pin to high to drive a relay for
about 5 minutes.  If the time is less than 30 seconds over the  ( 0.17 V )
no action over the relay will be taken.  Accuracy of 90% arround the 0.17 V
will be enough.
I need to read this at least one time per second from the VU meter in fast
mode (not in average mode).

Augusto

{Original Message removed}
Quoting Augusto Yipmantin - OA4CVT <oa4cvtEC-RED.COM>:

> Hi Ned,
>
> I4m trying to "read" the voltage from a Audio Decibel meter, when the needle
> of the VU meter is at middle of scale ( 0.17 V ) I need to check it for
> about 30 seconds and then set any other pin to high to drive a relay for
> about 5 minutes.  If the time is less than 30 seconds over the  ( 0.17 V )
> no action over the relay will be taken.  Accuracy of 90% arround the 0.17 V
> will be enough.
> I need to read this at least one time per second from the VU meter in fast
> mode (not in average mode).

Using the full scale from 0 - 5V would be sufficient for your case then. Since
there are 1024 steps, you will basically have a resolution of 5/1025, or
~0.005V, which is more than you required. Considering you would only be using
values from 0 - 49, you wouldn't even have to consider using the full 10-bits
of the ADC (which makes working with the registers easier since you only need
one register, the LSB - ADRESL). If you need some sample code of using an ADC
with an f877, let me know.

>
> Augusto
>
>
> {Original Message removed}
I will appreciate very much a little example code on how to handle the data
with the ADC of the F877

Augusto

{Original Message removed}
Hi Augusto!

On Tue, 25 Feb 2003, Augusto Yipmantin - OA4CVT wrote:

> I will appreciate very much a little example code on how to handle the data
> with the ADC of the F877
>
>
> Augusto

--> http://www.microchip.com
----> Application Notes
------> By Function

See the articles on DAC and also Display/LED which includes 'Four Channel
Digital Voltmeter with Display and Keyboard.' That's a full fetured app;
all you're looking for is the initialisation plus about a dozen lines of
code.

There're tons of HOWTOs out there if you learn how to find them. Google
for it too.

Have a :) day!

jb

--
jim barchuk
jbjbarchuk.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu>
Use a low offset opamp that includes ground in its input voltage range and
connect it as DC amplifier with 18k 1% + 1k 1% as feedback and 1k 1% to
ground. This should make 4.8V out of your 2.4V.

Peter

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu>
That's the basic code you need. Make sure your banking is right (I extracted
this out of a lot more code). This should be all you need tho. Result will be

movlw 0xC1           ;Select A/D on, Channel 0 (RA0) and RC Clock

Loop1

goto Loop1

retlw 0x00

Quoting Augusto Yipmantin - OA4CVT <oa4cvtEC-RED.COM>:

> I will appreciate very much a little example code on how to handle the data
> with the ADC of the F877
>