PDA

View Full Version : Measuring voltage



champion
- 15th November 2006, 16:16
This may seem like an elementry question for most of you, but I am new and I have not been able to find a definitive answer by using the search function. I am simply looking for a way to measure voltage 0V - 5V using a PIC16F84A and display it on an LCD. I can display things on the LCD, but when I try and display an input voltage on one of the pins I get either a high(1) or a low(0), not a specific voltage. Is there a way to do this with just the PIC??? Thanks in advance.

rhino
- 15th November 2006, 17:21
Without A/D you can try POT or RCTIME commands, but your better off going with a pic with A/D functionality. Probably cheaper than your PIC16F84A! Another option is an external A/D chip.

champion
- 15th November 2006, 20:50
Without A/D you can try POT or RCTIME commands, but your better off going with a pic with A/D functionality. Probably cheaper than your PIC16F84A! Another option is an external A/D chip.

I have been using the pot command, but it is very erratic. BTW, I'm only using the 16F84A because I had it laying around from my mechatronics class in college. Thanks for all the help.

mister_e
- 15th November 2006, 21:07
i have those laying on my Pin Board :D

It's also a good Staple replacement!

Dave
- 15th November 2006, 22:14
champion, what are the values you are using for the pot as well as the capacitor when using the POT circuit?

Dave Purola,
N8NTA

champion
- 16th November 2006, 01:21
I am using a 10k pot with a 0.1uF cap. Its a poly capacitor too. And a 5V regulator.

Dave
- 16th November 2006, 12:47
champion, The values you are using look good and as long as you are not tying one end of the pot then you should be good to go. Does the pot you are using have any dead spots? I would check it with an ohmeter and verify it doesn't.

Dave Purola,
N8NTA

Melanie
- 16th November 2006, 13:08
You may have to scale your POT command... for 10K and 100nF try...

POT Potpin,95,MyVar

The above is usually good for the same junk Y5 type 100nF Capacitors I sprinkle around for decoupling.

Acetronics2
- 16th November 2006, 13:24
Hi, Champion

DO NOT use POT for quite precise measurements ... doesn't worth ANYTHING.

( Just good to make a 2 Wires 16 Keys Keypad ... or 16 positions switch !!! )

The first bearable approach for measuring is to use RCTime, but you WON'T measure 0 - 5v

Only 1.5v - 5v ... due to the Pic Inputs.

With cap tied to Vcc and R tied to ground, you should have ~ T = 1.2*R*C ... !!!

Think to let enough time for the capacitor to be fully charged before measuring ...

If really precise measure ... think to ADC 831 ... or easier, 16F684,688,819 or ...16F88


Alain