measure 2000 letter tank with 1 letter resolution?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
imtiaz9
Posts: 15
Joined: Sat Aug 10, 2013 7:16 am
Been thanked: 1 time
Contact:

measure 2000 letter tank with 1 letter resolution?

Post by imtiaz9 »

I need to measure 2000 liter water tank level with 1 liter resolution, with using 10bit internal ADC of PIC device. but it give me 2 liter resolution per increment. is there any possible way for it? or i need to use 12bit external ADC?
Attachments
Flowcode1.fcf
(8.5 KiB) Downloaded 203 times
Last edited by imtiaz9 on Sun Oct 22, 2017 3:43 pm, edited 1 time in total.

Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: measure 2000 letter tank with 1 letter resolution?

Post by Docara »

Hi

You mean litre! Not letter.

This is not a Flowcode issue necessarily, this is a sensor issue.

When you have researched which type of level gauge you will be using we can help.

Matt

imtiaz9
Posts: 15
Joined: Sat Aug 10, 2013 7:16 am
Been thanked: 1 time
Contact:

Re: measure 2000 letter tank with 1 letter resolution?

Post by imtiaz9 »

yes this is liter :D
sensor i use is a liner float sensor give 0 to 5v liner output. A 10k potentiometer rotate with float and it give 0 to 5v on adc pin.
i think sensor is ok the problem is in software. i think a 10bit adc max reading is 1023 and it sense 1 liter every 1.9 liter (2000/1023=1.9). am i right?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: measure 2000 letter tank with 1 letter resolution?

Post by Benj »

Yes your working out sounds correct to me. There are some microcontroller devices with internal 12-bit ADCs available which should help.

Do you need absolute 1 litre accuracy could you not simply drop the decimal point to give the illusion of having 1 litre resolution. Most steps would jump up 2 litres but some would be 1.

1 ADC bit = 1.9 litres

0 = (0 x 1.9) = 0 litres
1 = (1 x 1.9) = 1 litres
2 = (2 x 1.9) = 3 litres
3 = (3 x 1.9) = 5 litres
4 = (4 x 1.9) = 7 litres

Also think about your sensor, how accurate is that?
How have you got rid of the noise in the system? A 10-bit and especially a 12-bit ADC will be very susceptible to noise.

imtiaz9
Posts: 15
Joined: Sat Aug 10, 2013 7:16 am
Been thanked: 1 time
Contact:

Re: measure 2000 letter tank with 1 letter resolution?

Post by imtiaz9 »

The resolution accuracy become more complicated issue if the tank capacity increase i.e. 10000 liter. The main goal is to measure the remaining tank quantity in liters. If a 10bit adc measure for example 10000 or 20000 liter quantity It jumps about 10 liter or 20 liter per increment and this is a big issue for me.
The sensor accuracy is good because it use a multiturn potentiometer to rotate with level and give very accurate reading on adc pin, that’s why I’m not using ultrasonic or etc…
Now plan to using an external 16bit adc (ad7792) to resolve this big resolution gap..
any one use 16bit with with pic device before? any example code??

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: measure 2000 letter tank with 1 letter resolution?

Post by Benj »

Looks like it should be simple enough with the 16-bit ADC. I've used the Microchip AD7680 on our EB085 DSP Input board and the code is relatively simple. The AD7792 looks like it has more going on so may need a bit more configuration before you can pull out ADC values but should be simple enough using SPI commands.

For an example look at the Read_ADC macro in this Flowcode project file. You could even export the macro and import it into your own program to save some time replicating the code.
1. DSP Audio Through.fcfx
(16.75 KiB) Downloaded 215 times

imtiaz9
Posts: 15
Joined: Sat Aug 10, 2013 7:16 am
Been thanked: 1 time
Contact:

Re: measure 2000 letter tank with 1 letter resolution?

Post by imtiaz9 »

thanks ben.. i will try

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

Re: measure 2000 letter tank with 1 letter resolution?

Post by Steve001 »

Success always occurs in private and failure in full view.

Post Reply