Skip to content

Computer vision system to measure the essential oil produced by steam distillation in real time communicating with supervisory applications using Modbus TCP.

Notifications You must be signed in to change notification settings

m4theus4ndr4de/computer-vision-essential-oil-measurement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Computer Vision Essential Oil Measurement System

>Computer vision system to measure the essential oil produced by steam distillation in real time to communicate with supervisory applications using Modbus TCP.

This code was created to run on a Raspberry Pi using its camera called Camera Module V2.

This Computer Vision System requires the following Python packages:

  • OpenCV for image processing and computer vision
  • Numpy to perform mathematical operations
  • pyModbusTCP to communicate with industrial systems
  • picamera to be able to use images coming from a Raspberry Pi in real time

Essential oils are the essence of plants, they are usually what gives them the good smell they have. During the most used essential oil extraction process, the steam distillation, the steam generated by a boiler passes through the plant material inside a distiller. The sessential oils are pulled from the plants and caried by the steam to a condenser in which they exchange heat with the cooling water and the steam, that initially was in the liquid form inside the boiler, are trasformed back in water once again. The essential oils are also transformed in a liquid pouring in a becker or some other kind of vessel to be separated from the water by a decanting process.

Essential oils are generally concentrated, toxic, reactive and they are commonly used for cosmetics and the pharmaceutical industry. So the computer vision approach is a very interesting way to measure the essential oil production in real time. The computer vision measurement system doesn't make contact with the essential oil avoiding both contamination with undeserable substancies and the constant chemical attacks some other sensoring methods would face.

The Modbus TCP was used because it is an open source industrial communication protocol widely used and all other hardware/software in this project were able to communicate through Modbus TCP.

Below there's an example of how the computer vision system works during the lemongrass extraction process.

image

The image above shows that the user can change the RGB and HSV parameters of the color they are trying to find, the color of the essential oil being measured. But the system also accepts a simple click in the image and then the algorithm will search for the color of the pixel that was clicked.

In the left part of the image there are some trackbars used to interact with the system to change the desired color according to the essential oil being produced. In the middle there is an example of the image from the camera. The red contour is the region in the image in which the pixels have the correct color. The blue rectangle is the bounding box of the red countour.

The tube in which the essential oil is inside is a cylinder. Knowing the size of the blue rectangle, it is possible to apply a scale in milimiters/pixel to calculate the amount of essential oil this rectangle represents.

The measurement system works in three modes:

  1. The mode 0 is the calibration mode
  2. Measurement systems based on computer vision can be created using two different approaches. In the first the object to be measured is placed in front of the camera in a fixed distance and its size can be calculated based on trigonometry relations. The second method uses an object of known dimensions for the calibration of the system and then the distance from the camera to the object that will be measured can be variable. The second one was chosen for this project because the essential oil extraction process is a batch industrial process and the position of the machinery is not exactly the same every time the extraction happens. A credit card was the object of known dimensions used to calibrate the system.

  3. The mode 1 is the testing mode
  4. Once the system is calibrated, the mode 1 is activated so the operator can check if the measurement is adequately working. This way it is possible to guarantee that no incorrect value will be sent through Modbus TCP to the supervisory applications. Once the calibration is done and the measerement is correct the next mode can be activated.

  5. The mode 2 is the communicating mode
  6. With the correct calibration, the measured value will be available in the Modbus TCP Server for other applications to know how much essential oil is produced in real time.

About

Computer vision system to measure the essential oil produced by steam distillation in real time communicating with supervisory applications using Modbus TCP.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages