{"id":1,"date":"2016-03-17T12:42:04","date_gmt":"2016-03-17T12:42:04","guid":{"rendered":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/?p=1"},"modified":"2021-05-24T15:07:54","modified_gmt":"2021-05-24T19:07:54","slug":"notebook-and-project-updates","status":"publish","type":"post","link":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/2016\/03\/17\/notebook-and-project-updates\/","title":{"rendered":"Notebook and Project Updates"},"content":{"rendered":"<h3>Click the below link for our group foginator notebook for the overall process of the project from start to finish.<\/h3>\n<h1><a href=\"https:\/\/ece454designprojects.scranton.edu\/foginator\/notebook\/\">FOGINATOR GROUP NOTEBOOK<\/a><\/h1>\n<h5>*Pictures along this process of the Foginator from start to finish can be seen on our project web portfolio.<\/h5>\n<p>&nbsp;<\/p>\n<h1>My Foginator Updates\/Notebook<\/h1>\n<p>My project notebook and work can be found below. It includes notes along the way for my personal part of the Foginator and then includes code for the sensor library which I created after testing the sensors functionality.<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204130.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-70 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204130-e1463619944464.jpg\" alt=\"20160518_204130\" width=\"2828\" height=\"3957\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204130-e1463619944464.jpg 2828w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204130-e1463619944464-214x300.jpg 214w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204130-e1463619944464-768x1075.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204130-e1463619944464-732x1024.jpg 732w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204130-e1463619944464-676x946.jpg 676w\" sizes=\"auto, (max-width: 2828px) 100vw, 2828px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204139.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-71 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204139-e1463620334209.jpg\" alt=\"20160518_204139\" width=\"2921\" height=\"3107\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204139-e1463620334209.jpg 2921w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204139-e1463620334209-282x300.jpg 282w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204139-e1463620334209-768x817.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204139-e1463620334209-963x1024.jpg 963w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204139-e1463620334209-676x719.jpg 676w\" sizes=\"auto, (max-width: 2921px) 100vw, 2921px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204148.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-72 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204148-e1463620966397.jpg\" alt=\"20160518_204148\" width=\"2974\" height=\"2018\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204148-e1463620966397.jpg 2974w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204148-e1463620966397-300x204.jpg 300w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204148-e1463620966397-768x521.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204148-e1463620966397-1024x695.jpg 1024w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204148-e1463620966397-676x459.jpg 676w\" sizes=\"auto, (max-width: 2974px) 100vw, 2974px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204153.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-73 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204153-e1463621274642.jpg\" alt=\"20160518_204153\" width=\"2948\" height=\"2629\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204153-e1463621274642.jpg 2948w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204153-e1463621274642-300x268.jpg 300w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204153-e1463621274642-768x685.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204153-e1463621274642-1024x913.jpg 1024w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204153-e1463621274642-676x603.jpg 676w\" sizes=\"auto, (max-width: 2948px) 100vw, 2948px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204206.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-74 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204206-e1463621792944.jpg\" alt=\"20160518_204206\" width=\"2815\" height=\"2961\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204206-e1463621792944.jpg 2815w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204206-e1463621792944-285x300.jpg 285w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204206-e1463621792944-768x808.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204206-e1463621792944-974x1024.jpg 974w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204206-e1463621792944-676x711.jpg 676w\" sizes=\"auto, (max-width: 2815px) 100vw, 2815px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204225.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-75 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204225-e1463622092587.jpg\" alt=\"20160518_204225\" width=\"2988\" height=\"2563\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204225-e1463622092587.jpg 2988w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204225-e1463622092587-300x257.jpg 300w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204225-e1463622092587-768x659.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204225-e1463622092587-1024x878.jpg 1024w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204225-e1463622092587-676x580.jpg 676w\" sizes=\"auto, (max-width: 2988px) 100vw, 2988px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204231.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-76 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204231-e1463622276357.jpg\" alt=\"20160518_204231\" width=\"2934\" height=\"3200\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204231-e1463622276357.jpg 2934w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204231-e1463622276357-275x300.jpg 275w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204231-e1463622276357-768x838.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204231-e1463622276357-939x1024.jpg 939w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204231-e1463622276357-676x737.jpg 676w\" sizes=\"auto, (max-width: 2934px) 100vw, 2934px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204239.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204239-e1463622554880.jpg\" alt=\"20160518_204239\" width=\"2855\" height=\"3293\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204239-e1463622554880.jpg 2855w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204239-e1463622554880-260x300.jpg 260w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204239-e1463622554880-768x886.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204239-e1463622554880-888x1024.jpg 888w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204239-e1463622554880-676x780.jpg 676w\" sizes=\"auto, (max-width: 2855px) 100vw, 2855px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204246.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-78 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204246-e1463623080975.jpg\" alt=\"20160518_204246\" width=\"2934\" height=\"3014\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204246-e1463623080975.jpg 2934w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204246-e1463623080975-292x300.jpg 292w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204246-e1463623080975-768x789.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204246-e1463623080975-997x1024.jpg 997w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204246-e1463623080975-676x694.jpg 676w\" sizes=\"auto, (max-width: 2934px) 100vw, 2934px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204250.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-79 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204250-e1463623616813.jpg\" alt=\"20160518_204250\" width=\"2961\" height=\"3426\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204250-e1463623616813.jpg 2961w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204250-e1463623616813-259x300.jpg 259w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204250-e1463623616813-768x889.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204250-e1463623616813-885x1024.jpg 885w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204250-e1463623616813-676x782.jpg 676w\" sizes=\"auto, (max-width: 2961px) 100vw, 2961px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204255.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-80 size-full\" src=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204255-e1463624170341.jpg\" alt=\"20160518_204255\" width=\"2868\" height=\"3187\" srcset=\"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204255-e1463624170341.jpg 2868w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204255-e1463624170341-270x300.jpg 270w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204255-e1463624170341-768x853.jpg 768w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204255-e1463624170341-922x1024.jpg 922w, https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-content\/uploads\/sites\/12\/2016\/03\/20160518_204255-e1463624170341-676x751.jpg 676w\" sizes=\"auto, (max-width: 2868px) 100vw, 2868px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Getting \u00a0the sensors working properly was a good start for the project. Test programs for each sensor were built and used to test the functionality of each sensor. The most challenging part was the next portion of the project which was to take the testing code and make one big sensor library where each sensor can be called with one line and output the data needed from each sensor. The code below is the .h header file, the .cpp and the getArduinoData final script for the sensor library. The code below is then used with the Arduino and sent via i2c communication to the Raspberry Pi, which is used to then call these sensors to update a web page created by Chad.<\/p>\n<p>&nbsp;<\/p>\n<h2>getArduinoData script<\/h2>\n<hr \/>\n<p>#include &lt;Wire.h&gt;<br \/>\n#include &lt;SensorLibrary.h&gt;<br \/>\nSensorLibrary foginator;<\/p>\n<p>#define SLAVE_ADDRESS 0x04<br \/>\nint number = 0;<br \/>\nint state = 0;<br \/>\nint dataRead = 0;<\/p>\n<p>void setup() {<br \/>\n\/\/pinMode(13, OUTPUT);<br \/>\nSerial.begin(9600); \/\/ start serial for output<br \/>\n\/\/ initialize i2c as slave<br \/>\nWire.begin(SLAVE_ADDRESS);<\/p>\n<p>\/\/ define callbacks for i2c communication<br \/>\nWire.onReceive(receiveData);<br \/>\nWire.onRequest(sendData);<\/p>\n<p>\/\/Serial.println(\u201cReady!\u201d);<br \/>\n}<\/p>\n<p>void loop() {<br \/>\ndelay(100);<br \/>\n}<\/p>\n<p>\/\/ callback for received data<br \/>\nvoid receiveData(int byteCount){<\/p>\n<p>while(Wire.available()) {<br \/>\ndataRead = Wire.read();<br \/>\nif (dataRead == 10) {<br \/>\nnumber = foginator.getWpTempData1();<br \/>\nSerial.print(number);<br \/>\n}<br \/>\nelse if (dataRead == 11) {<br \/>\nnumber = foginator.getWpTempData2();<br \/>\nSerial.print(number);<br \/>\n}<br \/>\nelse if (dataRead == 12) {<br \/>\nnumber = foginator.getCO2Data();<br \/>\nSerial.print(number);<br \/>\n}<br \/>\nelse if (dataRead == 13) {<br \/>\nnumber = 22;<br \/>\nSerial.print(number);<br \/>\n}<br \/>\nelse if (dataRead == 14) {<br \/>\nnumber = foginator.getPHData();<br \/>\nSerial.print(number);<br \/>\n}<br \/>\nelse if (dataRead == 15) {<br \/>\nnumber = foginator.getLuxData();<br \/>\nSerial.print(number);<br \/>\n}<br \/>\nelse if (dataRead == 16) {<br \/>\nnumber = foginator.getHumidityData();<br \/>\nSerial.print(number);<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n<p>\/\/ callback for sending data<br \/>\nvoid sendData(){<br \/>\nWire.write(number);<br \/>\n\/\/Wire.endTransmission();<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3>CPP File &#8211; Getting the Data we needed from the test scripts that were built<\/h3>\n<hr \/>\n<p>#include \u201cArduino.h\u201d<br \/>\n#include \u201cSensorLibrary.h\u201d<br \/>\n#include \u201cOneWire.h\u201d<br \/>\n#include \u201cDallasTemperature.h\u201d<br \/>\n#include \u201cSparkFunTSL2561.h\u201d<br \/>\n#include \u201cWire.h\u201d<br \/>\n#include \u201cDHT.h\u201d<\/p>\n<p>SensorLibrary::SensorLibrary()<br \/>\n{<br \/>\npinMode(A0,INPUT); \/\/ CO2 Sensor<br \/>\n}<\/p>\n<p>\/\/ CO2 Sensor<\/p>\n<p>int SensorLibrary::getCO2Data()<br \/>\n{<br \/>\nfloat CO2Curve[3] = {2.602,0.324,(0.020\/(2.602-3))};<br \/>\nint percentage;<br \/>\nfloat volts;<br \/>\nvolts = MGRead(A7);<br \/>\npercentage = MGGetPercentage(volts,CO2Curve);<br \/>\nreturn percentage;<br \/>\n}<\/p>\n<p>float SensorLibrary::MGRead(int mg_pin)<br \/>\n{<br \/>\nint i;<br \/>\nfloat v=0;<\/p>\n<p>for (i=0;i&lt;5;i++) {<br \/>\nv += analogRead(mg_pin);<br \/>\ndelay(50);<br \/>\n}<br \/>\nv = (v\/5)*5\/1024 ;<br \/>\nreturn v;<br \/>\n}<\/p>\n<p>int SensorLibrary::MGGetPercentage(float volts, float *pcurve)<br \/>\n{<br \/>\nif ((volts\/8.5)&gt;=0.324) {<br \/>\nreturn -1;<br \/>\n} else {<br \/>\nreturn pow(10, ((volts\/8.5)-pcurve[1])\/pcurve[2]+pcurve[0]);<br \/>\n}<\/p>\n<p>}<br \/>\n\/\/ * * * * * * * * * * * * * * * * * *<\/p>\n<p>\/\/ Waterproof Temperature Sensor<\/p>\n<p>float SensorLibrary::getWpTempData1()<br \/>\n{<br \/>\nOneWire oneWire(A5);<br \/>\n\/\/ Pass our oneWire reference to Dallas Temperature.<br \/>\nDallasTemperature sensors(&amp;oneWire);<br \/>\nsensors.requestTemperatures(); \/\/ Send the command to get temperatures<br \/>\ndelay(50);<br \/>\nreturn sensors.getTempFByIndex(0);<br \/>\n}<\/p>\n<p>float SensorLibrary::getWpTempData2()<br \/>\n{<br \/>\nOneWire oneWire(A6);<br \/>\n\/\/ Pass our oneWire reference to Dallas Temperature.<br \/>\nDallasTemperature sensors(&amp;oneWire);<br \/>\nsensors.requestTemperatures(); \/\/ Send the command to get temperatures<br \/>\ndelay(50);<br \/>\nreturn sensors.getTempFByIndex(0);<br \/>\n}<br \/>\n\/\/ * * * * * * * * * * * * * * * * * *<\/p>\n<p>\/\/ Lux Light Sensor<\/p>\n<p>double SensorLibrary::getLuxData()<br \/>\n{<br \/>\nSFE_TSL2561 light;<br \/>\nunsigned char time = 2;<br \/>\nunsigned int data0, data1;<br \/>\nunsigned int ms = 1000;<br \/>\nboolean gain = 0;<br \/>\nlight.begin();<br \/>\nlight.setTiming(gain,time,ms);<br \/>\nlight.setPowerUp();<br \/>\n\/\/****<br \/>\nif (light.getData(data0,data1))<br \/>\n{<\/p>\n<p>double lux; \/\/ Resulting lux value<br \/>\nboolean good; \/\/ True if neither sensor is saturated<\/p>\n<p>\/\/ Perform lux calculation:<\/p>\n<p>good = light.getLux(0,1000,data0,data1,lux);<br \/>\nreturn lux;<br \/>\n}<\/p>\n<p>}<\/p>\n<p>\/\/ * * * * * * * * * * * * * * * * * *<\/p>\n<p>\/\/ Humidity Sensor<\/p>\n<p>float SensorLibrary::getHumidityData()<br \/>\n{<br \/>\nDHT dht(A10, DHT22);<br \/>\ndht.begin();<br \/>\nfloat h = dht.readHumidity();<br \/>\nreturn h;<br \/>\n}<\/p>\n<p>\/\/ pH Sensor<br \/>\nfloat SensorLibrary::getPHData()<br \/>\n{<br \/>\nfloat pHdata; \/\/Store the average value of the sensor feedback<br \/>\nfloat pHValue,voltage;<\/p>\n<p>pHdata=analogRead(A9);<br \/>\nvoltage = pHdata*5.0\/1024;<br \/>\npHValue = 3.5*voltage+0.00;<\/p>\n<p>return pHValue;<br \/>\n}<\/p>\n<p>double SensorLibrary::avgArray(int* arr, int number)<br \/>\n{<br \/>\nint i;<br \/>\nint max,min;<br \/>\ndouble avg;<br \/>\nlong amount=0;<br \/>\nif(number&lt;=0){<br \/>\nSerial.println(\u201cError number for the array to avraging!\/n\u201d);<br \/>\nreturn 0;<br \/>\n}<br \/>\nif(number&lt;5){ \/\/less than 5, calculated directly statistics<br \/>\nfor(i=0;i&lt;number;i++){<br \/>\namount+=arr[i];<br \/>\n}<br \/>\navg = amount\/number;<br \/>\nreturn avg;<br \/>\n}else{<br \/>\nif(arr[0]&lt;arr[1]){<br \/>\nmin = arr[0];max=arr[1];<br \/>\n}<br \/>\nelse{<br \/>\nmin=arr[1];max=arr[0];<br \/>\n}<br \/>\nfor(i=2;i&lt;number;i++){<br \/>\nif(arr[i]&lt;min){<br \/>\namount+=min; \/\/arr&lt;min<br \/>\nmin=arr[i];<br \/>\n}else {<br \/>\nif(arr[i]&gt;max){<br \/>\namount+=max; \/\/arr&gt;max<br \/>\nmax=arr[i];<br \/>\n}else{<br \/>\namount+=arr[i]; \/\/min&lt;=arr&lt;=max<br \/>\n}<br \/>\n}\/\/if<br \/>\n}\/\/for<br \/>\navg = (double)amount\/(number-2);<br \/>\n}\/\/if<br \/>\nreturn avg;<br \/>\n}<\/p>\n<p>\/\/ * * * * * * * * * * * * * * * * * *<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3>Header File &#8211; Naming and setting the types for each sensor<\/h3>\n<hr \/>\n<p>#ifndef SensorLibrary_h<br \/>\n#define SensorLibrary_h<br \/>\n#include \u201cArduino.h\u201d<\/p>\n<p>class SensorLibrary<br \/>\n{<br \/>\npublic:<br \/>\nSensorLibrary();<br \/>\n\/\/CO2 Sensor functions<br \/>\nint getCO2Data();<br \/>\nfloat MGRead(int mg_pin);<br \/>\nint MGGetPercentage(float volts, float *pcurve);<br \/>\nfloat getWpTempData1();<br \/>\nfloat getWpTempData2();<br \/>\ndouble getLuxData();<br \/>\nfloat getHumidityData();<br \/>\nfloat getPHData();<br \/>\ndouble avgArray(int* arr, int number);<br \/>\n\/\/<\/p>\n<p>};<\/p>\n<p>#endif<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Click the below link for our group foginator notebook for the overall process of the project from start to finish. FOGINATOR GROUP NOTEBOOK *Pictures along this process of the Foginator from start to finish can be seen on our project web portfolio. &nbsp; My Foginator Updates\/Notebook My project notebook and work can be found below. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1","post","type-post","status-publish","format-standard","hentry","category-uncategorized","post-preview"],"_links":{"self":[{"href":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-json\/wp\/v2\/posts\/1","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-json\/wp\/v2\/comments?post=1"}],"version-history":[{"count":15,"href":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-json\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":116,"href":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-json\/wp\/v2\/posts\/1\/revisions\/116"}],"wp:attachment":[{"href":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-json\/wp\/v2\/media?parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-json\/wp\/v2\/categories?post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ece454designprojects.scranton.edu\/timothythomas\/wp-json\/wp\/v2\/tags?post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}