Miniature, Precise ADC (2-2.5V) with Vref- Utilization (PIC16F1824) - space constraints, I2C

For general Flowcode discussion that does not belong in the other sections.
Post Reply
VIDEOMED
Posts: 26
http://meble-kuchenne.info.pl
Joined: Fri Dec 11, 2020 8:21 am

Miniature, Precise ADC (2-2.5V) with Vref- Utilization (PIC16F1824) - space constraints, I2C

Post by VIDEOMED »

Hello,

I'm planning to build a miniature, precise ADC to read voltage from a voltage probe. The measured voltage range is between 2-2.5V. I want to achieve the maximum possible conversion accuracy, so I would like to use the Vref- reference voltage. Due to space constraints, I want to avoid using operational amplifiers. The conversion result will be transmitted via I2C.

I'm considering using the PIC16F1824 microcontroller or another similar one with a smaller number of pins.

My questions:

How can I configure a macro in Flowcode to correctly utilize Vref- to narrow the ADC measurement range and increase its accuracy?
Is the PIC16F1824 a suitable choice for this task, or do you recommend another microcontroller with similar capabilities but a smaller number of pins, with built-in I2C interface?
Given the space constraints, what other methods can I use to improve measurement accuracy without using operational amplifiers?
Are there any ready-made examples or Flowcode libraries that I can use as a starting point for this project, especially in the context of Vref- configuration and I2C communication?

I would appreciate any guidance and suggestions.

Thank you in advance for your help!

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: Miniature, Precise ADC (2-2.5V) with Vref- Utilization (PIC16F1824) - space constraints, I2C

Post by medelec35 »

Hello.
There are a lot of factors to be taken into account.
E.g number of pins, oscillator frequency, age of the device, availability, cost, available peripherals.
Those are the factors only you can decide on.
If you look at the Supported Targets page to see what is supported by Flowcode
Within the potentiometer you can select the VRef option.
Depended on selected target device, will give you different options.
E.g with the device you asked about you will only get to choose VDD or a pin.
With the latter you will need to set up your own voltage using a resistor potential divider, precision reference, zener diode etc.
With devices like 16F15324 there will be an additional FVR (Fixed Voltage Reference) which uses an internal fixed voltage reference.
Martin

chipfryer27
Valued Contributor
Posts: 1528
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 353 times
Been thanked: 549 times

Re: Miniature, Precise ADC (2-2.5V) with Vref- Utilization (PIC16F1824) - space constraints, I2C

Post by chipfryer27 »

Hi

As a quick follow on from above, depending on your chip you can also set registers directly to enable + / - references. Datasheet would give details.

Regards

VIDEOMED
Posts: 26
Joined: Fri Dec 11, 2020 8:21 am

Re: Miniature, Precise ADC (2-2.5V) with Vref- Utilization (PIC16F1824) - space constraints, I2C

Post by VIDEOMED »

Thank you very much for the comprehensive answer! I understand that the choice of microcontroller depends on many factors. The information about the available Vref options depending on the model is very helpful to me.

I noticed that the PIC16F15324 with built-in FVR might be a good solution. Could I please ask for a simple example in Flowcode showing how to configure the ADC using FVR? Such an example would greatly facilitate my project start.

Thank you again for your help!

VIDEOMED
Posts: 26
Joined: Fri Dec 11, 2020 8:21 am

Re: Miniature, Precise ADC (2-2.5V) with Vref- Utilization (PIC16F1824) - space constraints, I2C

Post by VIDEOMED »

Following the advice I received earlier, I've been looking into using the PIC16F15324 for my miniature precision ADC project (2-2.5V range). However, I've discovered that this microcontroller does not provide the Vref- option, which I need to precisely narrow the ADC's measurement range.

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: Miniature, Precise ADC (2-2.5V) with Vref- Utilization (PIC16F1824) - space constraints, I2C

Post by medelec35 »

hello.
VIDEOMED wrote:
Wed Mar 19, 2025 12:08 pm
I've been looking into using the PIC16F15324 for my miniature precision ADC project (2-2.5V range). However, I've discovered that this microcontroller does not provide the Vref- option, which I need to precisely narrow the ADC's measurement range.
The 16F15324, does have FVR, but it requires a line of C code to set up the ADC so that ADC of 1= 1mv, ADC of 600 = 600mV etc up to 1023 = 1023mV
FVR 16F15324.png
FVR 16F15324.png (281.52 KiB) Viewed 1110 times

I will add the information to the Wiki, add a working example, then I will post the link.

What component are you using to read the ADC value, LCD, UART?

I you upload your project showing the ADC value being read, I can use the same components for the demo file.
Martin

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: Miniature, Precise ADC (2-2.5V) with Vref- Utilization (PIC16F1824) - space constraints, I2C

Post by medelec35 »

I have added details on setting the FVR here

The issue is 2.5 max is out of range for FVR of 1.024V and 2.048V
Thinking about it you have two choices.
Set FVR to 2.048V and use a precision resistance potential divider to change 0 to 2.048V to 0 to 2.5V
Or use an external voltage reference of 2.5V connected to the + Vref pin and set the potentiometer properties to Vref+
Martin

chipfryer27
Valued Contributor
Posts: 1528
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 353 times
Been thanked: 549 times

Re: Miniature, Precise ADC (2-2.5V) with Vref- Utilization (PIC16F1824) - space constraints, I2C

Post by chipfryer27 »

Hi

Possibly a stupid question, but are we sure his input range of 2 - 2.5v is with respect to 0v, or is it that (admittedly unlikely) the voltage range to be measured is only 0.5v (2v min - 2.5v max)?

Depending on ADC resolution, noise may be a factor especially with Mains derived power. 2.5v with the 10-bit resolution of the 1824 gives roughly 2.4mV.

Microchip (as others) have numerous reference chips such as the MCP1502T-25E/CHY available from the usual suppliers such as Farnell.

Regards

Post Reply