**1. Introduction**

The agri-food system is increasingly showing the need to innovate production processes and the related quality controls through the use of new technologies and the use of innovative sensors that could be interconnected, approaching what is called industry 4.0. In this context, and in particular in agriculture 4.0, emerging technologies such as artificial intelligence, big data, Internet of Things (IoT) are presented as a solution to the new challenges associated with food production. It is a digitization of all agricultural systems capable of increasing yields by reducing inputs and labor requirements. Furthermore, these technologies are capable of improving the health of the environment by enabling the production of a higher amount of food on the existing land while saving further land conversions and increasing eco-efficiency [1].

Obtaining high-quality and safe agricultural and food products is now an essential condition for both producers and consumers who are more involved and interested in the various aspects concerning food production. Therefore, the agri-food industry is currently concentrating on the production of healthy products that at the same time meet the market demands, and to do this it is essential to carry out punctual and precise quality controls on the products [2].

The analytical methods currently available to assess quality require time and above all are destructive techniques or laboratory chemical analyses that also involve the use of reagents. Nondestructive techniques based on optical properties and visual evaluations of food matrices are now being used all over the world as a response to these needs.

One of the most widespread techniques is undoubtedly visible and near-infrared (vis/NIR) spectroscopy, which is based on the measurement of the variation in the spectral characteristics of a sample irradiated with electromagnetic radiation in the visible and in the near-infrared range (400–2500 nm). The variations of the spectral characteristics in a matrix can be recorded in different modalities according to the characteristics of the product but also according to the characteristics of the instruments used. Spectroscopy for analyzing agricultural and food products has proven to be an exceptional and rapid tool with little or no sample preparation [3].

This type of nondestructive technique guarantees the reduction and, in some cases, even the elimination of the use of solvents, which are instead necessary to carry out traditional chemical laboratory analyzes. Compared with vis/NIR technology, chemical techniques require a lot of time, sample preparation, and the use of chemical reagents influencing both the cost aspect and the environmental impact aspects. Moreover, in recent years, research tends to pay attention also to on/in/at-line applications, and vis/NIR spectroscopy offers several opportunities for quality control during processes: the replacement of the analytical tools and reagents related to chemical analyses with one vis/NIR spectrometer could reduce the environmental impact of analyses [4].

Vis/NIR spectroscopy is just one example of the numerous techniques that are being implemented in these fields. Paragraph 2 of the chapter will analyze the principles of the most common nondestructive techniques used in the agri-food industry, paragraph 3 will focus on the applications of these techniques in the optimization of the olive production process, and finally, fourth paragraph will illustrate the portable prototypes and future prospects of simplified optical devices.
