How To Test Air Quality In Your Home
Many types of meters and devices assess indoor air quality in your home. Some examples include particulate matter meters, CO2 meters, volatile organic compound detectors,
# Type at least 1 character to search # Hit enter to search or ESC to close
No products in the cart.
No products in the cart.
Product Categories
In this tutorial we will show you how to connect an Atlas Scientific EZO-HUM™ Embedded Humidity Sensor to an Arduino Uno. There are multiple ways to connect Atlas Scientific sensors to your device of choice. In previous posts, we have shown how to wire our EZO™ sensors directly into an Arduino and a Raspberry Pi. This time, however, we’ll be using the Atlas Scientific EZO™ Carrier Board *non-isolated* and EZO™ Adapter wired to an Arduino Uno.
At Atlas Scientific, we manufacture all our inventory in-house, this requires highly accurate humidity monitoring. If the humidity is too high, we can’t manufacture sensors, if it’s too low static electricity becomes an issue. Finding a high-quality humidity sensor was harder than we thought. So, we built our own. Our EZO-HUM™ sensors can be found all over our lab to make sure the humidity is always kept within range. We love them, and we believe you will too.
Before we begin have the following items readily available
When connecting a sensor to an Arduino or even a Raspberry Pi, try to remember that organization is key, which is why we are using 4 different colored jumper wires. Sure, we all know that Red is VCC, and Black is ground. However, over the years we have seen many customers use the same-colored jump wires throughout their entire project. I know all yellow looks cool… but it’s very easy to get lost in your own mess. For this tutorial, we are going to use Red, Black, White, and Green.
Let’s start by placing the white jumper wire into pin 3 on the Arduino Uno board.
Then, place the green jumper wire into pin 2 on the Arduino Uno board.
These two jumper wires are important as they will allow both the EZO-HUMâ„¢ Sensor and the Arduino Uno board to communicate with each other.
Next, place the red jumper wire into the 5V pin. And finally place the black jumper wire into any of the 2 GND or ground pins near the 5V pin.
These two jumper wires will now supply power and a ground line from the Arduino Uno to the EZO-HUMâ„¢ Sensor.
Now that our Arduino Uno is wired correctly, let’s move on to the Carrier board. On the back side of the board, you’ll notice there are pins labeled:
VCC
N/C (not connected)
GND
TX
RX
Start by connecting the other end of the red jumper wire onto the VCC pin. Next, connect the black jumper wire onto the GND pin. Then, connect the green jumper wire onto the TX pin, and finally connect the white jumper wire onto the RX pin.
When complete, it should look like the image below.
Ok, now that our carrier board is all wired up, we need to connect the EZOâ„¢ Adapter, which allows you to connect a 5 pin EZOâ„¢ Sensor to a 6-pin socket.
Insert the EZOâ„¢ Adapter directly into the Carrier board, just like you would do if this were an EZOâ„¢ circuit.
Finally, all that’s left to do, is to connect the EZO-HUM™ Sensor to the EZO™ Adapter. Just slide the sensor connector onto the adapter. There are color indicators on the sides of the EZO™ Adapter, make sure you line it up correctly!
Using the USB cable type, A – B male/male, connect one end into your PC and the other into the Arduino Uno board.
Once the USB cable has been connected at both ends, you will notice the LEDs on the Arduino are now lit up and blinking. Looking at the back of your EZO-HUMâ„¢ Sensor, it should also be lit up and blinking.
All Atlas Scientific Sensors have two working modes, UART and I2C. Each of these modes are identified by a color. If your sensor is blinking green, you are in UART mode. If the sensor is solid blue, you are in I2C mode.
By default, all Atlas Scientific Sensors should come in UART mode.
However, if your EZO-HUMâ„¢ Sensor is solid blue (I2C mode) refer to the Datasheet on how to change modes.
We are all finished with the wiring, now let’s get the sample code.
If you do not already have the Arduino IDE software installed onto your computer, please do so now, as we’ll be using it for the last section of this tutorial. You can download the Arduino IDE software by clicking HERE.
//This code was written to be easy to understand.
//Modify this code as you see fit.
//This code will output data to the Arduino serial monitor.
//Type commands into the Arduino serial monitor to control the humidity sensor.
//This code was written in the Arduino 1.8.13 IDE
//An Arduino UNO was used to test this code.
//This code was last tested 8/2020
#include <SoftwareSerial.h> //we have to include the SoftwareSerial library, or else we can't use it
#define rx 2 //define what pin rx is going to be
#define tx 3 //define what pin tx is going to be
SoftwareSerial myserial(rx, tx); //define how the soft serial port is going to work
String inputstring = ""; //a string to hold incoming data from the PC
String sensorstring = ""; //a string to hold the data from the Atlas Scientific product
boolean input_string_complete = false; //have we recived all the data from the PC
boolean sensor_string_complete = false; //have we recived all the data from the Atlas Scientific product
void setup() { //set up the hardware
Serial.begin(9600); //set baud rate for the hardware serial port_0 to 9600
myserial.begin(9600); //set baud rate for the software serial port to 9600
inputstring.reserve(10); //set aside some bytes for reciving data from the PC
sensorstring.reserve(30); //set aside some bytes for reciving data from Atlas Scientific product
}
void serialEvent() { //if the hardware serial port_0 recives a char
inputstring = Serial.readStringUntil(13); //read the string until we see a <CR>
input_string_complete = true; //set the flag used to tell if we have recived a completed string from the PC
}
void loop() { //here we go...
if (input_string_complete == true) { //if a string from the PC has been recived in its entirety
myserial.print(inputstring); //send that string to the Atlas Scientific product
myserial.print('\r'); //add a <CR> to the end of the string
inputstring = ""; //clear the string
input_string_complete = false; //reset the flag used to tell if we have recived a completed string from the PC
}
if (myserial.available() > 0) { //if we see that the Atlas Scientific product has sent a character
char inchar = (char)myserial.read(); //get the char we just recived
sensorstring += inchar; //add the char to the var called sensorstring
if (inchar == '\r') { //if the incoming character is a <CR>
sensor_string_complete = true; //set the flag
}
}
if (sensor_string_complete == true) { //if a string from the Atlas Scientific product has been recived in its entirety
if (isdigit(sensorstring[0]) == false) { //if the first character in the string is a digit
Serial.println(sensorstring); //send that string to the PC's serial monitor
}
else //if the first character in the string is NOT a digit
{
print_Humidity_data(); //then call this function
}
sensorstring = ""; //clear the string
sensor_string_complete = false; //reset the flag used to tell if we have recived a completed string from the Atlas Scientific product
}
}
void print_Humidity_data(void) { //this function will pars the string
char sensorstring_array[30]; //we make a char array
char *HUM; //char pointer used in string parsing.
char *TMP; //char pointer used in string parsing.
char *NUL; //char pointer used in string parsing (the sensor outputs some text that we don't need).
char *DEW; //char pointer used in string parsing.
float HUM_float; //float var used to hold the float value of the humidity.
float TMP_float; //float var used to hold the float value of the temperatur.
float DEW_float; //float var used to hold the float value of the dew point.
sensorstring.toCharArray(sensorstring_array, 30); //convert the string to a char array
HUM = strtok(sensorstring_array, ","); //let's pars the array at each comma
TMP = strtok(NULL, ","); //let's pars the array at each comma
NUL = strtok(NULL, ","); //let's pars the array at each comma (the sensor outputs the word "DEW" in the string, we dont need it)
DEW = strtok(NULL, ","); //let's pars the array at each comma
Serial.println(); //this just makes the output easier to read by adding an extra blank line.
Serial.print("HUM:"); //we now print each value we parsed separately.
Serial.println(HUM); //this is the humidity value.
Serial.print("Air TMP:"); //we now print each value we parsed separately.
Serial.println(TMP); //this is the air temperatur value.
Serial.print("DEW:"); //we now print each value we parsed separately.
Serial.println(DEW); //this is the dew point.
Serial.println(); //this just makes the output easier to read by adding an extra blank line.
//uncomment this section if you want to take the values and convert them into floating point number.
/*
HUM_float=atof(HUM);
TMP_float=atof(TMP);
DEW_float=atof(DEW);
*/
}
The above code, can be copied and pasted directly into the Arduino IDE software, however you can also download the code by clicking HERE.
Extract the sample code *.ino file and run it. The Arduino IDE software will inform you that the *.ino file needs to be placed within its own sketch folder, just click OK to continue.
We’re almost ready to take readings from the EZO-HUM™ Sensor, but before we do, we must make sure that the Arduino IDE software knows which board we are using. Go to Tools > Board > Arduino AVR Boards > and make sure that Arduino Uno is selected.
Next, you must tell the software which COM port on your computer the Arduino Uno board is connected to. Go to Tools > Port > and choose the correct COM port.
Now that everything has been properly setup, and the code is ready to go, press the upload button (located at the top left) and it will upload the code directly to your Arduino Uno board.
Ok… Final step, here we go!
Now, you can start taking readings from the EZO-HUMâ„¢ Sensor. From within the Arduino IDE Software, open the Serial Monitor (located at the top right) and make sure to set it to append carriage return only and set the baud rate to 9600.
Congratulations, all the setup work is now complete! You should start to see readings from the EZO-HUM™ Sensor (you’ll notice that only humidity is displayed; air temperature and dew point have been disabled by default). Not to worry, as these can be enabled if you’d like.
This can be done within the serial monitor. Located at the top is a section where you can enter commands to the EZO-HUMâ„¢ Sensor. The command we are going to enter affects the output string from the sensor.
To enable the air temperature, enter the following command into the serial monitor.
O,T,1 then press enter.
To enable the dew point, enter the following command into the serial monitor.
O,Dew,1 then press enter.
Now you should see all the readings from the EZO-HUMâ„¢ Sensor.
For more information on these commands and many others, please refer to the EZO-HUM™ Sensor’s Datasheet.
Of course, if you run into any trouble our tech support team is always here and ready to help you get the EZO-HUMâ„¢ Sensor running in no time!
Many types of meters and devices assess indoor air quality in your home. Some examples include particulate matter meters, CO2 meters, volatile organic compound detectors,
With seaweeds, aquatic vegetables and microalgae farming aquaculture plants, we can get a food source that will not pollute the environment and is rich in