# Design and Evaluation of IoT-Enabled Instrumentation for a Soil-Bentonite Slurry Trench Cutoff Wall
## 3 Data Collection  
The primary goal for data collection was to ensure that at least one sample per hour from all of the sensors was reliably recorded. This sample rate was selected because the stress state in the wall is expected to change slowly over a period of days or weeks. Secondary goals were to present the data to the researchers (1) in a timely fashion on a website and (2) in a format facilitating analysis of the data. In this context, timeliness is loosely defined and up to one hour of latency is acceptable. The location of the site, less than a mile from campus as shown in Figure 5, makes the use of a low-power wireless link possible. The data collection architecture is shown in Figure 6.  
Initially, a Campbell Scientific RF401A 900 MHz Spread-Spectrum Radio ([[https://www.campbellsci.com/rf401a](https://www.campbellsci.com/rf401a)]([https://www.campbellsci.com/rf401a](https://www.campbellsci.com/rf401a))) was deployed directly to the CR6 datalogger with a 3 dB Yagi antenna as shown in Figure 7. The gateway server had a matching RF401A radio. We used the PyCampbellCR1000 ([[https://github.com/[PERSON]/PyCampbellCR1000](https://github.com/[PERSON]/PyCampbellCR1000)]([https://github.com/[PERSON]/PyCampbellCR1000](https://github.com/[PERSON]/PyCampbellCR1000))) software by [PERSON], [PERSON], and others to download data from the datalogger using the PakBus communications protocol in our lab experiments. However, once the datalogger was installed on site, we were initially unable to successfully download data. Figure 5: Google Earth rendering of the 1.3 km wireless link from campus to the test site (Google Earth Pro v7.3.1.4507). Figure 6: Diagram of the data collection, transport, storage, and visualization plan for the project. Figure 7: Weather station with 3 dB Yagi antenna for data transmission from the site. We began troubleshooting the problem by investigating the PakBus messages on the gateway. There was traffic in both directions but not consistently. It appeared that messages were getting dropped causing almost constant retransmissions of PakBus messages. Curious, we opened the RF401A radio to find a Digi XBee 900 HP ([[https://www.digi.com/products/xbee-rf-solutions/sub-1-ghz-modules/xbee-pro-900](https://www.digi.com/products/xbee-rf-solutions/sub-1-ghz-modules/xbee-pro-900) hp]([https://www.digi.com/products/xbee-rf-solutions/sub-1-ghz-modules/xbee-pro-900](https://www.digi.com/products/xbee-rf-solutions/sub-1-ghz-modules/xbee-pro-900) hp)) radio module attached to a controller board. This is a frequency hopping radio with automatic packetization supporting a maximum transmission unit (MTU) of 256 bytes. The PakBus MTU is fixed at 1500 bytes and we suspect that any one dropped PakBus fragment causes the entire message to be resent or lost altogether resulting in a unreliable communication. To solve the problem of collecting data from the datalogger, a Raspberry Pi Model B computer was installed at the site to download data locally over the wired serial interface using PyCampbellCR1000. Power for the Raspberry Pi was provided by a 12-to-5 Volt DC/DC converter connected to the datalogger's 12 Volt battery. This increases site-energy consumption by almost 1 Watt when no other peripherals are attached to the Raspberry Pi (i.e., keyboard, display). However, this arrangement avoids sending the 1500-byte PakBus messages over the wireless link. A data collection script is run as a system cron job every 5 min. The script communicates to the logger and incrementally downloads data from all tables since the last download. The data is stored as a JSON file in a temporary directory on the Raspberry Pi's filesystem. The file is later detected and transmitted to the gateway server for processing. This approach improved reliability by decoupling data collection and data transmission. If the wireless link were to fail, data will still be collected and stored to the Raspberry Pi's SD card as JSON files.