PIC16F877a Voltmeter and Ammeter problem

Status
Not open for further replies.

Electrojosh86

Member level 3
Joined
Jun 20, 2013
Messages
67
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
570
Hello, I was wondering if I could receive some help with this circuit. I built one of these panel meters for a power supply that I had built and there seems to be a minor problem. When it reads current and voltage the display ,or at least the digits on the LCD, flicker when the digits change and they seem to change value all the time even if the voltage and current are constant. I was wondering if there is something wrong with the circuit, code or maybe I did something wrong like the power going to the meter. Noted that the power that is supplied to the meter is not the same supply that is being read. Uses a different transformer completely. Also, I know the schematic does not include the frequency of the crystal but I am using an 8 Mhz. Thanks for the help or advice.
 

Because the circuit uses the 5V as the reference for the ADC, it is sensitive to any noise on the 5v rail. Try connecting a 1000uF capacitor across the supply, does it improve it? I assume that you are using a ripple free well regulated 5V supply.
 

No, I actually do have caps on the 5v rail. I do believe it is are 1000uF. What's the best way to reduce ripple besides large caps? Should be noted I tried using a battery for the PICs supply but still have the same issue. Also, the reading are correct on the LCD just the jumping around is frustrating
 

Electrojosh86,
Are you reading the voltage once and updating value on the LCD immediately? You may have to implement a software filter like moving average filter(it is basically equivalent to RC low pass filter which is easy to implement) to smooth out the small variations of ADC values and also, updating the LCD for every 500ms to 1 second must be okay.
The flickering may be because if the ADC value for the corresponding voltage is a fraction like 250.4999, your ADC register reads 250 sometime and 251 the other time.

Raj Gunaseelan
 
Last edited:

Is it just the Voltage reading that is changing or is it the current as well? The resistors values are to high in value for the voltage divider, try 50K and 10K. I have built a similar circuit and I have found the PIC ADC 10 bit A-D conversion to be noise free, so the problem is with your circuit. Have you put a 0.1UF ceramic capacitor directly across the PIC supply rails? If not, do so. Is the voltage/current you are trying to measure stable? try using the PIC to monitor its own 5V supply rail (use a divider with a impedance of less than 10K) .
 

Do you perhaps have the schematic for the similar circuit you have constructed. And perhaps the HEX? When I get home I'll implement the changes to the circuit to see if that stabilizes it. I tested the pic meter with a 9v battery to the divider and it still was going crazy on the LCD. Would you say the 50k to the pin and the 10k to gnd? Or reverse?
 

The PIC data sheet states "The maximum recommended impedance for analog sources is 10 kΩ" So you should make R1 10K R2 2K and R3 10K. The circuit as shown uses a 100K impedance. You may get away with a higher input impedance than 10K with a longer acquisition time , but you may also get the readings change on each sample. The disadvantage of reducing the resistor values is the loading of the circuit you are trying to measure. Try it and see.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…