PIC_VOLMETER

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Louis McIntyre
Posts: 10
Joined: Thu Mar 30, 2006 3:23 am
Location: USA
Has thanked: 2 times
Contact:

PIC_VOLMETER

Post by Louis McIntyre »

I’m trying to change the calculations in example (F88_ TUT_26) to read from 0 to 5 volts, my intentions are to create a voltmeter/Amp meter. Anyone have any ideas how to do these conversions

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Post by Steve »

This depends on how accurate you want to be, but here's a suggestion:

If you assume the ADC value of 1023 to be equivalent to 5V, then an ADC value of 41 equals 0.2V (which may be accurate enough for your needs).

You could then enter a loop that did something similar to the following:

1) Subtract 41 from the LO ADC value
2) If this took the LO value under zero (i.e. your new LO value is higher than the old LO value), take 1 from the HI value
3) Each time you take 41 from the LO value, increment your 'volts' value by 2
4) Do this until the HI value is zero and the LO value is taken below zero

Your final volts value will approximate the actual voltage times 10. That is, if your volts value = 24, this would represent a voltage of 2.4V.

You could perform a similar loop and gain more accuracy - e.g. take 4 each time from the LO value (instead of 41), and each time your 'volts' value became a multiple of 10, increment an 'offset' variable by 1. Once the loop has finished, add the final 'offset' to 'volts'. Each digit of this final value would represent 0.02V.

Alternatively, you may find it easier to perform suitable arithmetic on the actual ADC values, but be aware that you will be working with 8-bit values.

I hope this sets you in the right direction.

Louis McIntyre
Posts: 10
Joined: Thu Mar 30, 2006 3:23 am
Location: USA
Has thanked: 2 times
Contact:

PIC_VOLTMETER

Post by Louis McIntyre »

Hi, Steve Tandy thanks for the quick reply.

I built two prototype circuits with PIC_16F877A.
Prototype 1, firmware: subtracts 41 from the LO ADC value.
Prototype 2, firmware: subtracts 4 from the LO ADC value.

The objective is to measure the voltage across a lithium Battery that have a 560 ohms load

Fluke 87-multimeter voltage measurement: 3.54 volts.

PIC_VOLTMETER Measurements
Prototype 1, measured voltage: 2.94. Volts approx.17 percent.
Prototype 2, measured voltage: 3.15 Volts approx. 11 percent.


Steve you and Ian may reply but I would rather challenge flowcode users
To write the firmware using flowcode, prototype the circuit and let’s know
How accurate your PIC_VOLMETER measures voltage.

Power Supply voltage:
I’m using a 7805 CT voltage regulator.
Power supply voltage 4.951 volts (fluke 87 multimeter)

Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times

Re: PIC_VOLMETER

Post by Steve001 »

I too am intereted in volt/ammeter designs found this on microchip site if any good

http://www.microchip.com/stellent/idcpl ... e=en011048

steve
Success always occurs in private and failure in full view.

Louis McIntyre
Posts: 10
Joined: Thu Mar 30, 2006 3:23 am
Location: USA
Has thanked: 2 times
Contact:

Re: PIC_VOLMETER

Post by Louis McIntyre »

Thanks Steve, this is good information
This will be my first Pic_flowcode project for 2009 “I will let you know how it workout”
Happy New Year All

Post Reply