circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 99, October 1998
X-Y Graphing Data Logger


by Alberto Ricci Bitti

Start Machine Muscle Using Componentware Low-Power Guys Flash Risc Glue The Graphic Engine Casio Protocol Main Code Inside The Box Setting up the Casio First Graph Modeling The Data Broader Vision Software, References & Sources

FIRST GRAPH

Look at the real-world example in the sidebar "Straightening curves—Linearizing a Tank-Level Sensor." Here, a float drives a potentiometer sensing the liquid level in a 25-l, irregularly shaped tank.

I want to figure out the relationship between the sensor output and the quantity of liquid left in the tank and to gather enough data to build a model for the control processor.

The complex relationship between angle, height, and volume makes an analytical approach impractical. It would be better to measure the sensor output at known liquid quantities.

The potentiometer output is brought to input x. It’s powered at 4 V to avoid damaging the inputs.

In Listing 1, you see the simple control program that’s required. List is the equivalent of an array in the Casio world. Seq allocates the memory space for a list and initializes it. Here, two lists—one for the liquid quantity and one for the sensor output—are created and filled with data in a simple for-next loop.

Seq(N,N,0,25,1) --> List1
Seq(0,N,0,25,1) --> List2
For 1--> N To 26
  Receive(X)
  X --> List2[N]
  Locate 1,1, N
  Locate 10,1, X
While (Getkey): WhileEnd
Next

Listing 1This simple program makes 25 samples and places them in List2. Another list is filled with ascending numbers used as x-axis values on an x-y graph. List is the equivalent of an array in the Casio world.

At each cycle, 1 l of liquid is added and a measurement is taken. This process continues until the tank is full. When the program ends, the two lists hold the quantity of liquid as well as the sensor’s output level.

Even if data visualization commands could be included in the program, it is convenient to look at nonrepetitive tasks manually.

The STAT menu lets you examine the data tables. If you select the GRPH submenu and GPH1, Graph1 is then displayed as an x-y scatter graph of List1 (liters) over List2 (sensor output).

Although nonlinear, it’s immediately clear that the sensor output is suitable for measurements. An anomaly at about 5 l, due to the presence of a pump niche that reduces the available volume, is equally evident.