Download Characterization and control of the IST RealProbe

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Radio transmitter design wikipedia , lookup

UniPro protocol stack wikipedia , lookup

Audio power wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Nanogenerator wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Thermal runaway wikipedia , lookup

Valve RF amplifier wikipedia , lookup

Power electronics wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Rectiverter wikipedia , lookup

Lumped element model wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
Characterization and control of the IST RealProbe flux
sensor, made by RedPitaya
by Flavio Ansovini 16/08/2014
From the first moment I saw the RedPitaya board on kickstarter, I thought it was a really interesting device.
The thing that struck me most is that, unlike all other Linux based boards, the RedPitaya has an excellent
analog frontend associated with the Xilinx Zynq chip, which provides the functionality of an FPGA combined
with a powerful ARM processor.
A few months ago the staff of the company RS-Components organized the usual RoadShow at the
Dipartimento di Ingegneria Navale, Elettrica, Elettronica e delle Telecomunicazioni (DITEN) of the University
of Genoa. On this occasion, RS-Components, supported by the engineers of the manufacturers, propose the
demonstrations of the most interesting items to the Department. This year, driven by curiosity, I asked to
see the RedPitaya in real, in a working demonstration: RS not only pleased me, but he did much more,
leaving the RedPitaya as a demo to the " Technological Support Services" at DITEN, where i work as a staff
member .
I have to admit, not knowing well the chip Zynq, that it took me a bit of time to thoroughly understand the
architecture of the software that RedPitaya designers have conceived. However, it is well worth it, because
the experience made me realize that this is a powerful measurement system, fully customizable and with
great potential for expansion.
Of course I immediately wanted to put into practice what I learned on the board. For a bit of time I thought
about how I could use it. Initially I wanted to contribute to the design of logic analyzer, but I had available
to test a flow sensor, given me by the IST company from Switzerland, so what better way to take
advantage of the RedPitaya than to characterize a sensor! And so I decided to make a specific application to
transform RedPitaya in a measuring station for the IST RealProbe flow sensor.
Description of the electronic circuit added to the RedPitaya:
The sensor is formed by a capsule made of stainless steel inside which is located the sensing element. From
the electronic point of view behaves as a power resistor coupled to a PT1000 probe .
The resistor (Rh) is used to heat the sensor, while the PT1000 (RS) measures the temperature variation that
depends, apart from the temperature of Rh also by the flow of water that removes heat to it.
The normal control that is used to drive this type of sensors is described as follows:
The sensor becomes part of a Wheatstone bridge and an operational amplifier maintains to zero the
potential difference between its inverting input and the non-inverting. The output of the operational
amplifier drive, through the power transistor, the current flowing in the resistor Rh. The Rh warming
increases the temperature of Rs, that restore the balancing of the bridge.
The flow sensor is implemented as a constant temperature anemometer. With this electronics, the heater
should be set to a higher temperature than the fluid. The electrical power is controlled to obtain a constant
delta of temperature at different speeds of the fluid.
This type of control works well and allows to measure the speed of the flow in the case of fluids is at an
almost constant temperature.
Using a digital control you can instead take into account the temperature variation, estimateing the fluid
velocity. Also you can optimize power consumption by reducing the power delivered to the minimum
necessary for the operation of the sensor.
My control provides, in addition to the IST RealProbe sensor, a second temperature sensor, in order to
compensate any variations of the fluid's temperature. For this purpose I used a LM35.
For the control, I decided to use a PID controller, realized in software. For the data acquisition I used two of
the four low speeds analog inputs. To control the power dissipated by Rh i've used one of the four slow
speeds analog output.
The block diagram of the project is the following:
To connect the sensors to the RedPitaya I have designed two interface circuits. One circuit as been
designed to adapting the voltage levels connected to the input of the ADCs and another to amplify the
output of the DAC to make it able to provide the needed power to heat up the Rh.
The circuit I designed for the conditioning of the output signal from the flow sensor and the LM35
temperature sensor is the following:
For the IST RealProbe sensor is used an operational amplifier in a non-inverting configuration with an
appropriate amplification and offset so that the output signal can vary only between 0 and +3.3 Volts.
To dimensioning the circuit it is necessary to know the characteristics of the sensor:
IST RealProbe Flow sensor Technical data:
Nominal resistance sensor: 1000Ω±150 Ω at 0°C, TCR: according to DIN EN 60751
Nominal resistance heater 60 Ω ±3.5 Ω at 0°C, TCR: <=20ppm/K
Temperature range -50°C to 120°C
Max. allowed pressure 100 bar
Electrical strength 1000 VDC, 1s
Connection 4x AWG 28/7 Cu/Ag stranded wire, PTFE insulated, 5mm stripped
Lead length 265mm
Color coding Red: heater; yellow: Pt1000
Deep drawing sheath material: 1.4404 / 316L, wall thickness: 0.4mm, length: 25mm, outer Ø: 6mm
.
Starting from the datasheet of the sensor, the maximum variation resistor Rs can be calculated as a
function of temperature, 3850 ppm / K, as expected from the standards (DIN EN 60751).
TCR (Rs) = 1K * 3850 / 1M = 3.85 Ω / ° C
So within a temperature range of 45 ° C, the value of Rs is between 1000 Ω at 0 ° C and 1173 Ω at 45 ° C.
At this point it is possible to calculate the voltage at the center of the divider Rs - R9. When the
temperature changes, the voltage value will change in a range between 2.5V and 2.7V. By the inverting
input, the voltage is amplified and shifted within the established range. At the output of the operational
amplifier, I used a zener diode to cut the 3.3V overvoltages, because it may damage the input of the ADC.
As regards the sensor LM35, it provides a voltage output linear to the temperature. The LM35
characteristic's is the following:
Vout = Temp (° C) * 10 (mV)
As regards the adaptation of the output from the DAC, it was necessary to amplify the output voltage to go
from the range 0V - 1.8V to a range 0V - 12V. It's also needed to consider the power required to power up
the resistor, Rh = 60 Ω. In particular, powered at 12V Rh will absorb 200mA, with an output of 2.4W. As
amplifier I used a power operational amplifier called LM759. The schematics is the following:
Description of the Software:
To control the flow sensor I started from the default application "scope" by adding the PID control. I
decided to design the PID control at the software level, because I thought that was not required to have a
very high sampling rate, considering also the thermal inertia of the system. I have also verified that the
RedPitaya is able to run the code, acquire data and update the PID controller at a frequency of 10 KHz,
which for this purposes is more than enough. To send to the data generated by the controller to the
webserver I use the buffer of channel 2 of the oscilloscope. This was done in order not to modify and
recompile the external modules of nginx, because it would require a change to the level of the web server
and not at the application level, and it may have consequences for the functioning of the other application
available in the Bazaar.
Having the buffer of channel 1 still available I thought I would leave in the ch1 functioning as an
oscilloscope, and in fact came in handy for making electrical measurements on the circuit during flow
measurements. Obviously with the ch1 still working, i had to leave intact the structure of the worker
function. Fo this reason I had to think about how to update the PID controller without affecting the "*
rp_osc_worker_thread (void * args)" function. Given that the "worker thread" actually lost a lot of time on
delay loops, I thought about putting in place of a delay a function that would update the PID controller at
10KHz and reiterate the control to generate the same expected delay in the origin of each call. To
maximize the usability of the application I added some variables in the exchange. With this you can control
from web the constants of the PID, the wanted temperature difference between IST RealProbe and LM35
and also control that gives you the ability to enable data saving, very useful for the characterization of the
sensor. To save the data, I decided to decimate the samples to update the file at a frequency of 1 KHz.
From the user interface point of view, the application is very similar to the default oscilloscope
application, except for the fact that the channel 2 is named "ISTrp power control". It still display a measure
of voltage, but in this case it's the output voltage from the DAC before being amplified. However, after
being amplified, is directly connected to the resistor Rh RealProbe sensor, which has a fixed value of 60 Ω.
Therefore the voltage displayed will always remain in the range 0V - 1.8V but is directly related to the
power supplied to heat the Rh.
The web interface has the following aspect:
Functions relating to channel 1 of the oscilloscope remain unchanged while those for channel 2 have been
replaced by control of the flow sensor.
In the "Measure" you can see some of the values are closely related to the sensor:
The "RS adj" is the result of an initial calibration which is performed automatically when the application
starts. This calibration has the purpose of calibrating the control of Rs so that in static conditions it has the
same temperature reading provided from the LM35.
The value "LM35 Temp" indicates the current temperature read by the sensor LM35. The other two
parameters indicate the refresh rate of the PID controller and the period.
In the Box "PID Controller for IST RealProbe" you can configure the parameters of the PID control on the
sensor, activate the control and start saving data to a file.
With the checkbox "PID Controller for IST RealProbe" you can activate the control. By enabling this control
the current will begin to flow in the sensor up to bring the temperature difference with the LM35 equal to
"Delta T" set in the box below. It's possible to change the PID controller's parameters, in order to find the
optimal configuration.
The "Save to File (/ tmp)" checkbox enables to saving data to a file. The frequency of data sampling is
1KHz. The name of the file that will be created has the following format: "ISTctrl_n.dat", where "n" is an
index that is automatically incremented at the creation of each new file. They will be created in the folder
"/ tmp", int the root of RedPitaya. Note that the folder "/ tmp" resides in ram, and then is cleared on every
reboot of the system. It's therefore necessary to make copies of files created for each measurement to
avoid losing them.
The measure files has the following structure:
The header of the file contains information about the acquisition system. The saved data are separated by a
comma and are the following:
RealProbe temperature, LM35 temperature, the voltage supplied by the PID controller
The app it's available at the RedPitaya's Bazaar otherwise it can found on my fork on github.
To test the operation of the whole system I realized all the electronics described on a breadboard, while the
sensors have been mounted along a tube of 10mm diameter.
Description of the target and the measures:
The goal of the project is to characterize the IST RealProbe sensor, in order to find a function of the output
power and temperature of the fluid, which returns the value of the velocity of the fluid itself. To obtain a
seemingly trivial function you need to make a variety of measures, not always easy or possible to do on the
practical side.
Before i start with the measurements I wanted to be sure that a variation of the flow of water
corresponded to an actual change in the temperature read by the IST RealProbe sensor but that the
temperature measured dall'LM35 remain constant.
From the plot it can be seen that at a variation of the flow corresponds to a sudden change in temperature
for the flow sensor (blue) while the detected temperature from the LM35 remain perfectly constant (red).
Measuring the power supplied at the variation of the water temperature
The first measure that I carried out is a measure that relates the temperature of the water with the power
delivered by the system to maintain a constant DeltaT. The measurement was made with a water flow of 1
m / s, to allow a more rapid and uniform dynamic distribution of temperature.
I started with a temperature of about 10 ° C and I warmed the water up to about 27 ° C. In the interim I've
sampled with the RedPitaya saving the data to several files. Seen that the measure is found to be very long,
I have acquired a large amount of data (about 850K samples) that i have decimated with factor 1000. The
resulting graph is the following:
You can see the two tracks of the temperature IST RealProbesensor (blue) and temperature of the LM35
(red) divided by the predefined Delta T. The graph appears to be linear and have the function
approximated to y = mx + q (green), with m = 0.0149 eq = 0.355. Not being able to perform this
measurement at different water velocities and to its linearity, I presumed that it was linear even at varying
flow (still to check ...), but given the final results seems to be.
Measurement of the output power as a function of the water velocity (measured in advance)
To characterize the sensor at different water velocities I made 11 sets of measurements.
Each set of measurement corresponds to a flow that I previously determined by performing the
measurement of the volume in time.
At each flow rate measurement corresponds a file, so the power delivered to a given flow is related also at
the water temperature. Given the impossibility of effectively control the water temperature, each
measurement was found to be at a different temperature from the others. This has proved the importance
of the previous function, about the relationship between power output and temperature. In fact, thanks to
that function has been possible to compensate the temperature difference.
To each set of measurements belongs about 10K samples of which I averaged to obtain an indicative value
of relative power at a given flow.
The measurements made at the following water speeds gave these results:
Velocità H2O (m/s)
IST Power AVG
AVG Temperature
0.026306602
0.635624233
26.54840599
0.034319125
0.647737995
26.89836331
0.043014849
0.644738739
26.61607984
0.071530312
0.670489726
26.80471914
0.106103295
0.670758863
26.05511078
0.169765273
0.690808887
26.10604616
0.29610222
0.70848424
26.14341384
0.509295818
0.725941195
26.17295586
0.670126076
0.73134374
26.18295587
0.878096238
0.731973929
26.20504966
0.979415034
0.739319647
26.2405934
From the plot it is possible to appreciate the evolution of the output power as a function of flow (blue).
However, you can see the oscillations apparently unmotivated. Looking at the second curve you can
observe the changes in water temperature during the 11 measures made by me, and right over the
power's oscillations can also be observed the coherent oscillations of temperature.
At this point it was necessary to use the function of temperature compensation that I described above.
Applying this function, each value of output power is compensated in function of the temperature at which
the measurement was made. The result after compensation is the following:
As you can see from the plot, the result after the compensation is good, and I was able to approximate the
graph with the following function (red):
Ka= 0.07 , Kb=0.815
To be able to calculate the speed (m / s) from the output power (V) is required the inverse function of the
previous:
Using this function it is possible to compare the velocity values calculated as a function of output power
(blue) with the experimentally measured values of speed before making the measurements (red).
I believe that the results obtained are satisfactory, considering the low amount and accuracy of the
experimental measurements performed. I'm sure that making more precise measurements at controlled
temperature and being able to regulate the flow in the most efficient way we can achieve better results.
Despite this, the system has proved to be very efficient and stable. Moreover, thanks to the great
expansion of RedPitaya will be able to add controls to the system in order to perform the measurements
by setting the parameters directly from the web interface.
By adding the electronics and software to perform a precise water flow control and reliable control of
water temperature, it will be possible to program a set of measure presetting temperature, flow,
frequency of sampling and the time window of the measurement. This will allow to perform a wide range
of measures in an automatic mode and more repeatable. After have made the static measurements it will
also be possible to make measurements varying the flow dynamically.
At the end of this experience I can say that I know more about the board and its potential. I am convinced
that the academic applications are countless and definitely will prove useful in many other occasions.
In my opinion, the improvements that can be made to the project to get the best and most repeatable
results are as follows:
- Design a PCB for electronics interfaces
- Possibility to set the number of samples to acquire
- Amplify the signal from dall'LM35 to bring it in the full range 0V -3.3V (increasing the resolution)
- Implement the PID control algorithm in hardware inside the FPGA
- Add the control and electronics to set and vary the water temperature
- Add the control and electronics to automatically adjust the water flow