Environmental pollutants determination mostly requires sample collection and transport to the laboratory for analysis. This process delays data acquisition, postponing any action to prevent an environmental catastrophe. This article presents an optical analysis system for in situ determination of environmental pollution, overcoming traditional limitations of optical systems such as cost, robustness, portability, dimensions, complexity or the interference of ambient light. The optical analysis system is composed of a poly(methyl methacrylate) (PMMA) optofluidic structure incorporating discrete auxiliary optical elements (i.e. light emitting diodes, LEDs, and detectors) controlled by an electronic circuit, which enables optical measurement and subtraction ambient light interference. Electronic circuit is based on a simplification of a lock-in amplifier where information is at the level of the received signal (modulus) and the phase is not considered. This configuration allows for simplification of electronic circuit requirements (i.e. mixer and Phase Locked Loop, PLL, systems are not necessary) and important reduction of size and cost. To this end, analytical signal pattern generated with the microcontroller is positioned at a frequency much higher (8kHz) than potential interfering sources (e.g. house light or sunlight, below 50Hz), which simplifies filtering. Optical analysis system is applied to general toxicity determination of water samples in situ. Toxicity analysis is based on a quick optical bioassay where bacterial reduction kinetics of ferricyanide is used to determine cell metabolism in less than 10min. Ferricyanide interacts with bacterial membrane proteins which reduces it with time. Ferricyanide reduction kinetics (as the variation of ferricyanide absorption with time) allows for simple, sensitive and reliable water toxicity determination with a portable, robust, miniaturized and low cost system, insensitive to environmental changes. This optical instrument, here applied to environmental pollution, may be used in the in situ determination of other (bio)molecules of interest, such as biomarkers in biochemical analysis or pathogens in the food and beverage industry.