52 #define CHILD_ID_DUST 0
53 #define DUST_SENSOR_ANALOG_PIN 1
55 uint32_t SLEEP_TIME = 30*1000;
60 int samplingTime = 280;
63 float calcVoltage = 0;
64 float dustDensity = 0;
66 MyMessage dustMsg(CHILD_ID_DUST, V_LEVEL);
79 uint16_t voMeasured = analogRead(DUST_SENSOR_ANALOG_PIN);
83 calcVoltage = voMeasured * (5.0 / 1024.0);
87 dustDensity = (0.17 * calcVoltage - 0.1)*1000;
89 Serial.print(
"Raw Signal Value (0-1023): ");
90 Serial.print(voMeasured);
92 Serial.print(
" - Voltage: ");
93 Serial.print(calcVoltage);
95 Serial.print(
" - Dust Density: ");
96 Serial.println(dustDensity);
98 if (ceil(dustDensity) != lastDUST) {
99 send(dustMsg.
set((int16_t)ceil(dustDensity)));
100 lastDUST = ceil(dustDensity);