diff options
author | Alphara <42233094+xAlpharax@users.noreply.github.com> | 2023-11-04 18:31:33 +0000 |
---|---|---|
committer | Alphara <42233094+xAlpharax@users.noreply.github.com> | 2023-11-04 18:31:33 +0000 |
commit | 097c457e47a7a61ce50267dd7204089702ed68c5 (patch) | |
tree | 898f73323bb0af13e1c3603e44a4150a05e5ffb9 | |
parent | 9f33e5a68b0013a1f1a7aa010e246616df74bf60 (diff) |
figured dsm501a out
figured dsm501a out but needs a better integration since it is inconsistent with all the reporting
-rw-r--r-- | LINKS.md | 26 | ||||
-rw-r--r-- | TODO.md | 10 | ||||
-rw-r--r-- | learning_examples/DHT_Tester_esp32/DHTtester_esp32.ino (renamed from learning_examples/DHTtester_esp32/DHTtester_esp32.ino) | 0 | ||||
-rw-r--r-- | learning_examples/DSM501A-example-ehh-unreliable/DSM501A-example-ehh.ino | 65 | ||||
-rw-r--r-- | learning_examples/MQ135_workaround_analog_esp32/parts_per_mil_mq135_workaround_analog_esp32.ino (renamed from learning_examples/parts_per_mil_mq135_workaround_analog_esp32/parts_per_mil_mq135_workaround_analog_esp32.ino) | 0 |
5 files changed, 95 insertions, 6 deletions
@@ -1,4 +1,22 @@ -https://randomnerdtutorials.com/getting-started-with-esp32/ -- main board (ESP32 Board) -toadd - temperature and humidity sensors (DHT Unified Sensor) -toadd - air quality detector for ppm measurements (MQ135 Sensor) -https://www.mechatronicstore.cl/wp-content/uploads/datasheet-sensor-dsm501a.pdf -- dust sensor (DSM501A Sensor)
\ No newline at end of file +HARDWARE: + +https://randomnerdtutorials.com/getting-started-with-esp32/ -- main board (ESP32 Board) - general info - has wifi and is kute + +(done) toadd - temperature and humidity sensors (DHT Unified Sensor) - i simply used the examples provided by the library it comes with + +(done) toadd - air quality detector for ppm measurements (MQ135 Sensor) +https://blog.asksensors.com/air-quality-sensor-mq135-cloud-mqtt/ - reference for acieving a workaround for the MQ 135 Sensor + +https://www.mechatronicstore.cl/wp-content/uploads/datasheet-sensor-dsm501a.pdf -- dust sensor (DSM501A Sensor) +https://www.instructables.com/Dust-Sensor-With-DSM501a-and-ESP8266/ -- example of using the sensor that i ve tried to replicate + +DATABASE CONTENDERRRRRRRRRRRRRRRr: + +https://cassandra.apache.org/_/quickstart.html -- i like this containarization +https://graphql.org/ - graphs dbs + +SOME OTHER THINGS I VE SEEN: + +https://github.com/expressjs/express +https://nodejs.org/en/download +https://www.npmjs.com/package/express
\ No newline at end of file @@ -1,3 +1,9 @@ -integrate dsm sensor +integrate dsm sensor (doing) -make an api interface (esp32 can use curls and stuff)
\ No newline at end of file +make an api interface (esp32 can use curl's and stuff) + +store the data on a mock server that can be accessed with requests (rest, crud) + +somehow integrate that continuously with time series data forcasting and other AI/ML predictions + +incorporate normal graphs and predicted future behaviour of those datapoints to show the urgency of measures that should be taken
\ No newline at end of file diff --git a/learning_examples/DHTtester_esp32/DHTtester_esp32.ino b/learning_examples/DHT_Tester_esp32/DHTtester_esp32.ino index f12bfb5..f12bfb5 100644 --- a/learning_examples/DHTtester_esp32/DHTtester_esp32.ino +++ b/learning_examples/DHT_Tester_esp32/DHTtester_esp32.ino diff --git a/learning_examples/DSM501A-example-ehh-unreliable/DSM501A-example-ehh.ino b/learning_examples/DSM501A-example-ehh-unreliable/DSM501A-example-ehh.ino new file mode 100644 index 0000000..7852763 --- /dev/null +++ b/learning_examples/DSM501A-example-ehh-unreliable/DSM501A-example-ehh.ino @@ -0,0 +1,65 @@ +#include<string.h> +#define PM1PIN 18 //DSM501A input D6 on ESP8266 +#define PM25PIN 14 // ???? what +byte buff[2]; +unsigned long durationPM1; +unsigned long durationPM25; +unsigned long starttime; +unsigned long endtime; +unsigned long sampletime_ms = 30000; +unsigned long lowpulseoccupancyPM1 = 0; +unsigned long lowpulseoccupancyPM25 = 0; + + +int i=0; +void setup() +{ + Serial.begin(9600); + Serial.println("Starting please wait 30s"); + pinMode(PM1PIN,INPUT); + pinMode(PM25PIN,INPUT); + starttime = millis(); +} + +float calculateConcentration(long lowpulseInMicroSeconds, long durationinSeconds){ + + float ratio = (lowpulseInMicroSeconds/1000000.0)/30.0*100.0; //Calculate the ratio + float concentration = 0.001915 * pow(ratio,2) + 0.09522 * ratio - 0.04884;//Calculate the mg/m3 + Serial.print("lowpulseoccupancy:"); + Serial.print(lowpulseInMicroSeconds); + Serial.print(" ratio:"); + Serial.print(ratio); + Serial.print(" Concentration:"); + Serial.println(concentration); + return concentration; +} + +void loop() +{ + durationPM1 = pulseIn(PM1PIN, LOW); + durationPM25 = pulseIn(PM25PIN, LOW); + + lowpulseoccupancyPM1 += durationPM1; + lowpulseoccupancyPM25 += durationPM25; + + endtime = millis(); + if ((endtime-starttime) > sampletime_ms) //Only after 30s has passed we calcualte the ratio + { + /* + ratio1 = (lowpulseoccupancy/1000000.0)/30.0*100.0; //Calculate the ratio + Serial.print("ratio1: "); + Serial.println(ratio1); + + concentration = 0.001915 * pow(ratio1,2) + 0.09522 * ratio1 - 0.04884;//Calculate the mg/m3 + */ + float conPM1 = calculateConcentration(lowpulseoccupancyPM1,30); + float conPM25 = calculateConcentration(lowpulseoccupancyPM25,30); + Serial.print("PM1 "); + Serial.print(conPM1); + Serial.print(" PM25 "); + Serial.println(conPM25); + lowpulseoccupancyPM1 = 0; + lowpulseoccupancyPM25 = 0; + starttime = millis(); + } +} diff --git a/learning_examples/parts_per_mil_mq135_workaround_analog_esp32/parts_per_mil_mq135_workaround_analog_esp32.ino b/learning_examples/MQ135_workaround_analog_esp32/parts_per_mil_mq135_workaround_analog_esp32.ino index dc2ed08..dc2ed08 100644 --- a/learning_examples/parts_per_mil_mq135_workaround_analog_esp32/parts_per_mil_mq135_workaround_analog_esp32.ino +++ b/learning_examples/MQ135_workaround_analog_esp32/parts_per_mil_mq135_workaround_analog_esp32.ino |