53 #define CHILD_ID_DUST 0
54 #define DUST_SENSOR_ANALOG_PIN 1
56 uint32_t SLEEP_TIME = 30*1000;
61 int samplingTime = 280;
64 float calcVoltage = 0;
65 float dustDensity = 0;
67 MyMessage dustMsg(CHILD_ID_DUST, V_LEVEL);
80 uint16_t voMeasured = analogRead(DUST_SENSOR_ANALOG_PIN);
84 calcVoltage = voMeasured * (5.0 / 1024.0);
88 dustDensity = (0.17 * calcVoltage - 0.1)*1000;
90 Serial.print(
"Raw Signal Value (0-1023): ");
91 Serial.print(voMeasured);
93 Serial.print(
" - Voltage: ");
94 Serial.print(calcVoltage);
96 Serial.print(
" - Dust Density: ");
97 Serial.println(dustDensity);
99 if (ceil(dustDensity) != lastDUST) {
100 send(dustMsg.
set((int16_t)ceil(dustDensity)));
101 lastDUST = ceil(dustDensity);