diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2e8b986 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright © 2019 Alexander L. Hayes + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..ac93a27 --- /dev/null +++ b/README.rst @@ -0,0 +1,121 @@ +.. raw:: html + +

+

How Hot is the IU School of Informatics? A Temperature Sensing Study

+ +

🔥🔥🔥

+

+

+ +

+ +What are some of the challenges of sensing temperature in both indoor and +outdoor environments? We will attempt to peer into some of the challenges +over the next five steps. Each step will involve recording the temperature +while either performing an activity or going to a location around the Informatics Building. + +This short study was proposed by Rob M. Long for a Methods Activity as part of +`Professor James Clawson's `_ *"Field Deployments"* +course. + +Instructions +------------ + +**First Run:** + +Manually record the start and end time for each event. + +1. *ProHealth Office:* + + * Let the sensor collect data for five minutes while sitting at your desk. + * Copy and paste your data. + +2. *Outside:* + + * Exit Informatics East through the north-east connector space door. + * Walk around the building (moving left through the parking lot) and stop in the courtyard. + * Sit at a bench for three minutes. + * Walk inside, stop recording, and copy and paste your data. + +3. *A Classroom:* + + * Find an empty classroom. Record the room temperature for one minute. + * Turn off the lights in the room for two minutes. + * Turn the lights back on and continue recording for one more minute. + * Stop recording, copy and paste your data. + +4. *The Break Room:* + + * Turn on the sensor and record for one minute. + * Place the sensor inside the fridge (or freezer) for three minutes. + * Remove the sensor, copy and paste your data. + +5. *The Random Walk:* + + * Start recording from the Informatics East Lobby. + * Walk around the building for about five minutes, record where you go. + +**Second Run:** + +Repeat steps 2 & 3. This time: increase the delay time to ten seconds. + +.. code-block:: C + + void loop() { + // --snip-- + delay(10000); + startTime += 10; + } + +Methods +------- + +This activity requires a +`"SparkFun Digital Temperature Sensor Breakout TMP102" `_ +for measuring temperature, a `"SparkFun RedBoard" `_, +a breadboard, and a five wires. + +One limitation is that all results are printed to the Serial Monitor. This +means that a laptop will need to be carried to provide power and collect +results. + +The following schematic shows how to wire the sensor to the board. + +.. raw:: html + + + +The wires do not need to be the exact same colors. The labels are included so +they can match the colors used here: + +.. raw:: html + +

+ +

+ +Results +------- + +Data are contained in the ``data/`` directory, split into ``data1.txt`` and +``data2.txt``. The first contains steps 1-5, and the second contains steps +2-3 when they were repeated with higher delay time. + +``data1.txt`` uses a 2-second delay time. ``data2.txt`` uses a 10-second +delay time. + +``src/plot_data.py`` can be used to plot temperature vs. an integer. + +* The integers displayed on the x-axis represent the number of seconds after + ``12:00:02`` for the first set, and the number of seconds after ``12:31:30`` + for the second set. +* Since the temperatures and the dynamics were more of interest than the + actual times, the timestamps are left in the raw form. +* The y-axis represents the temperature in degrees Fahrenheit, and the label + specifies which activity the temperatures correspond to. + +.. raw:: html + +

+ +

diff --git a/data/data1.txt b/data/data1.txt new file mode 100644 index 0000000..0744c03 --- /dev/null +++ b/data/data1.txt @@ -0,0 +1,887 @@ +Time,TemperatureF +0,73.06 +2,73.06 +4,73.06 +6,73.06 +8,73.06 +10,73.06 +12,73.18 +14,73.18 +16,73.18 +18,73.18 +20,73.18 +22,73.18 +24,73.18 +26,73.18 +28,73.29 +30,73.29 +32,73.29 +34,73.29 +36,73.29 +38,73.29 +40,73.29 +42,73.29 +44,73.29 +46,73.40 +48,73.29 +50,73.40 +52,73.40 +54,73.40 +56,73.40 +58,73.40 +60,73.40 +62,73.40 +64,73.40 +66,73.51 +68,73.51 +70,73.51 +72,73.51 +74,73.51 +76,73.51 +78,73.51 +80,73.51 +82,73.51 +84,73.62 +86,73.62 +88,73.62 +90,73.62 +92,73.62 +94,73.62 +96,73.62 +98,73.62 +100,73.62 +102,73.62 +104,73.74 +106,73.74 +108,73.74 +110,73.74 +112,73.74 +114,73.74 +116,73.74 +118,73.74 +120,73.74 +122,73.74 +124,73.74 +126,73.85 +128,73.85 +130,73.85 +132,73.85 +134,73.85 +136,73.85 +138,73.85 +140,73.85 +142,73.85 +144,73.85 +146,73.85 +148,73.96 +150,73.96 +152,73.96 +154,73.96 +156,73.96 +158,73.96 +160,73.96 +162,73.96 +164,73.96 +166,73.96 +168,73.96 +170,73.96 +172,74.07 +174,74.07 +176,74.07 +178,74.07 +180,74.07 +182,74.07 +184,74.07 +186,74.07 +188,74.07 +190,74.07 +192,74.07 +194,74.07 +196,74.07 +198,74.07 +200,74.19 +202,74.19 +204,74.07 +206,74.19 +208,74.19 +210,74.19 +212,74.19 +214,74.19 +216,74.19 +218,74.19 +220,74.19 +222,74.19 +224,74.19 +226,74.19 +228,74.19 +230,74.19 +232,74.19 +234,74.19 +236,74.19 +238,74.19 +240,74.19 +242,74.19 +244,74.19 +246,74.19 +248,74.19 +250,74.30 +252,74.19 +254,74.30 +256,74.19 +258,74.19 +260,74.30 +262,74.19 +264,74.30 +266,74.30 +268,74.30 +270,74.30 +272,74.19 +274,74.19 +276,74.19 +278,74.30 +280,74.30 +282,74.30 +284,74.30 +286,74.30 +288,74.30 +290,74.30 +292,74.30 +294,74.30 +296,74.30 +298,74.30 +300,74.30 +302,74.30 +304,74.30 +306,74.41 +308,74.41 +310,74.41 +312,74.30 +314,74.30 +316,74.19 +318,74.07 +320,73.96 +322,73.85 +324,73.74 +326,73.74 +328,73.62 +330,73.51 +332,73.51 +334,73.40 +336,73.29 +338,73.29 +340,73.29 +342,73.18 +344,73.18 +346,72.95 +348,72.84 +350,72.61 +352,72.39 +354,72.16 +356,72.16 +358,72.16 +360,72.05 +362,71.82 +364,71.71 +366,71.71 +368,71.49 +370,71.49 +372,71.15 +374,70.70 +376,70.59 +378,70.36 +380,70.25 +382,70.25 +384,70.25 +386,70.25 +388,70.14 +390,69.91 +392,69.46 +394,69.35 +396,69.24 +398,69.35 +400,69.35 +402,69.35 +404,69.35 +406,69.46 +408,69.35 +410,69.12 +412,69.12 +414,69.01 +416,68.90 +418,69.01 +420,68.90 +422,68.68 +424,68.56 +426,68.45 +428,68.56 +430,68.56 +432,68.68 +434,68.79 +436,68.90 +438,69.01 +440,69.12 +442,69.12 +444,69.24 +446,69.24 +448,69.35 +450,69.46 +452,69.46 +454,69.57 +456,69.57 +458,69.69 +460,69.80 +462,70.02 +464,70.02 +466,70.02 +468,70.14 +470,70.14 +472,70.25 +474,70.36 +476,70.47 +478,70.36 +480,70.36 +482,70.47 +484,70.59 +486,70.59 +488,70.59 +490,70.70 +492,70.81 +494,70.81 +496,70.59 +498,70.59 +500,70.59 +502,70.59 +504,70.59 +506,70.70 +508,70.59 +510,70.70 +512,70.81 +514,70.81 +516,70.81 +518,70.93 +520,70.81 +522,70.93 +524,70.93 +526,71.04 +528,70.93 +530,70.93 +532,70.81 +534,70.81 +536,70.59 +538,70.59 +540,70.70 +542,70.70 +544,70.81 +546,70.93 +548,70.93 +550,71.04 +552,71.04 +554,71.04 +556,71.04 +558,70.93 +560,70.81 +562,70.70 +564,70.59 +566,70.47 +568,70.47 +570,70.59 +572,70.59 +574,70.59 +576,70.47 +578,70.47 +580,70.36 +582,70.36 +584,70.36 +586,70.14 +588,70.25 +590,70.14 +592,70.14 +594,70.14 +596,70.02 +598,70.14 +600,70.02 +602,70.02 +604,70.02 +606,70.02 +608,70.02 +610,70.02 +612,70.02 +614,70.02 +616,70.02 +618,70.14 +620,70.25 +622,70.36 +624,70.47 +626,70.59 +628,70.59 +630,70.81 +632,70.93 +634,70.93 +636,71.04 +638,71.15 +640,71.26 +642,71.26 +644,71.37 +646,71.49 +648,71.49 +650,71.60 +652,71.60 +654,71.71 +656,71.71 +658,71.82 +660,71.82 +662,71.82 +664,71.94 +666,71.94 +668,72.05 +670,72.05 +672,72.05 +674,72.16 +676,72.16 +678,72.27 +680,72.27 +682,72.27 +684,72.39 +686,72.39 +688,72.39 +690,72.39 +692,72.50 +694,72.50 +696,72.61 +698,72.61 +700,72.61 +702,72.72 +704,72.72 +706,72.72 +708,72.72 +710,72.72 +712,72.84 +714,72.84 +716,72.84 +718,72.95 +720,72.95 +722,72.95 +724,72.95 +726,72.95 +728,72.95 +730,72.95 +732,72.95 +734,73.06 +736,73.06 +738,73.06 +740,73.06 +742,73.06 +744,73.06 +746,73.06 +748,73.18 +750,73.18 +752,73.18 +754,73.18 +756,73.18 +758,73.18 +760,73.18 +762,73.18 +764,73.29 +766,73.29 +768,73.29 +770,73.29 +772,73.29 +774,73.29 +776,73.29 +778,73.29 +780,73.29 +782,73.29 +784,73.40 +786,73.40 +788,73.40 +790,73.40 +792,73.40 +794,73.40 +796,73.51 +798,73.51 +800,73.51 +802,73.51 +804,73.51 +806,73.51 +808,73.51 +810,73.62 +812,73.62 +814,73.62 +816,73.62 +818,73.62 +820,73.62 +822,73.62 +824,73.62 +826,73.62 +828,73.62 +830,73.74 +832,73.74 +834,73.74 +836,73.74 +838,73.74 +840,73.74 +842,73.62 +844,73.51 +846,73.40 +848,73.29 +850,73.06 +852,72.84 +854,72.84 +856,72.61 +858,72.50 +860,72.39 +862,72.27 +864,72.27 +866,72.16 +868,72.16 +870,72.05 +872,72.05 +874,72.05 +876,72.05 +878,71.94 +880,72.05 +882,72.05 +884,72.05 +886,72.05 +888,72.05 +890,72.05 +892,72.05 +894,72.05 +896,72.16 +898,72.16 +900,72.16 +902,72.16 +904,72.16 +906,72.16 +908,72.16 +910,72.16 +912,72.16 +914,72.16 +916,72.16 +918,72.16 +920,72.16 +922,72.16 +924,72.16 +926,72.27 +928,72.27 +930,72.27 +932,72.27 +934,72.27 +936,72.27 +938,72.27 +940,72.27 +942,72.39 +944,72.39 +946,72.39 +948,72.39 +950,72.39 +952,72.39 +954,72.39 +956,72.27 +958,72.27 +960,72.39 +962,72.27 +964,72.27 +966,72.39 +968,72.39 +970,72.39 +972,72.39 +974,72.39 +976,72.39 +978,72.39 +980,72.50 +982,72.50 +984,72.50 +986,72.50 +988,72.50 +990,72.50 +992,72.50 +994,72.61 +996,72.61 +998,72.61 +1000,72.61 +1002,72.61 +1004,72.61 +1006,72.61 +1008,72.61 +1010,72.72 +1012,72.72 +1014,72.72 +1016,72.72 +1018,72.72 +1020,72.72 +1022,72.72 +1024,72.72 +1026,72.72 +1028,72.84 +1030,72.72 +1032,72.84 +1034,72.84 +1036,72.84 +1038,72.84 +1040,72.84 +1042,72.84 +1044,72.84 +1046,72.84 +1048,72.84 +1050,72.84 +1052,72.84 +1054,72.84 +1056,72.72 +1058,72.61 +1060,72.50 +1062,72.50 +1064,72.50 +1066,72.50 +1068,72.50 +1070,72.50 +1072,72.50 +1074,72.50 +1076,72.61 +1078,72.61 +1080,72.61 +1082,72.61 +1084,72.61 +1086,72.72 +1088,72.61 +1090,72.39 +1092,72.39 +1094,72.39 +1096,72.39 +1098,72.27 +1100,72.27 +1102,72.27 +1104,72.27 +1106,72.27 +1108,72.27 +1110,72.27 +1112,72.27 +1114,72.39 +1116,72.39 +1118,72.39 +1120,72.50 +1122,72.50 +1124,72.61 +1126,72.61 +1128,72.61 +1130,72.61 +1132,72.72 +1134,72.72 +1136,72.72 +1138,72.72 +1140,72.61 +1142,72.39 +1144,71.94 +1146,71.71 +1148,71.37 +1150,71.04 +1152,70.70 +1154,70.25 +1156,70.02 +1158,69.57 +1160,69.24 +1162,68.90 +1164,68.45 +1166,68.11 +1168,67.77 +1170,67.32 +1172,66.99 +1174,66.65 +1176,66.31 +1178,65.97 +1180,65.64 +1182,65.30 +1184,64.96 +1186,64.62 +1188,64.40 +1190,64.06 +1192,63.84 +1194,63.50 +1196,63.28 +1198,62.94 +1200,62.71 +1202,62.49 +1204,62.15 +1206,61.93 +1208,61.70 +1210,61.47 +1212,61.25 +1214,61.03 +1216,60.80 +1218,60.58 +1220,60.35 +1222,60.13 +1224,59.90 +1226,59.68 +1228,59.45 +1230,59.22 +1232,59.11 +1234,58.89 +1236,58.66 +1238,58.78 +1240,58.78 +1242,59.11 +1244,59.45 +1246,59.79 +1248,60.01 +1250,60.24 +1252,60.46 +1254,60.69 +1256,60.91 +1258,61.14 +1260,61.36 +1262,61.47 +1264,61.70 +1266,61.93 +1268,62.15 +1270,62.26 +1272,62.49 +1274,62.60 +1276,62.71 +1278,63.05 +1280,63.16 +1282,63.28 +1284,63.61 +1286,63.95 +1288,64.18 +1290,64.40 +1292,64.62 +1294,64.85 +1296,64.96 +1298,65.07 +1300,65.19 +1302,65.30 +1304,65.52 +1306,65.52 +1308,65.75 +1310,65.86 +1312,66.09 +1314,66.31 +1316,66.43 +1318,66.65 +1320,66.87 +1322,66.99 +1324,67.21 +1326,67.21 +1328,67.44 +1330,67.55 +1332,67.66 +1334,67.77 +1336,67.77 +1338,67.89 +1340,67.89 +1342,67.89 +1344,68.00 +1346,68.00 +1348,68.00 +1350,67.89 +1352,67.89 +1354,67.89 +1356,67.89 +1358,67.89 +1360,67.89 +1362,67.89 +1364,67.89 +1366,67.89 +1368,67.89 +1370,67.89 +1372,67.89 +1374,67.89 +1376,67.89 +1378,67.89 +1380,67.89 +1382,67.89 +1384,67.89 +1386,67.89 +1388,68.00 +1390,68.00 +1392,68.00 +1394,68.00 +1396,68.11 +1398,68.00 +1400,68.11 +1402,68.11 +1404,68.11 +1406,68.22 +1408,68.22 +1410,68.34 +1412,68.34 +1414,68.45 +1416,68.56 +1418,68.68 +1420,68.79 +1422,68.90 +1424,69.01 +1426,69.12 +1428,69.24 +1430,69.35 +1432,69.35 +1434,69.46 +1436,69.46 +1438,69.46 +1440,69.46 +1442,69.46 +1444,69.46 +1446,69.46 +1448,69.46 +1450,69.46 +1452,69.57 +1454,69.46 +1456,69.46 +1458,69.46 +1460,69.46 +1462,69.46 +1464,69.46 +1466,69.46 +1468,69.46 +1470,69.46 +1472,69.35 +1474,69.24 +1476,69.24 +1478,69.24 +1480,69.24 +1482,69.24 +1484,69.24 +1486,69.24 +1488,69.24 +1490,69.24 +1492,69.35 +1494,69.35 +1496,69.35 +1498,69.35 +1500,69.35 +1502,69.24 +1504,69.24 +1506,69.24 +1508,69.35 +1510,69.35 +1512,69.35 +1514,69.35 +1516,69.35 +1518,69.35 +1520,69.46 +1522,69.46 +1524,69.46 +1526,69.46 +1528,69.46 +1530,69.46 +1532,69.46 +1534,69.46 +1536,69.57 +1538,69.57 +1540,69.57 +1542,69.57 +1544,69.69 +1546,69.69 +1548,69.69 +1550,69.69 +1552,69.69 +1554,69.80 +1556,69.80 +1558,69.80 +1560,69.91 +1562,70.02 +1564,70.14 +1566,70.25 +1568,70.36 +1570,70.47 +1572,70.59 +1574,70.81 +1576,70.93 +1578,71.04 +1580,71.15 +1582,71.15 +1584,71.26 +1586,71.37 +1588,71.37 +1590,71.49 +1592,71.49 +1594,71.60 +1596,71.60 +1598,71.71 +1600,71.71 +1602,71.82 +1604,71.82 +1606,71.94 +1608,71.94 +1610,72.05 +1612,72.05 +1614,72.16 +1616,72.16 +1618,72.16 +1620,72.16 +1622,72.16 +1624,72.16 +1626,72.05 +1628,72.05 +1630,71.94 +1632,71.82 +1634,71.82 +1636,71.71 +1638,71.71 +1640,71.60 +1642,71.60 +1644,71.49 +1646,71.49 +1648,71.49 +1650,71.37 +1652,71.26 +1654,71.15 +1656,71.15 +1658,71.04 +1660,70.93 +1662,70.93 +1664,70.81 +1666,70.70 +1668,70.59 +1670,70.59 +1672,70.47 +1674,70.47 +1676,70.47 +1678,70.47 +1680,70.47 +1682,70.47 +1684,70.59 +1686,70.70 +1688,70.70 +1690,70.81 +1692,70.81 +1694,70.93 +1696,71.04 +1698,71.04 +1700,71.15 +1702,71.15 +1704,71.26 +1706,71.26 +1708,71.37 +1710,71.37 +1712,71.49 +1714,71.49 +1716,71.49 +1718,71.60 +1720,71.71 +1722,71.71 +1724,71.82 +1726,71.82 +1728,71.94 +1730,71.94 +1732,72.05 +1734,72.05 +1736,72.05 +1738,72.16 +1740,72.16 +1742,72.16 +1744,72.27 +1746,72.27 +1748,72.39 +1750,72.39 +1752,72.39 +1754,72.39 +1756,72.50 +1758,72.50 +1760,72.50 +1762,72.50 +1764,72.61 +1766,72.61 +1768,72.61 +1770,72.72 diff --git a/data/data2.txt b/data/data2.txt new file mode 100644 index 0000000..1adcc0a --- /dev/null +++ b/data/data2.txt @@ -0,0 +1,81 @@ +Time,TemperatureF +0,73.51 +10,73.51 +20,73.51 +30,73.51 +40,73.62 +50,73.62 +60,73.62 +70,73.62 +80,73.62 +90,73.62 +100,73.62 +110,73.62 +120,73.62 +130,73.62 +140,73.62 +150,73.74 +160,73.74 +170,73.74 +180,73.85 +190,73.74 +200,73.74 +210,73.74 +220,73.74 +230,73.74 +240,73.74 +250,73.74 +260,73.74 +270,73.85 +280,73.06 +290,72.50 +300,72.39 +310,71.94 +320,71.15 +330,69.91 +340,69.57 +350,69.57 +360,69.35 +370,69.01 +380,69.12 +390,69.91 +400,70.59 +410,71.60 +420,72.27 +430,72.50 +440,73.18 +450,73.96 +460,74.64 +470,74.07 +480,73.18 +490,72.39 +500,71.71 +510,71.26 +520,71.04 +530,70.93 +540,71.26 +550,71.49 +560,71.71 +570,71.82 +580,72.05 +590,72.16 +600,72.27 +610,72.27 +620,72.39 +630,72.39 +640,72.39 +650,72.50 +660,72.61 +670,72.61 +680,72.61 +690,72.61 +700,72.61 +710,72.27 +720,72.05 +730,71.71 +740,71.49 +750,71.15 +760,71.60 +770,71.94 +780,72.27 +790,72.50 diff --git a/docs/image/redboard/board.jpg b/docs/image/redboard/board.jpg new file mode 100644 index 0000000..e5af54a Binary files /dev/null and b/docs/image/redboard/board.jpg differ diff --git a/docs/image/redboard/redboard.jpg b/docs/image/redboard/redboard.jpg new file mode 100644 index 0000000..a1efbea Binary files /dev/null and b/docs/image/redboard/redboard.jpg differ diff --git a/docs/image/redboard/sensor.jpg b/docs/image/redboard/sensor.jpg new file mode 100644 index 0000000..20d5550 Binary files /dev/null and b/docs/image/redboard/sensor.jpg differ diff --git a/docs/image/temperature_graph2.png b/docs/image/temperature_graph2.png new file mode 100644 index 0000000..249f8a7 Binary files /dev/null and b/docs/image/temperature_graph2.png differ diff --git a/docs/image/temperature_graphs.png b/docs/image/temperature_graphs.png new file mode 100644 index 0000000..15a83cc Binary files /dev/null and b/docs/image/temperature_graphs.png differ diff --git a/docs/svg/schematic.svg b/docs/svg/schematic.svg new file mode 100644 index 0000000..e573a09 --- /dev/null +++ b/docs/svg/schematic.svg @@ -0,0 +1,773 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Black + + + + +TMP102 + + + + +Red + + + + +Green + + + + +o + + + + +Blue + + + + +GND + + + + +1.4-3.6V + + + + +SDA + + + + +XCL + + + + +ALT + + + + +ADD0 + + + + +RedBoard + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +(left) + + + + +(right) + + + + +IOREF + + + + +RESET + + + + +3.3V + + + + +5V + + + + +GND + + + + +GND + + + + +VIN + + + + +A0 + + + + +A1 + + + + +A2 + + + + +A3 + + + + +A4 + + + + +A5 + + + + +AREF + + + + +SCL + + + + +SDA + + + + +GND + + + + +~11 + + + + +~10 + + + + +13 + + + + +12 + + + + +~9 + + + + +~6 + + + + +~5 + + + + +~3 + + + + +8 + + + + +7 + + + + +4 + + + + +2 + + + + +1 + + + + +0 + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +o + + + + +Yellow + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/svg/schematic.txt b/docs/svg/schematic.txt new file mode 100644 index 0000000..7a7d7a3 --- /dev/null +++ b/docs/svg/schematic.txt @@ -0,0 +1,41 @@ + .-------------. + | __ __ | + | (__) (__)| + | | + | TMP102 | *- GND (left) + | ------- | *- 1.4-3.6V + | | *- SDA + | * * * * * o | *- XCL + | | | | | | | *- ALT + '-+-+-+-+-+---' o- ADD0 (right) + | | | | | + | | | | | + | | | | | + | | | | | Yellow + | | '-+-+---------------------------------------------------. + | | | | | + | | | | .----------------------------------------. | + | | | | | .---. | | + | | | | | RedBoard | | | | + | | | | | SCL <- | o | | | + | | | | | SDA <- | *-+--+--' + | | | | | .---. AREF <- | o | | + | | | | | | o | -> GND <- | o | | + | | | | | | o | -> IOREF 13 <- | o | | + | | | | | | o | -> RESET 12 <- | o | | + | '---+-+-------+--+-* | -> 3.3V ~11 <- | o | | + | Red | | | | o | -> 5V ~10 <- | o | | + '-----+-+-------+--+-* | -> GND ~9 <- | o | | + Black | | | | o | -> GND 8 <- | o | | + | | | | o | -> VIN +-+-+-+ '---' | + | | | '---' +-+-+-+ .---. | + | | | .---. +-+-+-+ 7 <- | o | | + | | | | o | -> A0 +-+-+-+ ~6 <- | o | | + | | | | o | -> A1 ~5 <- | o | | + | | Blue | | o | -> A2 4 <- | o | | + | '-------+--+-* | -> A3 ~3 <- | o | | + | | | o | -> A4 2 <- | o | | + '---------+--+-* | -> A5 1 <- | o | | + Green | '---' 0 <- | o | | + | '---' | + '----------------------------------------' \ No newline at end of file diff --git a/src/SparkFunTMP102.cpp b/src/SparkFunTMP102.cpp new file mode 100644 index 0000000..0a5ab36 --- /dev/null +++ b/src/SparkFunTMP102.cpp @@ -0,0 +1,490 @@ +/****************************************************************************** +SparkFunTMP102.cpp +SparkFunTMP102 Library Source File +Alex Wende @ SparkFun Electronics +Original Creation Date: April 29, 2016 +https://github.com/sparkfun/Digital_Temperature_Sensor_Breakout_-_TMP102 + +This file implements all functions of the TMP102 class. Functions here range +from reading the temperature from the sensor, to reading and writing various +settings in the sensor. + +Development environment specifics: + IDE: Arduino 1.6 + Hardware Platform: Arduino Uno + LSM9DS1 Breakout Version: 1.0 + +This code is beerware; if you see me (or any other SparkFun employee) at the +local, and you've found our code helpful, please buy us a round! + +Distributed as-is; no warranty is given. +******************************************************************************/ +#include "SparkFunTMP102.h" +#include "Wire.h" + +#define TEMPERATURE_REGISTER 0x00 +#define CONFIG_REGISTER 0x01 +#define T_LOW_REGISTER 0x02 +#define T_HIGH_REGISTER 0x03 + + + +TMP102::TMP102(uint8_t address) +{ + _address = address; +} + +void TMP102::begin(void) +{ + Wire.begin(); // Join I2C bus +} + + +void TMP102::openPointerRegister(uint8_t pointerReg) +{ + Wire.beginTransmission(_address); // Connect to TMP102 + Wire.write(pointerReg); // Open specified register + Wire.endTransmission(); // Close communication with TMP102 +} + + +uint8_t TMP102::readRegister(bool registerNumber){ + uint8_t registerByte[2]; // We'll store the data from the registers here + + // Read current configuration register value + Wire.requestFrom(_address, 2); // Read two bytes from TMP102 + registerByte[0] = (Wire.read()); // Read first byte + registerByte[1] = (Wire.read()); // Read second byte + + return registerByte[registerNumber]; +} + + +float TMP102::readTempC(void) +{ + uint8_t registerByte[2]; // Store the data from the register here + int16_t digitalTemp; // Temperature stored in TMP102 register + + // Read Temperature + // Change pointer address to temperature register (0) + openPointerRegister(TEMPERATURE_REGISTER); + // Read from temperature register + registerByte[0] = readRegister(0); + registerByte[1] = readRegister(1); + + // Bit 0 of second byte will always be 0 in 12-bit readings and 1 in 13-bit + if(registerByte[1]&0x01) // 13 bit mode + { + // Combine bytes to create a signed int + digitalTemp = ((registerByte[0]) << 5) | (registerByte[1] >> 3); + // Temperature data can be + or -, if it should be negative, + // convert 13 bit to 16 bit and use the 2s compliment. + if(digitalTemp > 0xFFF) + { + digitalTemp |= 0xE000; + } + } + else // 12 bit mode + { + // Combine bytes to create a signed int + digitalTemp = ((registerByte[0]) << 4) | (registerByte[1] >> 4); + // Temperature data can be + or -, if it should be negative, + // convert 12 bit to 16 bit and use the 2s compliment. + if(digitalTemp > 0x7FF) + { + digitalTemp |= 0xF000; + } + } + // Convert digital reading to analog temperature (1-bit is equal to 0.0625 C) + return digitalTemp*0.0625; +} + + +float TMP102::readTempF(void) +{ + return readTempC()*9.0/5.0 + 32.0; +} + + +void TMP102::setConversionRate(uint8_t rate) +{ + uint8_t registerByte[2]; // Store the data from the register here + rate = rate&0x03; // Make sure rate is not set higher than 3. + + // Change pointer address to configuration register (0x01) + openPointerRegister(CONFIG_REGISTER); + + // Read current configuration register value + registerByte[0] = readRegister(0); + registerByte[1] = readRegister(1); + + // Load new conversion rate + registerByte[1] &= 0x3F; // Clear CR0/1 (bit 6 and 7 of second byte) + registerByte[1] |= rate<<6; // Shift in new conversion rate + + // Set configuration registers + Wire.beginTransmission(_address); + Wire.write(CONFIG_REGISTER); // Point to configuration register + Wire.write(registerByte[0]); // Write first byte + Wire.write(registerByte[1]); // Write second byte + Wire.endTransmission(); // Close communication with TMP102 +} + + +void TMP102::setExtendedMode(bool mode) +{ + uint8_t registerByte[2]; // Store the data from the register here + + // Change pointer address to configuration register (0x01) + openPointerRegister(CONFIG_REGISTER); + + // Read current configuration register value + registerByte[0] = readRegister(0); + registerByte[1] = readRegister(1); + + // Load new value for extention mode + registerByte[1] &= 0xEF; // Clear EM (bit 4 of second byte) + registerByte[1] |= mode<<4; // Shift in new exentended mode bit + + // Set configuration registers + Wire.beginTransmission(_address); + Wire.write(CONFIG_REGISTER); // Point to configuration register + Wire.write(registerByte[0]); // Write first byte + Wire.write(registerByte[1]); // Write second byte + Wire.endTransmission(); // Close communication with TMP102 +} + + +void TMP102::sleep(void) +{ + uint8_t registerByte; // Store the data from the register here + + // Change pointer address to configuration register (0x01) + openPointerRegister(CONFIG_REGISTER); + + // Read current configuration register value + registerByte = readRegister(0); + + registerByte |= 0x01; // Set SD (bit 0 of first byte) + + // Set configuration register + Wire.beginTransmission(_address); + Wire.write(CONFIG_REGISTER); // Point to configuration register + Wire.write(registerByte); // Write first byte + Wire.endTransmission(); // Close communication with TMP102 +} + + +void TMP102::wakeup(void) +{ + uint8_t registerByte; // Store the data from the register here + + // Change pointer address to configuration register (1) + openPointerRegister(CONFIG_REGISTER); + + // Read current configuration register value + registerByte = readRegister(0); + + registerByte &= 0xFE; // Clear SD (bit 0 of first byte) + + // Set configuration registers + Wire.beginTransmission(_address); + Wire.write(CONFIG_REGISTER); // Point to configuration register + Wire.write(registerByte); // Write first byte + Wire.endTransmission(); // Close communication with TMP102 +} + + +void TMP102::setAlertPolarity(bool polarity) +{ + uint8_t registerByte; // Store the data from the register here + + // Change pointer address to configuration register (1) + openPointerRegister(CONFIG_REGISTER); + + // Read current configuration register value + registerByte = readRegister(0); + + // Load new value for polarity + registerByte &= 0xFB; // Clear POL (bit 2 of registerByte) + registerByte |= polarity<<2; // Shift in new POL bit + + // Set configuration register + Wire.beginTransmission(_address); + Wire.write(CONFIG_REGISTER); // Point to configuration register + Wire.write(registerByte); // Write first byte + Wire.endTransmission(); // Close communication with TMP102 +} + + +bool TMP102::alert(void) +{ + uint8_t registerByte; // Store the data from the register here + + // Change pointer address to configuration register (1) + openPointerRegister(CONFIG_REGISTER); + + // Read current configuration register value + registerByte = readRegister(1); + + registerByte &= 0x20; // Clear everything but the alert bit (bit 5) + return registerByte>>5; +} + + +void TMP102::setLowTempC(float temperature) +{ + uint8_t registerByte[2]; // Store the data from the register here + bool extendedMode; // Store extended mode bit here 0:-55C to +128C, 1:-55C to +150C + + // Prevent temperature from exceeding 150C or -55C + if(temperature > 150.0f) + { + temperature = 150.0f; + } + if(temperature < -55.0) + { + temperature = -55.0f; + } + + //Check if temperature should be 12 or 13 bits + openPointerRegister(CONFIG_REGISTER); // Read configuration register settings + + // Read current configuration register value + registerByte[0] = readRegister(0); + registerByte[1] = readRegister(1); + extendedMode = (registerByte[1]&0x10)>>4; // 0 - temp data will be 12 bits + // 1 - temp data will be 13 bits + + // Convert analog temperature to digital value + temperature = temperature/0.0625; + + // Split temperature into separate bytes + if(extendedMode) // 13-bit mode + { + registerByte[0] = int(temperature)>>5; + registerByte[1] = (int(temperature)<<3); + } + else // 12-bit mode + { + registerByte[0] = int(temperature)>>4; + registerByte[1] = int(temperature)<<4; + } + + // Write to T_LOW Register + Wire.beginTransmission(_address); + Wire.write(T_LOW_REGISTER); // Point to T_LOW + Wire.write(registerByte[0]); // Write first byte + Wire.write(registerByte[1]); // Write second byte + Wire.endTransmission(); // Close communication with TMP102 +} + + +void TMP102::setHighTempC(float temperature) +{ + uint8_t registerByte[2]; // Store the data from the register here + bool extendedMode; // Store extended mode bit here 0:-55C to +128C, 1:-55C to +150C + + // Prevent temperature from exceeding 150C + if(temperature > 150.0f) + { + temperature = 150.0f; + } + if(temperature < -55.0) + { + temperature = -55.0f; + } + + // Check if temperature should be 12 or 13 bits + openPointerRegister(CONFIG_REGISTER); // Read configuration register settings + + // Read current configuration register value + registerByte[0] = readRegister(0); + registerByte[1] = readRegister(1); + extendedMode = (registerByte[1]&0x10)>>4; // 0 - temp data will be 12 bits + // 1 - temp data will be 13 bits + + // Convert analog temperature to digital value + temperature = temperature/0.0625; + + // Split temperature into separate bytes + if(extendedMode) // 13-bit mode + { + registerByte[0] = int(temperature)>>5; + registerByte[1] = (int(temperature)<<3); + } + else // 12-bit mode + { + registerByte[0] = int(temperature)>>4; + registerByte[1] = int(temperature)<<4; + } + + // Write to T_HIGH Register + Wire.beginTransmission(_address); + Wire.write(T_HIGH_REGISTER); // Point to T_HIGH register + Wire.write(registerByte[0]); // Write first byte + Wire.write(registerByte[1]); // Write second byte + Wire.endTransmission(); // Close communication with TMP102 +} + + +void TMP102::setLowTempF(float temperature) +{ + temperature = (temperature - 32)*5/9; // Convert temperature to C + setLowTempC(temperature); // Set T_LOW +} + + +void TMP102::setHighTempF(float temperature) +{ + temperature = (temperature - 32)*5/9; // Convert temperature to C + setHighTempC(temperature); // Set T_HIGH +} + + +float TMP102::readLowTempC(void) +{ + uint8_t registerByte[2]; // Store the data from the register here + bool extendedMode; // Store extended mode bit here 0:-55C to +128C, 1:-55C to +150C + int16_t digitalTemp; // Store the digital temperature value here + float temperature; // Store the analog temperature value here + + // Check if temperature should be 12 or 13 bits + openPointerRegister(CONFIG_REGISTER); // Read configuration register settings + // Read current configuration register value + registerByte[0] = readRegister(0); + registerByte[1] = readRegister(1); + extendedMode = (registerByte[1]&0x10)>>4; // 0 - temp data will be 12 bits + // 1 - temp data will be 13 bits + openPointerRegister(T_LOW_REGISTER); + registerByte[0] = readRegister(0); + registerByte[1] = readRegister(1); + + if(extendedMode) // 13 bit mode + { + // Combine bytes to create a signed int + digitalTemp = ((registerByte[0]) << 5) | (registerByte[1] >> 3); + // Temperature data can be + or -, if it should be negative, + // convert 13 bit to 16 bit and use the 2s compliment. + if(digitalTemp > 0xFFF) + { + digitalTemp |= 0xE000; + } + } + else // 12 bit mode + { + // Combine bytes to create a signed int + digitalTemp = ((registerByte[0]) << 4) | (registerByte[1] >> 4); + // Temperature data can be + or -, if it should be negative, + // convert 12 bit to 16 bit and use the 2s compliment. + if(digitalTemp > 0x7FF) + { + digitalTemp |= 0xF000; + } + } + // Convert digital reading to analog temperature (1-bit is equal to 0.0625 C) + return digitalTemp*0.0625; +} + + +float TMP102::readHighTempC(void) +{ + uint8_t registerByte[2]; // Store the data from the register here + bool extendedMode; // Store extended mode bit here 0:-55C to +128C, 1:-55C to +150C + int16_t digitalTemp; // Store the digital temperature value here + float temperature; // Store the analog temperature value here + + // Check if temperature should be 12 or 13 bits + openPointerRegister(CONFIG_REGISTER); // read configuration register settings + // Read current configuration register value + registerByte[0] = readRegister(0); + registerByte[1] = readRegister(1); + extendedMode = (registerByte[1]&0x10)>>4; // 0 - temp data will be 12 bits + // 1 - temp data will be 13 bits + openPointerRegister(T_HIGH_REGISTER); + registerByte[0] = readRegister(0); + registerByte[1] = readRegister(1); + + if(extendedMode) // 13 bit mode + { + // Combine bytes to create a signed int + digitalTemp = ((registerByte[0]) << 5) | (registerByte[1] >> 3); + // Temperature data can be + or -, if it should be negative, + // convert 13 bit to 16 bit and use the 2s compliment. + if(digitalTemp > 0xFFF) + { + digitalTemp |= 0xE000; + } + } + else // 12 bit mode + { + // Combine bytes to create a signed int + digitalTemp = ((registerByte[0]) << 4) | (registerByte[1] >> 4); + // Temperature data can be + or -, if it should be negative, + // convert 12 bit to 16 bit and use the 2s compliment. + if(digitalTemp > 0x7FF) + { + digitalTemp |= 0xF000; + } + } + // Convert digital reading to analog temperature (1-bit is equal to 0.0625 C) + return digitalTemp*0.0625; +} + + +float TMP102::readLowTempF(void) +{ + return readLowTempC()*9.0/5.0 + 32.0; +} + + +float TMP102::readHighTempF(void) +{ + return readHighTempC()*9.0/5.0 + 32.0; +} + + +void TMP102::setFault(uint8_t faultSetting) +{ + uint8_t registerByte; // Store the data from the register here + + faultSetting = faultSetting&3; // Make sure rate is not set higher than 3. + + // Change pointer address to configuration register (0x01) + openPointerRegister(CONFIG_REGISTER); + + // Read current configuration register value + registerByte = readRegister(0); + + // Load new conversion rate + registerByte &= 0xE7; // Clear F0/1 (bit 3 and 4 of first byte) + registerByte |= faultSetting<<3; // Shift new fault setting + + // Set configuration registers + Wire.beginTransmission(_address); + Wire.write(CONFIG_REGISTER); // Point to configuration register + Wire.write(registerByte); // Write byte to register + Wire.endTransmission(); // Close communication with TMP102 +} + + +void TMP102::setAlertMode(bool mode) +{ + uint8_t registerByte; // Store the data from the register here + + // Change pointer address to configuration register (1) + openPointerRegister(CONFIG_REGISTER); + + // Read current configuration register value + registerByte = readRegister(0); + + // Load new conversion rate + registerByte &= 0xFD; // Clear old TM bit (bit 1 of first byte) + registerByte |= mode<<1; // Shift in new TM bit + + // Set configuration registers + Wire.beginTransmission(_address); + Wire.write(CONFIG_REGISTER); // Point to configuration register + Wire.write(registerByte); // Write byte to register + Wire.endTransmission(); // Close communication with TMP102 +} diff --git a/src/SparkFunTMP102.h b/src/SparkFunTMP102.h new file mode 100644 index 0000000..08c15a1 --- /dev/null +++ b/src/SparkFunTMP102.h @@ -0,0 +1,84 @@ +/****************************************************************************** +SparkFunTMP102.h +SparkFunTMP102 Library Header File +Alex Wende @ SparkFun Electronics +Original Creation Date: April 29, 2016 +https://github.com/sparkfun/Digital_Temperature_Sensor_Breakout_-_TMP102 + +This file prototypes the TMP102 class, implemented in SparkFunTMP102.cpp. + +Development environment specifics: + IDE: Arduino 1.6.0 + Hardware Platform: Arduino Uno + TMP102 Breakout Version: 13 + +This code is beerware; if you see me (or any other SparkFun employee) at the +local, and you've found our code helpful, please buy us a round! + +Distributed as-is; no warranty is given. +******************************************************************************/ +#ifndef TMP102_h +#define TMP102_h + +#if defined(ARDUINO) && ARDUINO >= 100 + #include "Arduino.h" +#else + #include "WProgram.h" +#endif +#include "Wire.h" +class TMP102 +{ + public: + TMP102(byte address); // Initialize TMP102 sensor at given address + void begin(void); // Join I2C bus + float readTempC(void); // Returns the temperature in degrees C + float readTempF(void); // Converts readTempC result to degrees F + void sleep(void); // Switch sensor to low power mode + void wakeup(void); // Wakeup and start running in normal power mode + bool alert(void); // Returns state of Alert register + void setLowTempC(float temperature); // Sets T_LOW (degrees C) alert threshold + void setHighTempC(float temperature); // Sets T_HIGH (degrees C) alert threshold + void setLowTempF(float temperature); // Sets T_LOW (degrees F) alert threshold + void setHighTempF(float temperature); // Sets T_HIGH (degrees F) alert threshold + float readLowTempC(void); // Reads T_LOW register in C + float readHighTempC(void); // Reads T_HIGH register in C + float readLowTempF(void); // Reads T_LOW register in F + float readHighTempF(void); // Reads T_HIGH register in F + + // Set the conversion rate (0-3) + // 0 - 0.25 Hz + // 1 - 1 Hz + // 2 - 4 Hz (default) + // 3 - 8 Hz + void setConversionRate(byte rate); + + // Enable or disable extended mode + // 0 - disabled (-55C to +128C) + // 1 - enabled (-55C to +150C) + void setExtendedMode(bool mode); + + // Set the polarity of Alert + // 0 - Active LOW + // 1 - Active HIGH + void setAlertPolarity(bool polarity); + + // Set the number of consecutive faults + // 0 - 1 fault + // 1 - 2 faults + // 2 - 4 faults + // 3 - 6 faults + void setFault(byte faultSetting); + + // Set Alert type + // 0 - Comparator Mode: Active from temp > T_HIGH until temp < T_LOW + // 1 - Thermostat Mode: Active when temp > T_HIGH until any read operation occurs + void setAlertMode(bool mode); + + private: + int _address; // Address of Temperature sensor (0x48,0x49,0x4A,0x4B) + void openPointerRegister(byte pointerReg); // Changes the pointer register + byte readRegister(bool registerNumber); // reads 1 byte of from register +}; + + +#endif diff --git a/src/main.ino b/src/main.ino new file mode 100644 index 0000000..c6b9174 --- /dev/null +++ b/src/main.ino @@ -0,0 +1,57 @@ +// Copyright © 2019 Alexander L. Hayes +// MIT License + +/***** +======== +main.ino +======== + +Alexander L. Hayes (https://hayesall.com/) + +This is the main file that Experiments 1 & 2 were ran for Rob Long's +"Temperature Sensing with Arduino" activity. + +Data are printed to the Serial Monitor, and will maintain a format +similar to the following: + +.. code-block:: csv + + Time,TemperatureF + 0,73.06 + 2,73.18 + 4,73.18 + 5,73.18 + +For an example, refer to the contents of the ``data/`` directory. +******/ + +#include "Wire.h" +#include "SparkFunTMP102.h" + +TMP102 sensor0(0x48); +int startTime = 0; + +void setup() { + Serial.begin(9600); + sensor0.begin(); + sensor0.setConversionRate(0); + + Serial.println("Time,TemperatureF"); +} + +void loop() { + + float temperature; + + sensor0.wakeup(); + temperature = sensor0.readTempF(); + + Serial.print(startTime); + Serial.print(","); + Serial.println(temperature); + + sensor0.sleep(); + + delay(2000); + startTime += 2; +} diff --git a/src/plot_data.py b/src/plot_data.py new file mode 100644 index 0000000..9ddaa44 --- /dev/null +++ b/src/plot_data.py @@ -0,0 +1,82 @@ +# Copyright © 2019 Alexander L. Hayes +# MIT License + +""" +================ +``plot_data.py`` +================ + +Plot the contents of the ``data/`` directory. + +Instructions +------------ + +1. This needs to be run from the base of the repository. For example: + + .. code-block:: bash + + $ pythonw src/plot_data.py -i 1 # Mac + $ python src/plot_data.py -i 1 # Linux + +2. ``-i FILE`` where FILE={1,2} sets which data set to plot. + +3. Images are not saved automatically. Make adjustments with the matplotlib + interface and save images locally. +""" + +import argparse +import matplotlib.pyplot as plt +import numpy as np + +if __name__ == "__main__": + + PARSER = argparse.ArgumentParser() + PARSER.add_argument( + "-i", + "--input", + help="Text file for input {1 or 2}. Should be comma-delimited with a row of labels at the top.", + default="1", + ) + ARGS = PARSER.parse_args() + + if ARGS.input == "1": + + _data = np.loadtxt("data/data1.txt", delimiter=",", dtype=float, skiprows=1) + + fig, (ax1, ax2, ax3, ax4, ax5) = plt.subplots(5, 1, sharex=False) + + ax1.plot(_data[0:151].T[0], _data[0:151].T[1]) + ax1.set_ylabel("Sitting at Desk") + + ax2.plot(_data[170:260].T[0], _data[170:260].T[1]) + ax2.axvline(x=438) + ax2.axvline(x=518) + ax2.set_ylabel("Walking Outside") + + ax3.plot(_data[436:477].T[0], _data[436:477].T[1]) + ax3.set_ylabel("Random Classroom") + + ax4.plot(_data[571:612].T[0], _data[571:612].T[1]) + ax4.set_ylabel("The Fridge") + + ax5.plot(_data[679:845].T[0], _data[679:845].T[1]) + ax5.axvline(x=1462) + ax5.axvline(x=1536) + ax5.axvline(x=1640) + ax5.set_ylabel("Random Walk through Informatics") + + plt.show() + + else: + + _data = np.loadtxt("data/data2.txt", delimiter=",", dtype=float, skiprows=1) + + fig, (ax1, ax2) = plt.subplots(2, 1, sharex=False) + + ax1.plot(_data[29:46].T[0], _data[29:46].T[1]) + ax1.set_ylabel("Walking Outside") + + ax2.plot(_data[51:70].T[0], _data[51:70].T[1]) + ax2.set_ylabel("1st Floor Classroom") + + plt.show()