Serial Humidity Monitor

The easiest humidity monitor you will ever make. Be ready to go in less than 5 minutes!
Things Used in This Project
Hardware components
- XinaBox CC01 x 1
- XinaBox IP01 x 1
- XinaBox SW01 x 1
- XinaBox XC10 x 1
Software apps and online services
Story
About this project
I built this project using XinaBox xChips and Arduino IDE. It is a 5 min project, that allows you to read humidity data received from the xSW01 on the serial monitor.
Introduction
This project is an adaption of my previous Easy Peasy Temperature Monitor project. Using the xChips assembly is easy. The Arduino IDE software makes creating the code for the project simple.
Downloading the Libraries
Programming
- Connect the IP01 and CC01 using an xBUS Connector. Make sure the xChips' names are orientated correctly.
Figure 2: Connected IP01 and CC01
- Insert into an available USB port.
- Download or copy and paste the code from the CODE heading into your Arduino IDE. Alternatively you could create your own code using the relevant principles to achieve the same objective.
- To ensure there are no errors compile the code.
- After successful compilation (no errors found) you may upload the code to your xChips. Ensure the switches are facing "A" and "DCE" respectively before uploading.
Final Assembly
- Once the upload is successful, remove the IP01 from the USB port. Attach the SW01 with another xBUS Connector to the CC01.
Figure 3: Connected IP01, CC01 and SW01.
- Insert the board back into the same USB port.
- Open the serial monitor in the top, right-hand corner of the screen. It should look like the image below after a few moments.
Figure 4: Serial monitor showing relative humidity readings from the SW01
- You can now view humidity data from the SW01 on the serial monitor
Code
HumiditySerialMonitor.ino Arduino
The code for showing Humidity data on the serial monitor while using Arduino IDE and xChips from XinaBox
#include <xCore.h> //include xCore library #include <xSW01.h> //include sensor library<br><br><br>// Create a variable for the storage of data received from SW01 float Relative_Humidity; unsigned long previousMilli_1 = 0; // timing variable for serial monitor const long interval_1= 5000; // time delay for serial monitor bool flag; const int DELAY_TIME = 1000; xSW01 SW01; void setup() { // Start the Serial Monitor Serial.begin(115200); // START I2C COMMUNICATION Wire.begin(); // Start the SW01 SW01.begin(); //Intialising variables Relative_Humidity = 0; Serial.println(" Humidity Project "); Serial.println("================================"); //Delay for sensor to normalise delay(3000); } void loop() { // Read and calculate data from SW01 sensor SW01.poll(); // Request the temperature measurement from SW01 and store in // the temperature variable Relative_Humidity = SW01.getHumidity(); // Relative Humidity in Percentage format display_humidity(); } void display_humidity() { // timing delay according to interval_1 variable // do not use the delay() function as it will pause all operations unsigned long currentMilli_1 = millis(); if(currentMilli_1 - previousMilli_1 >= interval_1){ previousMilli_1 = currentMilli_1; if(flag == false){ flag = true; } else{ flag = false; } // Show data over the Serial Monitor Serial.print("Relative_Humidity: "); Serial.print(Relative_Humidity); Serial.println(" %"); } }