11institutetext: Paul C. Lauterbur Research Center for Biomedical Imaging,
Shenzhen Institute of Advanced Technology, Chinese Academy of Sciences,
Shenzhen, Guangdong, China 22institutetext: University of Chinese Academy of
Sciences, Beijing, China 33institutetext: Pengcheng Laboratory, Shenzhen,
Guangdong, China
33email<EMAIL_ADDRESS><EMAIL_ADDRESS>
# Few-shot Class-incremental Learning for Cross-domain Disease Classification

Hao Yang 112233 Weijian Huang 112233 Jiarun Liu 112233 Cheng Li 11 Shanshan
Wang 1133**

###### Abstract

The ability to incrementally learn new classes from limited samples is crucial
to the development of artificial intelligence systems for real clinical
application. Although existing incremental learning techniques have attempted
to address this issue, they still struggle with only few labeled data,
particularly when the samples are from varied domains. In this paper, we
explore the cross-domain few-shot incremental learning (CDFSCIL) problem.
CDFSCIL requires models to learn new classes from very few labeled samples
incrementally, and the new classes may be vastly different from the target
space. To counteract this difficulty, we propose a cross-domain enhancement
constraint and cross-domain data augmentation method. Experiments on MedMNIST
show that the classification performance of this method is better than other
similar incremental learning methods.

###### Keywords:

Incremental learning Few-shot learning Cross-domain.

##  1 Introduction

With the increase of model scale and the number of training data, deep
learning has achieved better and better performance in downstream tasks.
However, it is well known that a well trained deep neural network (DNN) with
large scale of parameters is usually difficult to adapted to a new task by
training on just a few examples. Especially when the new samples are coming
from different source domains. Further, lack of ability to preserve previous
knowledge limits the application of DNN [12, 19]. Therefore, it is important
to explore the few-shot learning and memorizing capability of deep learning
models.

Figure 1: Scenario of cross-domain few shots incremental learning. Each
scenario achieved by adding non-overlapping classes sequentially. Only a few
with different domain images are used for training in the incremental session,
while the target space may be very different from the base session. An ideal
model should perform well in all categories after training.

However, existing methods may suffer from few samples increment for which may
lead to overfit of the representation and thus destroy the pre-trained
structure of feature embeding[11]. As results, leading to more serious
forgetfulness. Reasearchers have trying to solve the few-shot incremental
problem. Some methods update the backbone when receiving the new incremental
tasks after training the network [28, 10], while other methods freeze[26, 30].
At the same experiment setting, comparing to the one freezing the backbone,
the updated methods showing more performance decrease since the large
unbalancing between the coming data and source data, especially when the data
come from different domain.

To this aim, we are the first to propose a challenging and practical novel
scenarios: cross-domain few-shot incremental learning (CDFSCIL). CDFSCIL
requires the model to constantly adapt to new tasks by receiving data from
different source domains, and retain the previously learned tasks without
additional cost. Considering clinical application, CDFSCIL has the following
attribution: 1) The model needs to perform well on all classes equally, even
when there are a huge gap in representation space between different domain
data; 2) For extreme few sample case, the model should still maintain stable
performance.

The strategy of backbone freezing decouples the learning of representation and
classifier to avoid over-fitting and catastrophic forgetting in
representation[26, 21, 29, 14]. In addition, since the basic features of
different objects are similar, it is meaningful to choose these types of
features to identify new classes. Inspired by the decouples strategy, our
method reserve space for future cross-domain tasks by constructing pseudo-
domains and pseudo-labels in advance and hence lead to better class-
incremental performance.

This article proposes a cross-domain few-shot class incremental learning
method designed to learn more universal feature embeddings from a small amount
of data. Specifically, we generate a large number of pseudo-data and train the
model on it to adapt to these data. Through introducing a domain-constrained
loss, we jointly optimize the pseudo-data and real data, extract invariant
information and enable the model to handle incremental sessions with few
samples. Our contributions are as follow:

  1. 1.

We are the first to propose the challenging senario of CDFSCIL;

  2. 2.

We narrowed the cross-domain feature distribution to maximizes the distance
between inter-class feature vectors via a novel constraint;

  3. 3.

We propose a new cross-domain augmentation strategy to compact intra-class
clustering and wide inter-class separation.

Figure 2: This is the workflow of the proposed method. We generate pseudo-
incremental data on the base session with multiple domains, obtaining a
universal feature embedding representation by making intra-class clustering
more compact and inter-class margin of the same domain wider. a) The training
process on the base session first randomly samples pseudo data to simulate the
future incremental phase to be learned, using domain-enhanced loss to enhance
the discriminability of domain-related categories. b) The incremental learning
and inference process. The newly added classifier for each session is the
average embedding of each class training data in that session. The logit is
obtained by the cosine similarity between the data embedding and the
classifier.

##  2 Method

In this section, we introduce the propose method via: 1) a cross-domain
enhancement constraint and 2) intra-/inter- class separation strategy for the
challenges of FSCIL. The workflow of the method are as shown in Fig. 1.

###  2.1 Problem Formulation

The goal of FSCIL is to learn new classes from extremely limited training
samples while maintaining performance over old sessions. Typically, FSCIL has
several sequential learning sessions $\\{S^{0},S^{1},...,S^{B}\\}$. Each
session contains $N^{b}$ labeled sample pair
$S^{b}=\\{x_{i},y_{i}\\}^{N^{b}}_{i=1}$, where $x_{i}\in R^{D}$ is input data
and $y\in Y^{b}$. $Y^{b}$ is the label space of $S^{b}$ and $Y^{b}$ satisfying
$\forall b\not=b^{\prime},Y^{b}\cap Y^{b^{\prime}}=$. The training set of
$b$-th session $S^{i}_{train}$ contains data of current session only and will
be inaccessible during other sessions. Meanwhile, the testing set of $b$-th
session $S^{b}_{test}$ includes both test sets of previous and current
sessions, that is $Y^{b}_{test}=\\{Y^{0}\cap Y^{1},...,Y^{b}\\}$. Usually, the
training set $S^{0}_{train}$ of the first session is a relatively large data
set, which is also known as the basic training set. Instead, the data set is
usually described as the N-way K-shot training set in all subsequent sessions.
State-of-the-art continuous learning solutions impose constraints on input
space and target space, based on the assumption that all tasks have the same
target space [4, 16, 20] or all tasks originate from the same (partial) data
set [4, 8]. In practice, $S$ may come from multiple different domains with
large distribution discrepancies. Therefore, the goal of our CDFSCIL is
continuous learning in different domains. Each domain is defined as a single
data set of one class or multiple categories, and each S contains the data of
multiple domains.

###  2.2 Domain enhancement constraint

In the case of cross-domain incremental, due to the large inter-domain
differences, the learning based on cross-entropy loss may lead the model to
converge only in the inter-domain that are easy to classify. The attention to
the intra-domain fine category is thus weakened. Therefore, we hope to use a
loss function, which can not only maintain the performance of intra-domain
classification but also enhance inter-class attention.

Many adaptive cross-entropy and cosine-similarity constraint have been used in
classification problems [18, 17, 23]: The cross-entropy constraint classify
different items by maximizing the posterior probability of the groundtruth.
Given the input representation $x_{i}$ with its corresponding label $y_{i}$,
the cross-entropy loss can be formulated as:

$L_{s}=\frac{1}{N}\sum_{i=1}^{N}(-logp_{i})=\frac{1}{N}\sum_{i=1}^{N}-log\frac{e^{f_{y_{i}}}}{\sum_{j=1}^{C}e^{f_{j}}}$
(1)

where $p_{i}$ indicates the posterior probability, $N$,$C$ is the number of
samples and classes respectively. $f_{j}$ is usually represented as the
activation of the fully connected layer with the weight $W_{j}$ and the bias
$b_{j}$. For simplicity, we set and fix the $b_{j}=0$. $f_{j}$ is then given
by the following formula:

$f_{j}=W^{T}_{j}x=\|W_{j}\|\|x\|cos\theta_{j}$ (2)

where $\theta_{j}$ is the angle between $W_{j}$ and $x$. Eq. 2 shows that both
the norm and angle of the vector have contribution to the posterior
probability.

The constraint without feature normalization is to learns $L2$ norm to
minimize the total loss, resulting in relatively weak cosine constraint, which
weakens the ability of classification based on cosine similarity. Inspired by
cosFace [23], we normalized the weight vector. Let $\|W_{j}\|=1$, and fixed
$\|x\|=r$. The representation vector is then mapping on a hypersphere, where
$r$ represent the radius and $m$ is the cosine edge at the classification
boundary:

$L_{A}=-\frac{1}{N}\sum^{N}_{j=1}\log(\frac{e^{r_{A}(\cos\theta_{j}-m_{A})}}{e^{r_{A}(\cos\theta_{j}-m_{A})}+\sum_{i\not=j}e^{r_{A}\cos\theta_{i}}})$
(3)

Based on Eq. 3, we introduce domain $D$. In the same domain, features between
classes become more widely separated, and the correction loss can be expressed
as

$L_{D}=-\frac{1}{N_{D_{i}}}\sum^{N_{D_{i}}}_{j=1,j\in
D_{i}}\log(\frac{e^{r_{D}(\cos\theta_{j}-m_{D})}}{e^{r_{D}(\cos\theta_{j}-m_{D})}+\sum_{i\not=j}e^{r_{D}\cos\theta_{i}}})$
(4)

$r_{A}$ and $r_{D}$ can control the distribution of feature vectors in the
hypersphere with different radius, which loosens the feasible space of
different domains. $m_{D}$ is used to control the interval between classes in
the domain and adjust the contribution of $L_{A}$ and $L_{D}$.

So the total loss $L$ can be formulate as:

$L=\lambda L_{A}+(1-\lambda)L_{D}$ (5)

###  2.3 Intra-/Inter- class separation strategy

The wide separation of intra-domain and inter-class representation means that
more room can be left for the new potential classes. Moreover, learning with
more diversity feature representation can help the network learning to be more
diverse and transferable. Therefore, we generate a large number of pseudo
class data to separate the represented latent space.

We propose a simple and effective method to construct pseudo-class and pseudo-
domain. For images, we use the image mixing methods such as Mixup[27],
Cutout[9] and CutMix[25] to randomly sample and fuse in the base session data
to generate new and different pseudo-class samples. For a classification task
with $C$ class and $D$ domain, we fuse $N_{C}$ new classes and $N_{D}$ new
domains by random combination. $N_{C}$ and $N_{D}$ can be calculated by:

$N_{C}=C\times(C-1)/2$ (6) $N_{D}=D\times(D-1)/2$ (7)

The generated pseudo-class and pseudo-domain will be trained together with the
original data. In particular, when two data from the same domain are merged,
the new data generated still belongs to the source domain. Therefore, the
intra-domain category diversity of the source domain will be enhanced.

Table 1: Details of session settings. Two kinds of settings are considered: 1) 1-way 1-shot with 15 incremental sessions, each session learns one category incrementally; 2) Single-domain 1-shot with 3 incremental sessions, each session categories belong to the same domain. 1-Way 1-Shot |  Single-domain 1-shot
---|---
Session |  |  Datasets
---
(# Classes)
Session |  |  Datasets
---
(# Classes)
1$\sim$5 |  RetinaMNIST(5) |  1 |  RetinaMNIST(5)
6$\sim$10 |  |  BreastMNIST(2)
---
BloodMNIST(3)
2 |  BreastMNIST(2)
11$\sim$15 |  BloodMNIST(5) |  3 |  BloodMNIST(8)
Table 2: Details of subsets. Subset | Data Modality | # Sample | # Classes | Session
---|---|---|---|---
PathMNIST[15] | Colon Pathology | 107,180 | 9 | Base
DermaMNIST[22] | Dermatoscope | 10,015 | 7 | Base
OrganAMNIST[3] | Abdominal CT | 58,850 | 11 | Base
RetinaMNIST[6] | Fundus Camera | 1,600 | 5 | Incremental
BreastMNIST[2] | Breast Ultrasound | 780 | 2 | Incremental
BloodMNIST[1] | Blood Cell Microscope | 17,092 | 8 | Incremental

##  3 Experiment

###  3.1 Dataset of Multiple Diseases

MedMNIST[24] is a large standardized biomedical image collection, including 12
number of 2D datasets and 6 number of 3D datasets. All images are pre-
propocess to 28 $\times$ 28, with corresponding Two-/multi- class labels.

Our method are experimented on 6 medical disease classification open-source
datasets. Following the proposed CDFSCIL, we select
PathMNIST[15],DermaMNIST[22], OrganAMNIST[3] as the base session sets while
the others[6, 2, 1] are serve as the incremental session. Details are as shown
in Table. 1 and Table. 2.

###  3.2 Evaluation Criteria

Following [7, 5], we report the average accuracy and Performance Dropping rate
(PD) for quantitative evaluation. The average accuracy indicates the accuracy
of the model after $i$-th session. It can be formulated as
$A_{t}=\frac{1}{t}\sum^{t}_{i=1}a_{t,i}$, where $a_{t,i}$ is the
classification accuracy of model on task $i$ when the training of task $t$ is
completed. PD quantifies the decline in the model performance after each task.
PD can be calculated as $PD=A_{0}-A_{B}$, where $A_{0}$ indicates accuracy
after the base session and $A_{B}$ indicates the accuracy after the last
incremental session. Methods with lower PD suffer less from forgetting.

###  3.3 Implementation Details

For our experiment, we used ResNet18 [13] as the backbone network. FC uses
three layers of fully-connected networks, with 2048 neurons in the first and
second layers, and the total number of categories calculated based on Eq. 6.
The parameters in the loss function are set to 0.8, $r_{A}=r_{D}=30$, and
$m_{A}=m_{D}=0.4$. This method is based on PyTorch library and is optimized
with volume driven SGD. The initial learning rate of training was set as 0.01.
The Batchsize is 1024. The Limit[29] and C-FSCIL[14] configurations are both
open source implementations. We performed data enhancement on the sample
including random flipping, cropping, and color dithering. In this experiment,
mixup was used to generate pseudo-class images. For each task, we trained the
model on an NVIDIA A100 GPU for 100 epochs and chose to stop early when
overfitting occurred

Two different experimental configurations were set up to fully evaluate the
FSCIL approach, as shown in Table 1. For 1-way 1-shot, we divide it into 15
sessions, each of which learns one class. Single-domain 1-shot is divided into
three sessions, each of which is a separate domain. All Settings are not a
training sample class.

Figure 3: Average accuracy under 1-way 1-shot FSCIL setting. Our method is better than other basline methods. Table 3: Average accuracy and PD under single-domain 1-shot. Session | 0 | 1 | 2 | 3 | PD $\downarrow$
---|---|---|---|---|---
C-FSCIL | 89.46 | 87.76 | 84.00 | 79.21 | 10.25
LIMIT | 90.77 | 89.69 | 87.97 | 82.40 | 8.37
Ours (w/o $L_{D}$) | 90.92 | 89.60 | 88.14 | 83.14 | 7.79
Ours | 91.05 | 89.85 | 88.39 | 83.71 | 7.33

###  3.4 Comparative Results

As shown in Fig. 3 and Table. 3, our proposed method can maintain the best
accuracy and PD under different settings or stages. In Fig. 3, As the
incremental phase increases, C-FSCIL (blue line) shows a downward trend after
$8$-th and $13$-th sessions, respectively. LIMIT (orange line) shows a similar
trend to C-FSCIL. Compared to baseline methods, our proposed method shows its
superior, especially under large session settings. For the single-domain
1-shot setting, we obtained an average accuracy of 83.71% in the last session,
which is 1.31% and 4.7% higher than the LIMIT and C-FSCIL methods,
respectively. Particularly, our proposed method is still better in the absence
of $L_{D}$, which means our method could learn various feature representations
from pseudo-classes.

##  4 Conclusion

In order to better simulate future clinical scenarios, we first propose a
cross-domain few-shot class-incremental learning. In this scenario, in
addition to a single medical modality, a complete diagnosis of the patient is
required. Our cross-domain incremental learning setting assumes that tasks can
come from different medical modalities and datasets. Then, we propose a cross-
domain few-shot class-incremental learning method, which improves the feature
representation ability of the basic session model by constructing pseudo-
sample binding domain enhancement loss, provides a better embedded
representation for the incremental categories, and reduces the identification
error. Our results show that the performance of cross-domain few-shot class-
incremental learning can be improved by properly adjusting the relationships
between inter-domain and intra-domain categories in the base session, and our
method has substantial improvement over the comparison method.

## References

  * [1] Acevedo, A., Merino, A., Alférez, S., Molina, Á., Boldú, L., Rodellar, J.: A dataset of microscopic peripheral blood cell images for development of automatic recognition systems. Data in brief 30 (2020)
  * [2] Al-Dhabyani, W., Gomaa, M., Khaled, H., Fahmy, A.: Dataset of breast ultrasound images. Data in brief 28, 104863 (2020)
  * [3] Bilic, P., Christ, P., Li, H.B., Vorontsov, E., Ben-Cohen, A., Kaissis, G., Szeskin, A., Jacobs, C., Mamani, G.E.H., Chartrand, G., et al.: The liver tumor segmentation benchmark (lits). Medical Image Analysis 84, 102680 (2023)
  * [4] Chaudhry, A., Dokania, P.K., Ajanthan, T., Torr, P.H.: Riemannian walk for incremental learning: Understanding forgetting and intransigence. In: Proceedings of the European conference on computer vision (ECCV). pp. 532–547 (2018)
  * [5] Chaudhry, A., Ranzato, M., Rohrbach, M., Elhoseiny, M.: Efficient lifelong learning with a-gem. arXiv preprint arXiv:1812.00420 (2018)
  * [6] Dataset, D.: The 2nd diabetic retinopathy–grading and image quality estimation challenge (2020)
  * [7] Derakhshani, M.M., Najdenkoska, I., van Sonsbeek, T., Zhen, X., Mahapatra, D., Worring, M., Snoek, C.G.M.: Lifelonger: A benchmark for continual disease classification. In: Wang, L., Dou, Q., Fletcher, P.T., Speidel, S., Li, S. (eds.) Medical Image Computing and Computer Assisted Intervention – MICCAI 2022\. pp. 314–324. Springer Nature Switzerland, Cham (2022)
  * [8] Derakhshani, M.M., Zhen, X., Shao, L., Snoek, C.: Kernel continual learning. In: International Conference on Machine Learning. pp. 2621–2631. PMLR (2021)
  * [9] DeVries, T., Taylor, G.W.: Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552 (2017)
  * [10] Dong, S., Hong, X., Tao, X., Chang, X., Wei, X., Gong, Y.: Few-shot class-incremental learning via relation knowledge distillation. In: Proceedings of the AAAI Conference on Artificial Intelligence. vol. 35, pp. 1255–1263 (2021)
  * [11] Finn, C., Abbeel, P., Levine, S.: Model-agnostic meta-learning for fast adaptation of deep networks. In: International conference on machine learning. pp. 1126–1135. PMLR (2017)
  * [12] Goodfellow, I.J., Mirza, M., Xiao, D., Courville, A., Bengio, Y.: An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211 (2013)
  * [13] He, K., Zhang, X., Ren, S., Sun, J.: Deep residual learning for image recognition. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 770–778 (2016)
  * [14] Hersche, M., Karunaratne, G., Cherubini, G., Benini, L., Sebastian, A., Rahimi, A.: Constrained few-shot class-incremental learning. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 9057–9067 (2022)
  * [15] Kather, J.N., Krisam, J., Charoentong, P., Luedde, T., Herpel, E., Weis, C.A., Gaiser, T., Marx, A., Valous, N.A., Ferber, D., et al.: Predicting survival from colorectal cancer histology slides using deep learning: A retrospective multicenter study. PLoS medicine 16(1), e1002730 (2019)
  * [16] Lenga, M., Schulz, H., Saalbach, A.: Continual learning for domain adaptation in chest x-ray classification. In: Medical Imaging with Deep Learning. pp. 413–423. PMLR (2020)
  * [17] Liu, W., Wen, Y., Yu, Z., Li, M., Raj, B., Song, L.: Sphereface: Deep hypersphere embedding for face recognition. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 212–220 (2017)
  * [18] Liu, W., Wen, Y., Yu, Z., Yang, M.: Large-margin softmax loss for convolutional neural networks. arXiv preprint arXiv:1612.02295 (2016)
  * [19] McCloskey, M., Cohen, N.J.: Catastrophic interference in connectionist networks: The sequential learning problem. Psychology of Learning and Motivation, vol. 24, pp. 109–165. Academic Press (1989). https://doi.org/https://doi.org/10.1016/S0079-7421(08)60536-8, https://www.sciencedirect.com/science/article/pii/S0079742108605368
  * [20] Memmel, M., Gonzalez, C., Mukhopadhyay, A.: Adversarial continual learning for multi-domain hippocampal segmentation. In: Domain Adaptation and Representation Transfer, and Affordable Healthcare and AI for Resource Diverse Global Health: Third MICCAI Workshop, DART 2021, and First MICCAI Workshop, FAIR 2021, Held in Conjunction with MICCAI 2021, Strasbourg, France, September 27 and October 1, 2021, Proceedings 3. pp. 35–45. Springer (2021)
  * [21] Peng, C., Zhao, K., Wang, T., Li, M., Lovell, B.C.: Few-shot class-incremental learning from an open-set perspective. In: Computer Vision–ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part XXV. pp. 382–397. Springer (2022)
  * [22] Tschandl, P., Rosendahl, C., Kittler, H.: The ham10000 dataset, a large collection of multi-source dermatoscopic images of common pigmented skin lesions. Scientific data 5(1), 1–9 (2018)
  * [23] Wang, H., Wang, Y., Zhou, Z., Ji, X., Gong, D., Zhou, J., Li, Z., Liu, W.: Cosface: Large margin cosine loss for deep face recognition. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 5265–5274 (2018)
  * [24] Yang, J., Shi, R., Ni, B.: Medmnist classification decathlon: A lightweight automl benchmark for medical image analysis. In: 2021 IEEE 18th International Symposium on Biomedical Imaging (ISBI). pp. 191–195. IEEE (2021)
  * [25] Yun, S., Han, D., Oh, S.J., Chun, S., Choe, J., Yoo, Y.: Cutmix: Regularization strategy to train strong classifiers with localizable features. In: Proceedings of the IEEE/CVF international conference on computer vision. pp. 6023–6032 (2019)
  * [26] Zhang, C., Song, N., Lin, G., Zheng, Y., Pan, P., Xu, Y.: Few-shot incremental learning with continually evolved classifiers. In: Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. pp. 12455–12464 (2021)
  * [27] Zhang, H., Cisse, M., Dauphin, Y.N., Lopez-Paz, D.: mixup: Beyond empirical risk minimization. https://openreview.net/forum?id=r1Ddp1-Rb
  * [28] Zhao, H., Fu, Y., Kang, M., Tian, Q., Wu, F., Li, X.: Mgsvf: Multi-grained slow vs. fast framework for few-shot class-incremental learning. IEEE Transactions on Pattern Analysis and Machine Intelligence pp. 1–1 (2021). https://doi.org/10.1109/TPAMI.2021.3133897
  * [29] Zhou, D.W., Ye, H.J., Ma, L., Xie, D., Pu, S., Zhan, D.C.: Few-shot class-incremental learning by sampling multi-phase tasks. IEEE Transactions on Pattern Analysis and Machine Intelligence pp. 1–16 (2022). https://doi.org/10.1109/TPAMI.2022.3200865
  * [30] Zhu, K., Cao, Y., Zhai, W., Cheng, J., Zha, Z.J.: Self-promoted prototype refinement for few-shot class-incremental learning. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 6801–6810 (2021)


# Wireless Sensor Network for in situ Soil Moisture Monitoring

Jianing Fang1, Chuheng Hu2, Nour Smaoui3, Doug Carlson4∗, Jayant Gupchup5∗,
Razvan Musaloiu-E.∗, Chieh-Jan Mike Liang6∗, Marcus Chang7∗, Omprakash
Gnawali2, Tamas Budavari8, Andreas Terzis∗, Katalin Szlavecz1, and Alexander
S. Szalay9
1Department of Earth & Planetary Sciences, Johns Hopkins University, 3400 N
Charles Street, Baltimore, USA
2Department of Computer Science, Johns Hopkins University, 3400 N Charles
Street, Baltimore, USA
3Department of Computer Science, University of Houston, 4800 Calhoun Rd,
Houston, Houston, USA
4CEVA, Inc., 15245 Shady Grove Rd, Rockville, USA
5Microsoft Corporation, One Microsoft Way, Redmond, USA
6Microsoft Research, No. 5 Danling Street, Beijing, China
7Arm Ltd., 5707 Southwest Pkwy 100, Austin, USA
8Department of Applied Mathematics & Statistics, Johns Hopkins University,
3400 N Charles Street, Baltimore, USA
9Dept. of Computer Science and Physics & Astronomy, Johns Hopkins University,
3400 N Charles Street, Baltimore, USA
<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>
∗Previous members of the team project. Work performed while at Johns Hopkins
University.

###### Abstract

We discuss the history and lessons learned from a series of deployments of
environmental sensors measuring soil parameters and CO2 fluxes over the last
fifteen years, in an outdoor environment. We present the hardware and software
architecture of our current Gen-3 system, and then discuss how we are
simplifying the user facing part of the software, to make it easier and
friendlier for the environmental scientist to be in full control of the
system. Finally, we describe the current effort to build a large-scale Gen-4
sensing platform consisting of hundreds of nodes to track the environmental
parameters for urban green spaces in Baltimore, Maryland.

##  1 Introduction

Soil is a semi-aquatic habitat harboring a huge diversity of terrestrial as
well as aquatic organisms. The amount and availability of soil water affect
survival and activity of organisms from bacteria to macrofauna to plants
directly, but also indirectly, by redistributing nutrients or toxic
substances. Consequently soil water content is a main driver of belowground
biological activity. Pathways and rates of complex biogeochemical processes
can shift dramatically especially if the soil dries out or becomes
waterlogged. For instance the same ecosystem can switch between being a
methane sink or source depending on fluctuations of water table or
precipitation patterns.

Soil is inherently spatially heterogeneous in all three dimensions and at many
spatial scales. Young and Crawford (2004) called soils “the most complicated
biomaterials on the planet” [Young and Crawford, 2004]. On field scale high
degree of patchiness exists even in seemingly uniform landscapes [Robertson et
al., 1994]. Soil physical, chemical and biological characteristics vary even
more in fragmented landscapes. An extreme example of this is the urban-
suburban environment with highly modified surface topography and soil
conditions. Land use-land management decisions (construction, plant cover,
irrigation regimes) are often made on a parcel level to the extent that it
overrides the characteristics of the underlying natural soil [Pouyat et al.,
2010, Pickett et al., 2011]. To obtain spatial soil moisture data with
modeling approaches, such as using digital elevation models to produce
topographic moisture index, proved to be challenging in such disturbed
environments [Tenenbaum et al., 2006].

For soil ecology research, understanding soil moisture conditions on a field
scale is paramount to identify biogeochemical activity ‘hot spots’ and ‘hot
moments’, and to explain spatial distribution of soil organisms. Spatially
explicit approach to study soil communities is relatively new, but
increasingly recognized as a significant tool in explaining high soil
biodiversity [Ettema and Wardle, 2002, Chust et al., 2003]. One approach to
collect in situ, spatially explicit, continuous soil data is to use sensor
systems, more specifically wireless sensor networks (WSN hereafter). This
technology emerged in the late 1990’s [Cerpa et al., 2001], and promised
inexpensive, hands-free, low-cost, and low-impact environmental data
collection — an attractive alternative to manual data logging — in addition to
providing considerably more data at finer spatial and temporal granularities.
Since originally complete off-the shelf solutions were not available, and both
the sensors themselves and the related data systems needed customization, we,
a group of soil ecologists, physicists and computer scientists started
building our own WSN to monitor the soil ecosystem.

Our project, dubbed LifeUnderYourFeet (LUYF) developed three generations of
hardware and software, and deployed the systems in various habitats including
tropical and temperate forests, agricultural fields and a desert. In this
paper we discuss our efforts and experiences in designing and deploying an
end-to-end system using wireless sensor networks to monitor soil conditions.

##  2 History of Our WSN

Generation 1. Since our project started in 2005 we have gone through three
generations of data collection equipment. The first wireless devices were
manufactured by CrossBow Inc. These MicaZ “mote” (Figure 1) contained
processing, storage, and communication capabilities in a small form factor
(matchstick box size). Besides two simple on-board sensors for temperature and
light, five additional external analog sensors could be connected
simultaneously to the mote via a separate fan-out board. In practice, this
board turned out to be very fragile and was one of the reasons we abandoned
this platform. The device’s on board flash was capable of storing thousands of
sensor measurements for later retrieval. However, the MicaZ motes were quite
expensive costing close to $200 each at the time.

For the soil measurements, we first built our own temperature sensors by
placing small thermistors into plastic vials, about 1.75 in long, and filling
them with epoxy. While the construction was moderately labor intensive, the
material cost was less than $5 (Figure 2). For soil moisture we first
experimented with the Watermark moisture sensor by Irrometer. The performance
of these sensors rapidly degraded with time, thus we switched to the ECH2O
EC-5 moisture sensors by Decagon. We used two AA batteries to power both the
MicaZ mote and its sensors.

Figure 1: Our first platform, based on the MicaZ in Hammond boxes.

In order to protect the motes from the environment we build our own enclosures
out of watertight IP67-rated Hammond enclosures. While this enclosure setup
survived the “bathtub test”, i.e. remained dry for extended periods under
water in a bathtub, the prolonged exposure to the changing weather conditions
along with the holes that we drilled for the sensor cables, even though ample
sealant was used, was enough to compromise its water-tight feature.

Generation 2. In 2007 we switched to a new wireless device, the Tmote Sky from
MoteIV, but kept the custom-built temperature sensors and the Decagon moisture
sensors (Figure 2). The Tmote Sky is in many ways quite similar to the MicaZ,
but considerably less expensive. This platform offered four times the
measurement fidelity and twice as much space for storing samples. We designed
and built an expansion board that allowed us to handle four external analog
sensors.

Figure 2: Our Gen-2 platform, based on the Telos mote.

Besides the external sensors, this mote also had a built in digital humidity
and temperature sensor by Sensirion (as opposed to the analog temperature
sensor on the MicaZ) and two light sensors, one for visible light and the
other one for photosynthetically active radiation. However, as with the MicaZ,
the light sensors were quite sensitive, so under normal daylight they were
either entirely “off” or “on”.

For the enclosure we still used a Hammond box, but in order to increase the
range of the radios, we attached an external antenna (5 dBi gain), directly
connected to the mote, but extending outside the box. The hole for the antenna
was sealed with silicone based caulk. The expansion board was put in its own
case and filled with insulation foam after the moisture and temperature
sensors had been attached. We also upgraded the power supply to a single
D-sized Li-SoCl2 battery that increased the capacity by an order of magnitude.

The new platform was much more stable and professional, but not without its
weak points. First, the sensor connection was quite expensive. The connectors
and the cable for the expansion board cost almost $30. Furthermore, assembling
the whole setup was cumbersome, requiring considerable manual labor. While
there were almost no cases in which we had standing water inside the
enclosures, moisture tended to accumulate over time, and we placed moisture
absorbing silicone beads inside each enclosure to mitigate this problem.

Figure 3: Our Gen-3 platform, based on our PCB design.

Generation 3. In 2013 we have designed and started deploying our third
generation sensing platform, the Breakfast Suite, consisting of the Bacon mote
(Figure 3), and the Toast multiplexer module. These were all designed in house
and manufactured by an OEM in Hungary. This new mote encapsulates our
experiences over the past seven years and is specifically designed for soil
monitoring at different scales. With the same form factor as the Tmote Sky,
the Bacon mote has five times the processing power and eight times the storage
space. Moreover, its average power consumption is an order of magnitude lower
than the Tmote sky and the manufacturing cost for thousands of units was only
$20, in 2012. To achieve large scalability, both in terms of coverage area and
sensor density, we increased the communication range of the Bacon mote with
more efficient radios and designed a new expansion board, the Toast sensor
board, capable of reading eight external sensors at a time. Multiple Toast
boards can be attached to a single Bacon mote at a time thereby facilitating
different sensor densities and more flexible sensor compositions. Furthermore,
we have added a much simpler multiplexer board (miniToast) to the palette,
which is code compatible with the Toast, but contains an on-board high
precision thermistor and a port for additional analog sensor.

##  3 History of Deployments

Roughly parallel to the evolution of hardware platforms over the years, our
deployment architecture went through several changes as we identified weak
points and expanded our usage scenarios. At a high level, we first increased
reliability by adding a permanently-powered “basestation” collection mote
(with Internet access), then worked to maintain reliability while decoupling
network performance from the presence of the basestation.

Figure 4: System architecture of Generation 2 wireless sensor network. Many
deployments of sensing nodes send data through a Gateway computer to a web
server. The raw analog sensor measurements are assigned timestamps converted
to physical units, and screened for faults in the Stage-database. This data is
mapped to geographical locations and the data is organized for retrieval in
the science database.

Early Deployments. The early deployments (Figure 4) had no persistent
infrastructure: motes logged data internally and a field visit was required to
collect their data over a wireless connection to a laptop. While this approach
was more convenient than using wired data loggers, it was still a tedious
manual process. More importantly, due to the lack of a reliable clock on the
motes, periodic references to some external time source were required to map
measurements to points in time. If a mote became unstable (due to low battery,
condensation, or software faults), it could record data that lacked time
references. This problem was addressed by using the on-board light sensors to
estimate the date (by matching the estimated length-of-day to a physical model
of the Earth’s movement around the Sun) and local noon (the midpoint between
dawn and sunset). Even though the precision of this approach was limited to a
few minutes, it was still adequate for the relatively low sensor sampling rate
we used (one sample every 5-10 minutes) [Gupchup et al., 2009].

The first deployment occurred on the Johns Hopkins University campus in a
wooded area and lasted for seven months. Subsequent deployment took place in
urban forests in Baltimore (Leakin park, Cub Hill), deciduous forests in the
Mid-Atlantic Coastal Plains (Smithsonian Environmental Research Center, SERC,
Jug Bay), agricultural fields (USDA), tropical rainforests (Ecuador), and high
altitude deserts (Atacama) (Figure 5). The objectives of collecting soil
moisture and temperature data in these projects were diverse and included
measuring soil carbon cycling, monitoring turtle overwintering behavior and
egg incubation, predicting soil denitrification activity and testing the
system at low barometric pressure and high UV exposure.

The Cub Hill Project. The largest and longest deployment was in an urban
residential area, Called Cub Hill. The Cub Hill site (39.412507 N,-76.520903
W) is located in Parkville, Baltimore County, MD, 14 km north from the center
of Baltimore City. The site has several ongoing studies related to the
Baltimore Ecosystem Study LTER (www.beslter.org) including long-term
anthropogenic effects focused on the atmosphere, soils, hydrology, and
vegetation [Pickett et al., 2008, Pickett et al., 2011]. A permanent urban CO2
flux tower operates at the juxtaposition of forest and residential areas
(Figure 6). To the North and West of the tower is a poplar-oak-hickory stand
with a canopy height of 20-26 meters. To the South is a mix of medium density
residential areas made up of several subdivisions built in the 70’s and 80’s.
Detailed soil and land use mapping has been carried out in the 1 km2 footprint
of the area [Ellis et al., 2006, Yesilonis et al., 2016].

The majority of motes were deployed in the two main land cover types, forest
and grass, but a small number of sensors were installed in planting beds,
covered with mulch or English Ivy. At each sampling location soil temperature
and soil moisture were measured at 10 and 20 cm depths, thus at maximum
capacity a total of 106 soil moisture values were collected at each sampling.
Measurements were taken every 10 minutes.

Maintenance ended in June 2011 and the project terminated in 2012, at which
point we brought all sensors back to the lab. We were interested in the
performance of the soil moisture sensors after being in the field for several
years. First, all sensors were inspected for physical damage and categorized
as follows: no visible damage, minor cracks in probe, and major damage due to
large cracks with internal wires exposed. Laboratory tests were performed in a
10 gal Sterilite storage bin using mineral soil from one of our field sites
that had been previously dried and sieved for homogeneity. The soil was
gradually remoistened and mixed to approximately 0.2 volumetric water content
(VWC). For testing, batches of eight sensors were fully inserted into the soil
and their moisture readings were recorded every 1.5 sec (approx.) for two
minutes using custom developed data loggers (www.lifeunderyourfeet.org).
Sensors that provided measurements that were noticeably different than what
others were reading often were tested several times. Sensors were assessed
based on how similar their mean VWC was to the grand mean of all sensor VWC
means (excluding obviously bad values) and how tight their sampling
distribution was according to their coefficient of variation (CV). Sensors
were categorized as “good” if their mean VWC was within 0.03 VWC of the grand
mean of all sensor means (based on the 3% error rate specified by Decagon
Devices for mineral soil) and their CV was less than 0.03. “Fair” sensors had
a mean VWC within 0.03 VWC of the grand mean, but a CV greater than 0.03.
“Bad” sensors fell out of the allowable range for both criteria.

The Cub Hill experiment in Baltimore City studied the urban/forest gradient,
near an AmeriFlux tower. It exemplifies our second generation of deployments.
These added a persistent basestation mote (attached to an Internet-connected
PC) that could automatically download data periodically and transfer it to a
database (Figure 4). These deployments also used the Koala [Musaloiu-E et al.,
2008] low power collection protocol to enable multi-hop downloads (where the
network cooperates to relay data for motes which are out of the communication
range of the basestation). While regular contacts with the basestation helped
to obviate the need for a reliable on-board clock, there were still a few
periods during which power outages at the deployment site, heavy snow, or
general poor network conditions led to timestamp losses.

In order to support deployments in remote regions (lacking permanent power),
we made a few modifications to the Gen-2 software. We implemented a system
where motes exchange local time references with each other which, when
collected with the data, can be used to map measurements to their correct
point in time, even when there is no basestation for weeks [Gupchup et al.,
2010]. We added several GPS-equipped motes to the network which served as
reliable time references. Finally, we implemented data compression on the
motes, so that even if conditions prevented them from being accessed at all
once deployed, they would have enough space to buffer all their measurements
for the entire deployment duration [Carlson et al., 2010].

Figure 5: Cumulative number of soil moisture samples collected in the
LifeUnderYourFeet project. Major hardware changes are marked with vertical
lines, while horizontal lines show the start and end of deployments. Figure 6:
Land cover map of the Cub Hill site. Each sampling location had one mote with
two soil temperature and two soil moisture sensors attached. Measurements were
taken at 10 and 20 cm depths.

Smithsonian Environmental Research Center. The Gen-3 software decoupled the
energy requirements of individual motes from the overall network size by
segmenting deployments into semi-autonomous patches. This multi-tiered network
approach is a critical step towards enabling large-scale deployments. Our
largest Gen-3 deployment was at the Smithsonian Environmental Research Center
in Edgewater, Maryland. The system monitored air and soil temperature and soil
moisture in deciduous forest stands. For the Mid-Atlantic Region of North
America, climate models predict increased amount of rainfall, distributed more
unevenly throughout the year. Under constructed rainout shelters we
manipulated the frequency and intensity of rainfall, and followed the fate of
carbon using isotopically enriched leaf litter. The pilot experiment lasted
for five months. There were two patches (old and young forest), and two
manipulations (wet and dry) in each stand. Each rainout shelter was equipped
with three sensor assemblies, collecting data from 24 sensors. Another two
were deployed randomly in the forest to collect background data. Over the
course of five months we collected over 90,000 data points.

##  4 Lessons Learned

The LifeUnderYourFeet project has collected over 400MB of raw sensor data,
approximately 20% which were soil moisture data (Figure 5). The Cub Hill
deployment itself collected 100,745,909 samples, out of which 39,471,983 and
17,627,640 were environmental and specifically soil moisture data,
respectively. Below we present a selected set of these results, both on the
performance of the WSN and the sensors and on soil conditions. Other aspects
of the data collection and analysis are reported in [Musaloiu-E et al., 2008,
Gupchup et al., 2010, Savva et al., 2013].

Performance of the wireless sensor network

Figure 7 shows how the number of operational nodes and total data yield
(timestamped and fault-free data) varied over an 18-month maintenance-free
period (Figure 7). All nodes were installed with fresh batteries at the end of
June 2010 and were not serviced again. While the yield declined slowly as
devices failed, the remaining nodes continued to work well even as the network
degraded around them. It’s not until November of 2011 that so few nodes remain
in operation that it became difficult to reach them and obtain time references
for them.

Figure 7: Daily data yield (as a fraction of expected data yield) for the Cub
Hill deployment. Starting point (July 2010) indicates a system-wide battery
replacement. The solid line indicates how much data was recovered as a
fraction of the entire 50-node network’s expected yield, while the dashed line
only considers the remaining operational nodes.

Figure 8 shows the distribution of maintenance intervals on our system. While
a handful of devices fail within the first few months (likely due to
physical/moisture damage), 90% of the nodes ran for more than 6 months without
maintenance, and 77% ran for over a year without maintenance. With regular
twice-yearly site visits, such a deployment could be expected to continuously
deliver 90%+ yields.

Figure 8: Mote maintenance statistics of the Cub Hill deployment following
site-wide battery replacement on 06/24/10. Solid line is the cumulative
distribution of the node of maintenance intervals. The x axis indicates the
number of days from installation of a node to the last date where 90% or more
of its expected data volume was recovered.

We evaluated mote failure according to the underlying causes. Software defects
caused 11% of the mote failures. About half of the failures were due to low
batteries or moisture in their enclosures (43% and 9%, respectively). The rest
were marked as “unknown”, because they showed neither low battery nor high
moisture before their disappearance. These could be nodes with a catastrophic
leak during a rain event, nodes that froze and drained their battery in one
shot, nodes that suffered physical damage (such as a falling tree or animal
chewing), or nodes that failed for no apparent reason. Given that the
deployment was in an urban environment, surprisingly, no motes were stolen or
vandalized.

Wireless Frequency Band

First and foremost, as we have learned the hard way, the standard 2.4-2.5 GHz
band is substantially absorbed by water vapor, and on days with a lot rain and
humid air the range of the 2.5GHz radios have dropped substantially. So with
our Gen 3 hardware we have switched to the 900MHz frequency band, and these
problems have gone away.

Waterproofing

Even though the assembled boxes initially provided a perfect seal, the
changing environmental conditions naturally led to increasing moisture. With
the on-board moisture sensor, we were able to monitor the conditions inside
the boxes and have seen the moisture steadily increasing. Temperature inside
the box became quite high, sometime reaching 70oC, due to sun exposure
(greenhouse effect). This led to a substantial over-pressure inside, which
over time created small micro-cracks in the gasket and the sealant, resulting
in an equalization of the pressure. Once the weather changed and suddenly cold
rain fell on the box, the temperature and pressure of the box dropped, sucking
in moist air. Thus, during every cycle the moisture kept steadily increasing.
After about 6 months to a year this has caused the motes to stop working. In
the end, we have decided to use semi-sealed acrylic tubes with an open bottom,
which are always in a temperature and humidity equilibrium with the outside.

Power Usage

Battery consumption was in important factor, and the typical analog sensors
required a current draw of about 10mA. In environmental science the can afford
a modest data collection rate, so in practice we ended up using a 10ms/sensor
sampling interval, taken at every 20 minutes. Even with 8 sensors this only
amounts to about $100\mu$A for an 9-sensor mote, and about $25\mu$A for a mote
with 2 sensors.

Another lesson we learned that operating the motes at 3.3V leaves too small
margin for the battery depletion. Due to temperature variations, the voltages
of the LiPo batteries fluctuate in excess of 100 mV during a typical daily
cycle. The dropout voltage on a typical voltage regulator does not leave much
headroom for operating at 3.3V, so we have gone to 3V operating voltage and a
very low dropout voltage chip, giving us a much longer battery life.

Deployment Tradeoffs

We have also learned that requiring a full peer-to-peer network with real-time
Internet connectivity so that we can assess the sensors’ status at any moment
makes practical deployments much too complex. While this was used for our big
campaigns, e.g. Cub Hill in Baltimore, many other use cases require just a few
sensors but spread out in many small clusters over a wide area. The price of
sensors come into play as well. In the dense deployment we had many CO2
sensors, with a typical cost of a few hundred to a few thousand dollars – it
was good to know that they were in place. The dense deployment use case was
big and expensive enough that we have permanent internet gateway, with access
to line power and a cable connection.

The wide and shallow deployments typically require only a few temperature and
moisture sensors, placed at various depths, typically 5-10-15 cm. The moisture
sensors are typically around $100, and thus deploying them on a dedicated mote
with a miniToast temperature sensor is a reasonable deployment choice. In this
setup we can operate the motes in a data logger mode, waking up the whole
network about only once a month and using the mesh communication to
incrementally download the new data. This mode saves power, thus enabled us to
use even smaller batteries, making the whole assembly much smaller.

Software infrastructure

It was also extremely important that we adopted the well-tested TinyOS
platform even when we moved to build our customized Gen 3 hardware. This was
the reason why we stayed with the MSP430 based chip, but with the embedded
multi-band radio, enabling us to go to 900MHz.

##  5 Soil Moisture Results

At the end of the day, what matters is whether these systems can provide
insight into physical systems that would otherwise be impractical to attain.
The rich dataset allows for a variety of analyses. For instance, we can
compare conditions in different land use-land cover types using daily or
monthly means and seasonal trends (Figure 10). Interestingly, monthly mean
values in forest and grass were very similar, while values in the “other”
category were consistently lower.

Figures 9 and 10 illustrate what makes WSNs so well-suited for this domain.
Even though the averages are similar, the individual sampling locations varied
a great deal. Moreover, our dataset shows how soil moisture responds to
rainfall events at fine temporal resolution, grouping locations by ground
cover. Not only can we see clear differences between the cover types, we can
capture the small-scale heterogeneity between sampling locations under the
same cover. More detailed analysis of these data and the interactions on soil
temperature and soil moisture are discussed in [Savva et al., 2013]. Spatial
analysis allows us to observe the soil response to extreme events (Figure 10),
to explore temporal stability of spatial structure [Savva et al., 2013], and
to interpret soil fauna distribution [Szlavecz et al., 2011] in this
residential neighborhood. Soil moisture data, along with continuous soil CO2
concentration data collected by the WSN can be used to build a model for soil
CO2 efflux in urban forest and grass [Chun et al., 2011]. Combined with the
urban CO2 flux tower data this information is then used to build a coupled
urban carbon and water cycle model (John Hom, pers. comm.).

Figure 9: Local variation of soil moisture (VMC) at two land cover types in
the Cub Hill residential neighborhood in Baltimore County, MD, between March
and June 2009. A subset of locations are shown. Each cell represents daily
average values at 10 cm depth. Daily precipitation values are also shown.
Figure 10: Response of soil moisture to extreme precipitation at Cub Hill.
Spatial map shows the change in volumetric soil moisture content between hours
before rain and during peak precipitation intensity.measurements were taken at
10 cm depths. A: regular rain event, B: Hurricane Irene.

The primary objective of the Life Under Your Feet project was to design and
build an end-to-end wireless sensor network (WSN) for monitoring the soil
ecosystem and to test the system in a variety of environmental conditions.
Similar efforts have been reported [Cardell-Oliver et al., 2005, Sikka et al.,
2006, Ramanathan et al., 2009], or still ongoing
(http://soilscape.eecs.umich.edu/). To our knowledge, at the time of the
deployment, the Cub Hill project was the largest and it was the longest
experiment of its size. In general, our deployments met their key goals: they
survived for long periods in the field, while reliably collecting large
volumes of data. The data can be utilized for a variety of projects from
building hydrology models to identifying biological activity hotspots. A
wireless sensor network can be used for validation of remotely sensed soil
moisture data. As technology advances, the system keeps evolving. However,
further development of hardware will always have to optimize among conflicting
demands: increasing scale of deployment, while keeping the system reliable,
and keeping the cost low. The Gen-3 platform and software addresses many of
the lessons we learned from previous deployments, and the cost of one mote
($20) is now negligible compared to the cost of the sensors themselves.
Ultimately the goal of such approach is to gain insight to the spatio-
temporally complex and extremely species rich soil ecosystem.

##  6 The Gen-3 Hardware

The Bacon

The Breakfast Suite has several modular components. The main unit is the so
called Bacon board, which has the wireless transmitter. We decided to use the
CC430F5137IRGZ MCU, which has several useful properties. It has the MSP430
core, immediately providing compatibility with the existing TinyOS stack. It
has a multiband radio transmitter supporting the 900Mhz band, it still uses
the ZigBee packet format on all frequencies, has more processing power and
eight times more memory than the original MSP430 (Figure 11). Furthermore, it
has ultra-low power consumption. We have also placed a 64 Mbit serial flash
memory on board (Numonyx M25P64-VME6G) for buffering the acquired samples. We
are using a low dropout LDO providing 3V of stabilized voltage
(MCP1700T-3002E/TT, with a dropout voltage $<$ 25mV at a 25mA current).

Figure 11: The CC430-based Bacon node, our Gen-3 radio platform.

The board has options for an on-board 1/2 AA 3.7V LiPo battery as well as it
has an external battery connector. The boards have been also designed to
accept a radio power amplifier, and an external antenna, but we have only
populated about 100 boards with that option. These motes can serve as longer
range relay nodes. We have an on-board analog switch turning the flash power
off when it is not required, saving additional current in deep sleep mode. We
have an additional 10-pin JTAG connector, for deep debugging of the system.

We have two sensors on board, one is a linear thermistor (Microchip
MCP9700AT-E/LT) running in 12-bit, 0.1 $\deg$C sensitivity, the other is an
Avago APDS-9007 ambient light sensor. We are using two micro USB connectors,
one to connect to a programmer board, the other to connect to the
multiplexers. The board is also actively monitoring (and saving) the battery
voltage.

The Toast

The Toast board is an intelligent multiplexer/interface for up to eight analog
sensors. It is based on a light-weight MSP430F235TRGCR MCU, which takes
commands from the Bacon node, turns the sensors on for measurement for a
predetermined period (10ms), acquires an analog voltage measurement for each
enabled channel and uploads the data to the Bacon for storage in flash. The
communication between the Bacon and the Toast is using the I2C protocol.
Several Toast modules can be daisy chained.

Figure 12: The CC430-based Toast and miniToast analog interface/multiplexer
boards.

The miniToast

The miniToast is a compact, simplified version of the Toast for simple mote
configurations, when only a single analog sensor is needed. It includes two
additional internal channels, one is a high precision analog thermistor (US
Sensor PS103J2), the other is a measurement of the supply voltage to the
sensors. The miniToast module is placed in epoxy so that it can be buried
underground, together with the additional external sensor.

The USB Programmer

This board enables the programming of the Bacon and Toast boards from a PC
host. It contains an FTDI232R interface chip, and an ADG715T 3.3V voltage
regulator. For programming the Bacon and Toast combination, we need to first
connect a Bacon board to the programmer, and then the Toast. One can update
the firmware on each boards, as well as add id numbers (barcodes) to both
devices as well as for the individual sensors. These ID numbers are than
contained in the various status messages and data records.

Figure 13: The USB programmer board, with and without its 3D-printed
enclosure.

##  7 The Gen-3 Software Stack

Concurrent Transmission w. Forwarder Selection

One major goal of the Gen-3 platform is to to avoid the inherent limitations
in selecting data transmission routes over unreliable hardware and fickle link
dynamics. The Koala data collection system[Musaloiu-E et al., 2008] uses a
central source-routing mechanism where the base station decides the route of
each download by analyzing the probes sent from nodes in the network. However,
when the batteries of a few nodes in the network are depleted, the base
station often fails to find a reliable route, since a node on a low voltage
may still send wake-up probes and be included in the forwarder route, even if
it could no longer reliably transmit data. Consequently, frequent download
retries cause high duty cycles that drain the batteries even faster. One
possible solution to the problem is to use detailed node status information
(e.g. battery voltage, humidity in the enclosure) in the route selection
process, yet obtaining detailed link quality information demand significant
energy and computation costs, placing a high burden on resource-constrained
motes.

In Gen-3 network, we take an alternative method by leveraging non-destructive
interference to create redundant simultaneous delivery paths to multiply the
probability of reaching the end node over an unreliable network. Under this
approach, we use simple hop counts to identify a subset of network that
roughly lies between the source and destination as the set of potential
forwarders. By using the precisely-timed radio on board bacon motes to
schedule transmissions to occur simultaneously, we can send a data packet over
this set of nodes with very low risk of loss due to interference. This
protocol, which we call concurrent transmission with forwarder selection
(CXFS), requires neither the overhead of calculating a single optimal path
between the the source and the sink nor the costs of indiscriminately
forwarding the message across the entire network as in a simple flooding
method. This balance between simplicity and selectivity helps the sensor
network attain both high throughout and low energy consumption.

Multi-tiered Network Hierarchy

Studies in soil ecology sometimes require comparing distinct habitats over a
relatively large region while simultaneously capturing the heterogeneity
within each habitat. This configuration often leads to the need of setting up
multiple sensors in small clusters. To account for the spatial patchiness of
the deployment, the entire deployment is divided into one or more patches,
where each patch contains a router mote equipped with long range transceivers
and a cluster of leaves motes. A router independently collects data from the
leaves in its patch, and a basestation periodically downloads data from all
routers. This multi-tiered structure avoids the need to install multiple relay
motes between patches and allows energy-efficient sampling over heterogeneous
landscape.

Figure 14: Multi-tiered network segments.

Data Pipeline and Meta Data Management

With a hardware interface to analog sensors and a reliable networking
structure in place, the next step is to build an end-to-end data pipeline from
sensors to database. On each mote, we divide the flash storage into a setting
storage and a log records storage. The former is used to store customized
configurations such as sampling interval and unique id, whereas the later is
used by both the Bacon and Toast modules to record samples collected. An auto-
push component keeps track of data recorded in the flash, pushes the data from
the flash to the network stack when needed, and handles recover requests for
missing data based on specific cookie and length parameters. If cases where
log record packets are forwarded from leaf motes to a router mote, they will
be temporarily stored in the router’s log with a TUNNELED_MESSAGE record
appended. During a download, the base station will first attempt to receive
all information from the router’s log, and it will retrieve log records from
the leaf motes only if the information is absent from the router.

Figure 15: Interactions between major components of the software.

A Python program on the PC will process each log record packet when they
arrive from the base station. The program first stores a safe copy of the raw
packet in a binary table, and then parses the packet to extract individual
records. Each record is identified by its type and dispatched to a
corresponding decoder. The decoder then decodes the record to an ASCII string,
extracts the fields from the string, and inserts the fields into a matching
table in the database.

The above description highlights the flow of data from the sensor to the
database. Yet for the system to collect scientifically meaningful data, it is
also critical to systematically track deployment metadata such as the type of
the sensor, the channel assignment, and the pairing between bacon and toast
boards. In the third generation software, metadata tracking is enforced at
installation stage by a dedicated labeler program. The manufacturer ID,
barcode ID, and sensor assignments are stored in both a local database and the
setting storage volumes of the Bacon and Toast boards. The program will not
generate data reports unless the metadata associated with the deployment is
present.

Figure 16: Data flow in PC.

##  8 The Gen-4 Software Platform

Integrated GUI

The completion of the Gen-3 platform enabled a wide range of environmental
monitoring opportunities. After the development, the system has been test-
deployed in SERC and yielded promising scientific data. Despite the technical
success, our field tests revealed several stability issues that required a
consistent involvement of technicians, and the platform’s operational
complexity hindered its wide adoption by soil scientists. The current
interface only allows a user to download all the data from a patch of sensors,
yet a user may be interested in retrieving data from a specific mote to obtain
data with higher granularity. Furthermore, the Gen-3 system does not perform
quality-control measures on the data collected or alert the user of any
potential issues, so it might take an end-user several months to realize the
issue while the critical window of research is wasted.

Figure 17: Prototype design of the generation-4 software platform. The new
software will provide a convenient interface for users to interact with the
sensor network

These limitations have prompted us to redesign the high-level, user facing
components, and to create an integrated software platform to streamline device
management, field deployment, quality control and data reporting. A recent
Python-based web-app framework (Dash) provides us the ability to implement
such a platform with comparative ease. Through a web-based graphic interface,
the user will be first guided through the process of labelling motes and
sensors, setting radio channels and sampling intervals, and managing
deployment-wide metadata (Figure 17). When in field, the user can manage the
deployment, edit the metadata for each unit, or add or remove a device if
needed. Through an interactive portal, the user can download data from the
entire deployment, a patch within the deployment, or a specific mote as
desired. Progress bars and a color grid on the screen will display the status
of download. When a download completes, the status of each mote, including
battery voltage and percentage of samples retrieved, will be reported. The
platform will then run a quality control algorithm to check the database for
missing, duplicate, or anomalous data, and alert the user if the problem is
not recoverable by automatic correction. This platform will also provide
customizable data visualization and report functions, allowing a user to
generate spreadsheets and graphics with only a few clicks “in situ”. Finally,
the platform will also provide optional user authentication and data upload
function, allowing a user to share data while controlling access.

Data Hosting and Analytics

Our data will be hosted on a scalable collaborative data analytics platform,
which integrates about 6PB of file storage, several PB of databases,
automatically generates user logs, and provides about 100 virtual machines for
interactive and batch computations. All code, database tables and data
products are shareable at different granularities (users, groups, world). The
system today is supporting more than 70 different projects in a variety of
science domains, from astronomy to turbulence. The analyses can also use
server-side Jupyter/iPython notebooks. These are preconfigured with database
access, thus users can run their SQL queries out of Python. The Jupyter
environment also enables Matlab and R. All major machine learning toolkits are
available on the system, including several V100-based GPU servers. Most of the
sensor data collected so far has already been moved to the SciServer, to
alleviate the need for maintaining a separate data system for our project. We
will use this system for all future data hosting and analysis.

##  9 Summary

Soil moisture is a key driver of many soil physical and biogeochemical
processes, and an important component of the water cycle. In the US several
platforms exist to monitor soil moisture, but a collective effort to establish
a National Soil Monitoring Network has emerged only recently. Currently
neither the existing networks nor the SMAP satellite provide data on soil
moisture in urban environments. Due to the enormous heterogeneity of the urban
landscape, the diversity of urban soils from remnants of naturally developing
soils to engineered substrates, and various management practices, physico-
chemical properties cannot be simply derived or modeled from natural soil
forming factors and thus have to be measured directly.

An ideal urban soil monitoring network would consist of many small sensor
clusters, and should deployed on all major land use types. Lawns parks are a
permanent feature in the urban-suburban landscape, but additional land uses,
vacant lots, community gardens, remnant patches of regional biome, and other
unmanaged areas should also be monitored. Wireless data collection allows less
disturbance and less intrusion of the sites, which are often privately owned.

In Baltimore, in our next major deployment project, we are planning to monitor
over 200 sites, called “parcels”. A parcel is a unit of investigation and it
is managed by a single entity: a company, organization, or an individual. The
plan is to deploy a set of soil temperature and moisture sensors at different
depths, and in several patches within the parcel, for example lawns and
planting beds.

There is an increasing need for this type of information not only in the
scientific community but in various sectors of the community. For instance,
cities are relying on, and even by policy requiring, alternative stormwater
management technologies, from green roofs, to living walls, bioswales, and
bioretention systems. Yet, there is little opportunity for design and
engineering professionals to evaluate their post-construction performance in
order to improve future projects and revise sustainable design guidelines.
Sensor technology would enable designers, engineers, and scientists to collect
the data required to meet the needs of urban populations by improving the
development high-performance landscapes and green infrastructure projects that
are multi-functional in protecting environmental quality, while providing
social and economic benefits in urban centers.

Our Gen-3 platform can be ideally used for the wide area deployment described
above. The main challenge for such wide area deployments is to make the whole
configuration, deployment and ongoing data collection process much more
streamlined and simple, and enable a variety of users, including soil
scientists, urban ecologists, practitioners, as well as community scientists
to be in full control of the whole experiment. In the same spirit, the
analysis of the data must be made much simpler by using an integrated
collaborative analysis environment, which integrates databases, file stores
and Jupyter notebooks.

In this paper we presented the history of developing several generations of
inexpensive sensors to measure soil properties. Our architecture evolved a lot
over the years and now we have an inexpensive and robust hardware/software
architecture that can collect data at an extremely low power consumption, and
can be used in deployments such as the one described above.

## ACKNOWLEDGEMENTS

The Life Under Your Feet project started out with seed grants from Microsoft
Research and the Seaver Institute. We are most grateful to Jim Gray who was
instrumental in getting this project off the ground, and to Dan Fay and Tony
Hey for their continuing support and encouragement. Later this project was
partially supported by several grants from the National Science Foundation
(NSF IDBR-0754782 and NSF DEB-0423476, NSF-ERC EEC-0540832). A seed grand from
JHU 21 Century Cities Initiative supported the current research. The Gordon
and Betty Moore Foundation sponsored the development of the Breakfast Suite.
Undergraduates Josh Cogan, Julia Klofas and Justin Silverman helped building
and testing the WSN. Mike Liang contributed to the software development;
Jordan Raddick, Taesung Kim and Luis Grimaldo were instrumental in developing
Grazor. Thanks are due to the Maryland Department of Natural Resources for
allowing us to use their site as testbed, and to John Hom of the US Forest
Service for hosting the gateway computer in his lab at Cub Hill.

## REFERENCES

  * Cardell-Oliver et al., 2005 Cardell-Oliver, R., Kranz, M., Smettem, K., and Mayer, K. (2005).  A reactive soil moisture sensor network: Design and field evaluation.  International journal of distributed sensor networks, 1(2):149–162.
  * Carlson et al., 2010 Carlson, D., Gupchup, J., Fatland, R., and Terzis, A. (2010).  K2: a system for campaign deployments of wireless sensor networks.  In International Workshop on Real-world Wireless Sensor Networks, pages 1–12. Springer.
  * Cerpa et al., 2001 Cerpa, A., Elson, J., Estrin, D., Girod, L., Hamilton, M., and Zhao, J. (2001).  Habitat monitoring: Application driver for wireless communications technology.  ACM SIGCOMM Computer Communication Review, 31(2 supplement):20–41.
  * Chun et al., 2011 Chun, J., Szlavecz, K., Ferrer, D., Bernard, M., Pitz, S., Hom, J., and Zaitchik, B. (2011).  Estimation of soil co2 effluxes from suburban forest and lawn using continuous measurements of co2 profiles in soils and a process-based model.  AGUFM, 2011:B11A–0462.
  * Chust et al., 2003 Chust, G., Pretus, J., Ducrot, D., Bedos, A., and Deharveng, L. (2003).  Response of soil fauna to landscape heterogeneity: determining optimal scales for biodiversity modeling.  Conservation Biology, 17(6):1712–1723.
  * Ellis et al., 2006 Ellis, E. C., Wang, H., Xiao, H. S., Peng, K., Liu, X. P., Li, S. C., Ouyang, H., Cheng, X., and Yang, L. Z. (2006).  Measuring long-term ecological changes in densely populated landscapes using current and historical high resolution imagery.  Remote Sensing of Environment, 100(4):457–473.
  * Ettema and Wardle, 2002 Ettema, C. H. and Wardle, D. A. (2002).  Spatial soil ecology.  Trends in ecology & evolution, 17(4):177–183.
  * Gupchup et al., 2010 Gupchup, J., Carlson, D., Musăloiu-e, R., Szalay, A., and Terzis, A. (2010).  Phoenix: An epidemic approach to time reconstruction.  In European Conference on Wireless Sensor Networks, pages 17–32. Springer.
  * Gupchup et al., 2009 Gupchup, J., Musăloiu-e, R., Szalay, A., and Terzis, A. (2009).  Sundial: Using sunlight to reconstruct global timestamps.  In European Conference on Wireless Sensor Networks, pages 183–198. Springer.
  * Musaloiu-E et al., 2008 Musaloiu-E, R., Liang, C.-J. M., and Terzis, A. (2008).  Koala: Ultra-low power data retrieval in wireless sensor networks.  In 2008 International Conference on Information Processing in Sensor Networks (IPSN 2008), pages 421–432. IEEE.
  * Pickett et al., 2011 Pickett, S. T., Cadenasso, M. L., Grove, J. M., Boone, C. G., Groffman, P. M., Irwin, E., Kaushal, S. S., Marshall, V., McGrath, B. P., Nilon, C. H., et al. (2011).  Urban ecological systems: Scientific foundations and a decade of progress.  Journal of environmental management, 92(3):331–362.
  * Pickett et al., 2008 Pickett, S. T., Cadenasso, M. L., Grove, J. M., Groffman, P. M., Band, L. E., Boone, C. G., Burch, W. R., Grimmond, C. S. B., Hom, J., Jenkins, J. C., et al. (2008).  Beyond urban legends: an emerging framework of urban ecology, as illustrated by the baltimore ecosystem study.  BioScience, 58(2):139–150.
  * Pouyat et al., 2010 Pouyat, R. V., Szlavecz, K., Yesilonis, I. D., Groffman, P. M., and Schwarz, K. (2010).  Chemical, physical, and biological characteristics of urban soils.  Urban ecosystem ecology, 55:119–152.
  * Ramanathan et al., 2009 Ramanathan, N., Schoellhammer, T., Kohler, E., Whitehouse, K., Harmon, T., and Estrin, D. (2009).  Suelo: human-assisted sensing for exploratory soil monitoring studies.  In Proceedings of the 7th ACM Conference on Embedded Networked Sensor Systems, pages 197–210.
  * Robertson et al., 1994 Robertson, G. P., Gross, K. L., Caldwell, M., and Pearcy, R. (1994).  Assessing the heterogeneity of belowground resources: quantifying pattern and scale.  Exploitation of environmental heterogeneity by plants: ecophysiological processes above-and belowground, pages 237–253.
  * Savva et al., 2013 Savva, Y., Szlavecz, K., Carlson, D., Gupchup, J., Szalay, A., and Terzis, A. (2013).  Spatial patterns of soil moisture under forest and grass land cover in a suburban area, in maryland, usa.  Geoderma, 192:202–210.
  * Sikka et al., 2006 Sikka, P., Corke, P., Valencia, P., Crossman, C., Swain, D., and Bishop-Hurley, G. (2006).  Wireless adhoc sensor and actuator networks on the farm.  In Proceedings of the 5th international conference on Information processing in sensor networks, pages 492–499.
  * Szlavecz et al., 2011 Szlavecz, K., Warren, P., and Pickett, S. (2011).  Biodiversity on the urban landscape.  In Human Population, pages 75–101. Springer.
  * Tenenbaum et al., 2006 Tenenbaum, D., Band, L., Kenworthy, S., and Tague, C. (2006).  Analysis of soil moisture patterns in forested and suburban catchments in baltimore, maryland, using high-resolution photogrammetric and lidar digital elevation datasets.  Hydrological Processes: An International Journal, 20(2):219–240.
  * Yesilonis et al., 2016 Yesilonis, I. D., Pouyat, R., Russell-Anelli, J., and Powell, E. (2016).  The effects of landscape cover on surface soils in a low density residential neighborhood in baltimore, maryland.  Urban ecosystems, 19(1):115–129.
  * Young and Crawford, 2004 Young, I. M. and Crawford, J. W. (2004).  Interactions and self-organization in the soil-microbe complex.  Science, 304(5677):1634–1637.