IoT Arduino Wireless Temperature Humidity Sensor

Temperature Humidity sensors are one of the most common and widely used sensors with Arduino and other IoT platforms. There are so many use cases where a temperature humidity sensors can be used to detect potential problem like frozen pipes, broken freezers, malfunctioning air conditioning, water/humidity detection in crawl spaces and much more. In this IoT Arduino wireless temperature Humidity sensor project we will interface a long range wireless temperature humidity sensor with Arduino. These readings can be used to set an alarm or to send an alert.

There are so many sensors which can be connected to Arduino but there are not many which can connect with Arduino over a wireless connection. The devices which could have a few short comings like:

Short Wireless Communication Range Temperature Humidity Readings are not Accurate or Consistent High Power Consumption with a Short Battery Life Packet/ Data Loss RF Collisions (so you can’t have too many in one area)

In this Article we will use a ncd.io Long range wireless temperature humidity sensor with Arduino Due. We will use Xbee S3B as communication module. Here is a list of the hardware we will be using to build this Arduino wireless temperature Humidity sensor

What makes this Long range wireless temperature humidity sensor so special?

Ultra Long Wireless Range, 2 Mile with On-Board Antenna and 28-Miles when using a High Gain Antenna High Accuracy Honeywell Temperature Humidity Sensor Ultra Low Power Consumption, Lives off 2 AA Batteries for Years M2M Communications Protocol with Acknowledgements Every device has a unique ID and Unique Serial Number with No RF Collisions Hundreds of Devices can be Connected with one Arduino 128-bit AES Encryption for Secure Communications

How to Interface IoT Arduino Wireless Temperature Humidity Sensor

The working principle of the IoT Arduino wireless temperature Humidity sensor is pretty straight-forward, the wireless sensor will send a data packet after a user defined interval. The data packet contains a sensor node ID, sensor type, device battery voltage, temperature readings and humidity readings. On the Arduino side we will write a short script which will decode this incoming data and will display the battery voltage, temperature values and humidity values. In this setup we will have one sensor but this same script can be used to read hundreds sensors.

To know more about the IoT Wireless temperature Humidity sensor checkout this article.

Wiring Diagram? We specialize in Plug and Play!

This is a wireless solution which is designed to work out of the box, so there is no wiring.

Arduino Code to Read IoT wireless temperature Humidity sensor : The code is real simple: all you will need to do is read the incoming data on the serial port and convert it into temperature humidity values. The code can be found on our github page as well:

///this code is written and tested for ncd.io wireless temperature humidity sensor with arduino due ///sensor data structure can be found here https://ncd.io/long-range-wireless-temperature-humidity-sensor/ /// sesnro can be found here https://store.ncd.io/shop/ int8_t data[29]; int ledpin=13; int chk=1; int k = 10; int i; void setup() { Serial1.begin(9600); Serial.begin(9600); Serial.println("ncd.io IoT Arduino wireless temperature Humidity sensor"); } void loop() { if (Serial1.available()) { data[0] = Serial1.read(); delay(k); if(data[0]==0x7E) { while (!Serial1.available()); for ( i = 1; i< 29; i++) { data[i] = Serial1.read(); delay(1); } if(data[15]==0x7F) /////// to check if the recive data is correct { if(data[22]==1) //////// make sure the sensor type is correct { float humidity = ((((data[24]) * 256) + data[25]) /100.0); float cTemp = ((data[26] * 256) + (data[27])) /100.0; float fTemp = cTemp * 1.8 + 32; float battery = ((data[18] * 256) + data[19]); float voltage = 0.00322 * battery; Serial.print("Sensor Number "); Serial.println(data[16]); Serial.print("Sensor Type "); Serial.println(data[22]); Serial.print("Firmware Version "); Serial.println(data[17]); Serial.print("Relative Humidity :"); Serial.print(humidity); Serial.println(" %RH"); Serial.print("Temperature in Celsius :"); Serial.print(cTemp); Serial.println(" C"); Serial.print("Temperature in Fahrenheit :"); Serial.print(fTemp); Serial.println(" F"); Serial.print("ADC value:"); Serial.println(battery); Serial.print("Battery Voltage:"); Serial.print(voltage); Serial.println("n"); if (voltage < 1) { Serial.println("Time to Replace The Battery"); } } } else { for ( i = 0; i< 29; i++) { Serial.print(data[i]); Serial.print(" , "); delay(1); } } } } }

Applications: