   delay(2);
 }
 
+// send payload
+static void sendPayload() {
+  // power up RF
+  rf12_sleep(RF12_WAKEUP);
+
+  // send payload
+  rf12_sendNow(0, &payload, sizeof payload);
+  rf12_sendWait(RADIO_SYNC_MODE);
+
+  // power down RF
+  rf12_sleep(RF12_SLEEP);
+}
+
+// wait a few milliseconds for proper ACK to me, return true if indeed received
+static byte waitForAck() {
+  MilliTimer ackTimer;
+  while (!ackTimer.poll(ACK_TIME)) {
+    if (rf12_recvDone() && rf12_crc == 0 &&
+        // see http://talk.jeelabs.net/topic/811#post-4712
+        rf12_hdr == (RF12_HDR_DST | RF12_HDR_CTL | myNodeID))
+      return 1;
+  }
+  return 0;
+}
+
+// send payload and wait for master node ack
+static void sendPayloadWithAck() {
+  for (byte i = 0; i < ACK_RETRY_LIMIT; ++i) {
+    // power up RF
+    rf12_sleep(RF12_WAKEUP);
+
+    // send payload
+    rf12_sendNow(RF12_HDR_ACK, &payload, sizeof payload);
+    rf12_sendWait(RADIO_SYNC_MODE);
+
+    // wait for ack
+    byte acked = waitForAck();
+
+    // power down RF
+    rf12_sleep(RF12_SLEEP);
+
+    if (acked) {
+#if DEBUG
+      Serial.print("ack ");
+      Serial.println((int) i);
+      serialFlush();
+#endif
+      return;
+    }
+
+    // If no ack received wait and try again
+    delay(ACK_RETRY_PERIOD * 100);
+  }
+
+#if DEBUG
+  Serial.println("NO ack !");
+  serialFlush();
+#endif
+}
+
 // send payload and optionally report on serial port
 static void doReport() {
+#if DEBUG
+  Serial.print("[thlNode] ");
+  Serial.print((int) payload.light);
+  Serial.print(' ');
+  Serial.print((int) payload.lobat);
+  Serial.print(' ');
+  Serial.print((int) payload.humi);
+  Serial.print(' ');
+  Serial.print((int) payload.temp);
+  Serial.println();
+  serialFlush();
+#endif
+
 #if !NOOP
-    // power up RF
-    rf12_sleep(RF12_WAKEUP);
-
-    // send payload
-    rf12_sendNow(0, &payload, sizeof payload);
-    rf12_sendWait(RADIO_SYNC_MODE);
-
-    // power down RF
-    rf12_sleep(RF12_SLEEP);
-#endif
-
-#if DEBUG
-    Serial.print("[thlNode] ");
-    Serial.print((int) payload.light);
-    Serial.print(' ');
-    Serial.print((int) payload.lobat);
-    Serial.print(' ');
-    Serial.print((int) payload.humi);
-    Serial.print(' ');
-    Serial.print((int) payload.temp);
-    Serial.println();
-    serialFlush();
+  #if ACK_TIME > 0
+    sendPayloadWithAck();
+  #else
+    sendPayload();
+  #endif
 #endif
 }
 

      Serial.println("BUS Hung");
      break;
    case DHT_ERROR_NOT_PRESENT:
      Serial.println("Not Present");
      break;
    case DHT_ERROR_ACK_TOO_LONG:
      Serial.println("ACK time out");
      break;
    case DHT_ERROR_SYNC_TIMEOUT:
      Serial.println("Sync Timeout");
      break;
    case DHT_ERROR_DATA_TIMEOUT:
      Serial.println("Data Timeout");
      break;
    case DHT_ERROR_TOOQUICK:
      Serial.println("Polled to quick");
      break;
#endif
  }

ISR(WDT_vect) { Sleepy::watchdogEvent(); }


#define DEBUG 0
#define NOOP 0

// DHT22 Power wire is plugged into jeenode DI03 (arduino: digital 6)
