Using the capacitive measurement setup from here I will try to make project for measuring the fluid (water) level by measuring the capacitance.

I found on my desk the “TANK” – plastic empty candy box. Then put two stripes of self adhesive aluminum foil on the two sides of the box and measured with C-meter the tank empty and full with water.

The empty TANK capacitance was 12 pf:

the full with water TANK had 79 pf capacitance:

pretty good difference so using the same schematic with measurement of the charging time I set in the previous project I ran the same code:

10 PIN(1)=0 ‘sense pin will first pull the capacitor to GND and discharge

20 A=0 ‘accumulator

30 FOR I = 1 TO 1000 ‘measure 1000 times and average to remove noise

40 SETPIN 1,8 ‘discharge the capacitor

50 SETPIN 1,1 ‘start charging

60 A = A + PIN(1) ‘accumulate the readings

70 NEXT I

80 A = A / 1000 ‘now divide by 1000 to normalize the result

90 PRINT A ‘let’s see the result

100 GOTO 20

and got 3.14 value for empty and 2.34 value for full tank measurement.

we can scale these measurements for instance 0-100% by this formula

FULLPERCENTAGE = (3.14-A)/0.008

and as DM-BASIC arithmetic is with float points we will get easy the measurement in % from 0 to 100.

Now let’s make graphical presentation of the tank:

10 PIN(1)=0

20 A=0

30 FOR I = 1 TO 1000

40 SETPIN 1,8

50 SETPIN 1,1

60 A = A + PIN(1)

70 NEXT I

80 A = A / 1000

90 PRINT A

100 CLS

110 LINE (0,0)-(210,210),1,B

120 LINE (5,205)-(205,205-2*(3.14-A)/0.0078),1,BF

130 GOTO 20

With this code we display on the screen the TANK and the fluid level in it.

This is link to video which show the tank level metering in action -> LEVEL METERING

### Like this:

Like Loading...

*Related*

## Recent Comments