Introduction
This multifunctional environmental sensor comprises SHTC3 temperature & humidity sensor, BMP280 atmospheric pressure sensor, VEML7700 light sensor, and ultraviolet sensor(V1.0: ML8511, V2.0: LTR390-UV-01) into one and offers 5 kinds of environmental parameters. Professional sensor chips are selected for each kind of parameter measurement. The reasonable layout and heat conduction of the main chip are carefully considered in the circuit design, which effectively guarantees the accuracy of sensor data.
The product has an MCU processing chip onboard that converts the raw sensor data into values with the standard unit so you can directly use them. For example, ℃ and °F for temperature, % for humidity, Kpa for atmospheric pressure, lx for light illuminance, and mw/cm² for ultraviolet.
The environmental sensor supports two communication methods, UART and I2C. There are two versions: Gravity and Fermion(breakout), also complete Arduino and Python libraries are provided.
Exquisite and small, you can use it to make indoor and outdoor environmental monitoring systems, or for your environmental monitoring topics. This DFRobot environmental sensor can greatly simplify the wirings and codes of your project.
Please kindly note that the multifunctional environmental sensor V2.0 utilizes LTR390-UV-01 ultraviolet sensor, while the V1.0 uses the ML8511 sensor.
Features
- Gravity interface, no need to solder, plug and play.
- Switchable I2C and UART two output modes
- Highly integrated module, can test a variety of data at the same time (temperature, humidity, atmospheric pressure, altitude, ultraviolet intensity, ambient light intensity)
- Reasonable layout and high precision.
Application
- Home indoor and outdoor environment detection system
- Environmental monitoring work
register table
V1.0
Specification
- Working voltage: 3.3~5V DC
- Working current: 45mA
- Output signal: I2C, UART
- Working temperature: -20~70℃
- Product size: 32mm×32mm / 1.26×1.26 inch
- Mounting hole size: M3 (diameter 3mm / 0.12 inch), the distance between the centers of the mounting holes is 25mm / 0.98 inch
Atmospheric pressure sensor
Atmospheric pressure unit relationship: 1000pa = 10hpa = 1kpa
- Sensor chip model: BMP280
- Atmospheric pressure measurement range: 3000~1100 hPa
- Relative accuracy of atmospheric pressure: ±0.12 hPa
- Absolute atmospheric pressure accuracy: ±1 hPa
Temperature & Humidity Sensor
- Sensor chip model: SHT-C3
- Relative humidity accuracy: ±2%RH
- Relative humidity resolution: 0.01%RH
- Relative humidity measurement range: 0~100
- Temperature accuracy: ±0.2℃
- Temperature resolution: 0.01℃
- Temperature measurement range: -40~125℃
Ultraviolet Sensor
- Sensor chip model: ML8511
- Ultraviolet sensitive wavelength UV-A (320-400nm), UV-B (280-320nm)
- Ultraviolet output unit: mW/c㎡
Ambient light sensor
- Sensor chip model: VEML7700
- Ambient light accuracy: 0.0036 lx/ct
- Ambient light range: 0~120 klx
Dimension
Overview
Num | Label | Description |
---|---|---|
1 | D/T | I2C data line SDA/UART data transmission-TX |
2 | C/R | I2C clock line SCL/UART data receiving-RX |
3 | - | GND |
4 | + | Power + |
Tutorial
Download the program to DFRuino UNO, open the serial monitor to check various environmental parameters.
Requirements
- Hardware
- DFRduino UNO R3 (or similar) x 1
- SEN0501 Multifunctional environmental sensor x1
- Wires
- Software
- Arduino IDE
- Download and install DFRobot RTU library
- Download and install the DFRobot_EnvironmentalSensor Library (About how to install the library?)
Read Sensor Data via I2C/UART
Connection for UART and I2C
UART on the left, I2C on the right.
Switch Communication Mode
About UART/I2C mode switching:
- The default mode in the code is UART. Dial the switch to UART side to use it.
- For using I2C, dial the switch to I2C side and replace the 1 at the beginning of the code with 0, as shown below:
to
Steps:
Note: Different motherboards correspond to different wiring pins (refer to “more wiring diagrams” above). In the Arduino IDE, they also correspond to different motherboard options and different ports (COM). The other steps are the same as DFRuino UNO.
- Connect the module and DFRuino UNO according to the wiring method above.
- Open the Arduino IDE and upload the following code to DFRuino UNO.
- Open the serial port monitor of Arduino IDE, adjust the baud rate to 115200, and observe the serial port printing result.
Sample Code
Function: Print all data obtained by the module
/*!
*@file read_data.ino
*@brief This demo shows how to get data of the SEN0500/SEN0501 sensor and outputs data through I2C or UART.
*@n Print the data returned by SEN0500/SEN0501 in the serial port monitor.
* @n connected table
* ---------------------------------------------------------------------------------------------------------------
* board | MCU | Leonardo/Mega2560/M0 | UNO | ESP8266 | ESP32 | microbit |
* VCC | 3.3V/5V | VCC | VCC | VCC | VCC | X |
* GND | GND | GND | GND | GND | GND | X |
* RX | TX | Serial1 TX1 | 5 | 5/D6 | D2 | X |
* TX | RX | Serial1 RX1 | 4 | 4/D7 | D3 | X |
* ---------------------------------------------------------------------------------------------------------------
*
* @copyright Copyright (c) 2021 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [TangJie](jie.tang@dfrobot.com)
* @version V1.0
* @date 2021-08-31
* @url https://github.com/DFRobot/DFRobot_EnvironmentalSensor
*/
#include "DFRobot_EnvironmentalSensor.h"
#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
#include <SoftwareSerial.h>
#endif
#define MODESWITCH /*UART:*/1 /*I2C: 0*/
#if MODESWITCH
#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
SoftwareSerial mySerial(/*rx =*/4, /*tx =*/5);
DFRobot_EnvironmentalSensor environment(/*addr =*/SEN0500/SEN0501_DEFAULT_DEVICE_ADDRESS, /*s =*/&mySerial);
#else
DFRobot_EnvironmentalSensor environment(/*addr =*/SEN0500/SEN0501_DEFAULT_DEVICE_ADDRESS, /*s =*/&Serial1);
#endif
#else
DFRobot_EnvironmentalSensor environment(/*addr = */SEN0500/SEN0501_DEFAULT_DEVICE_ADDRESS, /*pWire = */&Wire);
#endif
void setup()
{
#if MODESWITCH
//Init MCU communication serial port
#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
mySerial.begin(9600);
#elif defined(ESP32)
Serial1.begin(9600, SERIAL_8N1, /*rx =*/D3, /*tx =*/D2);
#else
Serial1.begin(9600);
#endif
#endif
Serial.begin(115200);
while(environment.begin() != 0){
Serial.println(" Sensor initialize failed!!");
delay(1000);
}
Serial.println(" Sensor initialize success!!");
}
void loop()
{
//Print the data obtained from sensor
Serial.println("-------------------------------");
Serial.print("Temp: ");
Serial.print(environment.getTemperature(TEMP_C));
Serial.println(" ℃");
Serial.print("Temp: ");
Serial.print(environment.getTemperature(TEMP_F));
Serial.println(" ℉");
Serial.print("Humidity: ");
Serial.print(environment.getHumidity());
Serial.println(" %");
Serial.print("Ultraviolet intensity: ");
Serial.print(environment.getUltravioletIntensity());
Serial.println(" mw/cm2");
Serial.print("LuminousIntensity: ");
Serial.print(environment.getLuminousIntensity());
Serial.println(" lx");
Serial.print("Atmospheric pressure: ");
Serial.print(environment.getAtmospherePressure(HPA));
Serial.println(" hpa");
Serial.print("Altitude: ");
Serial.print(environment.getElevation());
Serial.println(" m");
Serial.println("-------------------------------");
delay(500);
}
Expected Results
The read data will be dipalyed on the serial monitor.
Function Library Name Definition
/**
* @fn begin
* @brief Init SEN0500/SEN0501 sensor
* @return Return init status
* @retval 0 Succeed
* @retval -1 failed
*/
int8_t begin(void);
/**
* @fn getTemperature
* @brief Get SEN0500/SEN0501 temperature data
* @param units Temperature data unit select
* @n TEMP_C ℃
* @n TEMP_F ℉
* @return Return the obtained temperature data
*/
float getTemperature(uint8_t unist);
/**
* @fn getHumidity
* @brief Get SEN0500/SEN0501 humidity data
* @return Return the obtained humidity data
*/
float getHumidity(void);
/**
* @fn getUltravioletIntensity
* @brief Get SEN0500/SEN0501 UV intensity index data
* @return Return the obtained UV intensity index data
*/
float getUltravioletIntensity(void);
/**
* @fn getLuminousIntensity
* @brief Get SEN0500/SEN0501 luminous intensity data
* @return Return the obtained luminous intensity data
*/
float getLuminousIntensity(void);
/**
* @fn getAtmospherePressure
* @brief Get SEN0500/SEN0501 atmosphere pressure data
* @param units Atmosphere pressure data unit select
* @n HPA: Hectopascal
* @n KPA: Kilopascal
* @return Return the obtained atmosphere pressure data
*/
uint16_t getAtmospherePressure(uint8_t units);
/**
* @fn getElevation
* @brief Get SEN0500/SEN0501 altitude data
* @return Return the obtained altitude data
*/
float getElevation(void);
V2.0
Specification
- Working voltage: 3.3-5V DC
- Working current: about 4mA
- Output signal: I2C, UART
- Working temperature: -20 to 70℃
- Product size: 32mm×32mm / 1.26×1.26 inch
- Mounting hole size: M3 (diameter 3mm / 0.12 inch), the distance between the centers of the mounting holes is 25mm / 0.98 inch
Atmospheric pressure sensor
Atmospheric pressure unit relationship: 1000pa = 10hpa = 1kpa
- Sensor chip model: BMP280
- Atmospheric pressure measurement range: 3000~1100 hPa
- Relative accuracy of atmospheric pressure: ±0.12 hPa
- Absolute atmospheric pressure accuracy: ±1 hPa
Temperature & Humidity Sensor
- Sensor chip model: SHT-C3
- Relative humidity accuracy: ±2%RH
- Relative humidity resolution: 0.01%RH
- Relative humidity measurement range: 0-100
- Temperature accuracy: ±0.2℃
- Temperature resolution: 0.01℃
- Temperature measurement range: -40-125℃
Ultraviolet Sensor
- Sensor chip model: LTR390-UV-01
- Ultraviolet sensitive wavelength: 280-430nm
- Measurement data Range: 13 Bit, 16 Bit, 17 Bit, 18 Bit, 19 Bit, 20 Bit
- Measurement rate: 25ms, 50ms, 100ms, 200ms, 500ms, 1000ms
- Adjustable gain: X1, X3, X6, X9, X18
Ambient light sensor
- Sensor chip model: VEML7700
- Ambient light accuracy: 0.0036 lx/ct
- Ambient light range: 0-120 klx
Dimension
Overview
Num | Label | Description |
---|---|---|
1 | D/T | I2C data line SDA/UART data transmission-TX |
2 | C/R | I2C clock line SCL/UART data receiving-RX |
3 | - | GND |
4 | + | Power + |
Tutorial
Download the program to DFRuino UNO, open the serial monitor to check various environmental parameters.
Requirements
- Hardware
- DFRduino UNO R3 (or similar) x 1
- SEN0501 Multifunctional environmental sensor x1
- Wires
- Software
- Arduino IDE
- Download and install DFRobot RTU library
- Download and install the DFRobot_EnvironmentalSensor Library (About how to install the library?)
Read Sensor Data via I2C/UART
Connection for UART and I2C
Switch Communication Mode
About UART/I2C mode switching:
- The default mode in the code is UART. Dial the switch to UART side to use it.
- For using I2C, dial the switch to I2C side and replace the 1 at the beginning of the code with 0, as shown below:
to
Steps:
Note: Different motherboards correspond to different wiring pins (refer to “more wiring diagrams” above). In the Arduino IDE, they also correspond to different motherboard options and different ports (COM). The other steps are the same as DFRuino UNO.
- Connect the module and DFRuino UNO according to the wiring method above.
- Open the Arduino IDE and upload the following code to DFRuino UNO.
- Open the serial port monitor of Arduino IDE, adjust the baud rate to 115200, and observe the serial port printing result.
Sample Code
Function: Print all data obtained by the module
#include "DFRobot_EnvironmentalSensor.h"
#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
#include <SoftwareSerial.h>
#endif
#define MODESWITCH /*UART:*/1 /*I2C: 0*/
#if MODESWITCH
#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
SoftwareSerial mySerial(/*rx =*/4, /*tx =*/5);
DFRobot_EnvironmentalSensor environment(/*addr =*/SEN0500/SEN0501_DEFAULT_DEVICE_ADDRESS, /*s =*/&mySerial);
#else
DFRobot_EnvironmentalSensor environment(/*addr =*/SEN0500/SEN0501_DEFAULT_DEVICE_ADDRESS, /*s =*/&Serial1);
#endif
#else
DFRobot_EnvironmentalSensor environment(/*addr = */SEN0500/SEN0501_DEFAULT_DEVICE_ADDRESS, /*pWire = */&Wire);
#endif
void setup()
{
#if MODESWITCH
//Init MCU communication serial port
#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
mySerial.begin(9600);
#elif defined(ESP32)
Serial1.begin(9600, SERIAL_8N1, /*rx =*/D3, /*tx =*/D2);
#else
Serial1.begin(9600);
#endif
#endif
Serial.begin(115200);
while(environment.begin() != 0){
Serial.println(" Sensor initialize failed!!");
delay(1000);
}
Serial.println(" Sensor initialize success!!");
}
void loop()
{
//Print the data obtained from sensor
Serial.println("-------------------------------");
Serial.print("Temp: ");
Serial.print(environment.getTemperature(TEMP_C));
Serial.println(" ℃");
Serial.print("Temp: ");
Serial.print(environment.getTemperature(TEMP_F));
Serial.println(" ℉");
Serial.print("Humidity: ");
Serial.print(environment.getHumidity());
Serial.println(" %");
Serial.print("Ultraviolet intensity: ");
Serial.print(environment.getUltravioletIntensity());
Serial.println(" mw/cm2");
Serial.print("LuminousIntensity: ");
Serial.print(environment.getLuminousIntensity());
Serial.println(" lx");
Serial.print("Atmospheric pressure: ");
Serial.print(environment.getAtmospherePressure(HPA));
Serial.println(" hpa");
Serial.print("Altitude: ");
Serial.print(environment.getElevation());
Serial.println(" m");
Serial.println("-------------------------------");
delay(500);
}
Expected Results
The read data will be dipalyed on the serial monitor.
Function Library Name Definition
/**
* @fn begin
* @brief Init SEN0500/SEN0501 sensor
* @return Return init status
* @retval 0 Succeed
* @retval -1 failed
*/
int8_t begin(void);
/**
* @fn getTemperature
* @brief Get SEN0500/SEN0501 temperature data
* @param units Temperature data unit select
* @n TEMP_C ℃
* @n TEMP_F ℉
* @return Return the obtained temperature data
*/
float getTemperature(uint8_t unist);
/**
* @fn getHumidity
* @brief Get SEN0500/SEN0501 humidity data
* @return Return the obtained humidity data
*/
float getHumidity(void);
/**
* @fn getUltravioletIntensity
* @brief Get SEN0500/SEN0501 UV intensity index data
* @return Return the obtained UV intensity index data
*/
float getUltravioletIntensity(void);
/**
* @fn getLuminousIntensity
* @brief Get SEN0500/SEN0501 luminous intensity data
* @return Return the obtained luminous intensity data
*/
float getLuminousIntensity(void);
/**
* @fn getAtmospherePressure
* @brief Get SEN0500/SEN0501 atmosphere pressure data
* @param units Atmosphere pressure data unit select
* @n HPA: Hectopascal
* @n KPA: Kilopascal
* @return Return the obtained atmosphere pressure data
*/
uint16_t getAtmospherePressure(uint8_t units);
/**
* @fn getElevation
* @brief Get SEN0500/SEN0501 altitude data
* @return Return the obtained altitude data
*/
float getElevation(void);
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.