*2.1. Device*

The core of the analytical device is a portable ion chromatography (IC) system based on the method previously reported by Murray [14]. This system employs a novel design of a ultraviolet (UV) light-emitting diode (LED)-based optical detector which enables cost-effective direct in situ detection of nitrite and nitrate in natural waters. The automated portable IC system is described in detail by Murray [48]. The main functional blocks of the system are depicted in Figure 1 and each component is subsequently described.

**Figure 1.** Functional block diagram highlighting core components of analytical system.

The sample intake system is comprised of a 12 V high flow pump and a reservoir. The pump draws sample from the water source filling the reservoir. The sample intake pump runs at the beginning of each analysis cycle for 30 s. The pump module is responsible for loading sample into the system and pumping the eluent through the ion exchange column and detector for analysis. The pump module consists of four 3D printed syringe pumps, three of which are used for eluent delivery, whereas the fourth syringe pump draws sample from the reservoir. Once full, the syringe pumps empty at a set flow rate enabling chromatographic analysis and analyte detection. The optical detection cell consists of a low-cost, UV absorbance detector which incorporates a 235 nm LED and photodiode [14]. The photodiode is coupled with an ADS1115 analogue to digital converter (ADC). The signal from the photodiode (0–3.3 V) is sampled every 50 ms by the ADC which communicates with the systems microcontroller via I2C protocol. A HTU21D-F temperature and humidity sensor is used to measure the internal parameters of the analyzer. The sensor communicates over I2C and the readings are logged once at the beginning of every cycle.

The system is powered from a portable battery (Voltaic V88), which has a capacity of 24 Ampere-hour and supplies 12 Volts to the embedded system. The battery is charged from an alternating current source with a supplied adapter. The system can operate on battery alone for short periods of time, however, for long term deployments the unit runs from the battery while it is charging. This setup allows the system to function for up to 5 days on battery alone at an hourly sampling frequency, if the main power supply fails.

The analyzer is housed within a Peli 1510M Mobility Case (see Figure 2a). The case is water resistant, crushproof, dust resistant, and features a pressure equalization valve to balance interior pressure. The modular design of the system facilitates maintenance and exchange of components, without affecting the functioning of the other modules (see Figure 2b).

**Figure 2.** Design of the device.

An embedded system based on the Teensy 3.6 microcontroller unit is used to automate all functionality of the system. The firmware allows the unit to operate independently without user interaction once set up. A real-time clock wakes the system at a defined interval upon which system sampling and analysis functions begin to execute.

In this work, to add the connectivity with the wireless sensor network, an IoT solution associated with the system is implemented using a Raspberry Pi Zero W (Rpi) connected to a SimCom SIM800 Quad-Band GSM/GPRS integrated component. Raw signal transmission is acquired in real-time via an RS232 serial connection between the microcontroller and Rpi. The raw data is processed at the end of each IC run and used to calculate retention time and peak area of nitrate and nitrite. These values are transmitted via the SIM800 module. A small buffer of processed data are stored on the RPi unit in the event of a data transmission failure. The IoT devices attempt to transmit the buffered data at the end of subsequent IC runs.
