Skip to content

Commit 29048df

Browse files
2.0.0
Implements the ScioSense core libraries, separates C drivers and Arduino wrappers
2 parents 02955bf + c333ca8 commit 29048df

34 files changed

+1412
-928
lines changed

README.md

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,80 @@
1-
# ScioSense ENS21x Arduino Library
2-
Arduino library for the ENS21x temperature & humidity sensor family with I2C interface from ScioSense.
3-
4-
<img src="images/ens21x.png" width="400">
5-
6-
The ENS21x is a family of high-performance digital temperature and humidity sensors produced by
7-
[ScioSense](http://www.sciosense.com). With industry leading accuracies down to 0.1°C temperature and 0.8% relative
8-
humidity, their rapid response and reliable, long-term performance the ENS21x family addresses the fields of home
9-
appliances, building and automotive HVAC, cold chain management, personal health and wellness monitoring, industrial
10-
automation and instrumentation.
11-
12-
The ENS21x family includes the ENS210, ENS211, ENS212, ENS213A and the ENS215.
13-
14-
## Links
15-
* [Further information about the ENS21x](https://www.sciosense.com/ens21x-family-of-high-performance-digital-temperature-and-humidity-sensors/)
16-
* [Datasheet](https://www.sciosense.com/wp-content/uploads/2023/12/ENS21x-Datasheet.pdf)
17-
* Buy the ENS210 on [Mouser](https://mou.sr/3P3DWmK) or [Digikey](https://www.digikey.nl/en/products/detail/sciosense/ENS210-LQFM/6490747)
18-
* Buy the ENS210 evaluation kit on [Mouser](https://mou.sr/44GNQAi)
19-
20-
21-
## Prerequisites
22-
It is assumed that
23-
- The Arduino IDE has been installed.
24-
If not, refer to "Install the Arduino Desktop IDE" on the
25-
[Arduino site](https://www.arduino.cc/en/Guide/HomePage).
26-
- The library directory is at its default location. Normally this is `C:\Users\[your_username]\Documents\Arduino\libraries`.
27-
28-
You might need to add your board to the Arduino IDE. This library was tested with the [Espressif ESP32](https://www.espressif.com/en/products/socs/esp32).
29-
For the installation of the ESP32 in the Arduino IDE, see [Arduino ESP32 Installation](https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html)
30-
31-
32-
## Installation
33-
34-
### Installation via Arduino Library Manager (coming soon)
35-
- In the Arduino IDE, navigate to the Arduino Library Manager on the left side (or, alternatively, select Sketch >
36-
Include Library > Manage Libraries...)
37-
- Search for `ScioSense_ENS21x`
38-
- Select the library from the search results and press `Install`
39-
40-
### Manual installation
41-
- Download the code from this repository via "Download ZIP".
42-
- In Arduino IDE, select Sketch > Include Library > Add .ZIP library... and browse to the just downloaded ZIP file.
43-
- When the IDE is ready this README.md should be located at `C:\Users\[your_username]\Documents\Arduino\libraries\ScioSense_ENS21x\README.md`.
44-
45-
46-
## Wiring
47-
48-
### General
49-
Please make sure that you use the correct supply voltage: The ENS21x runs at VDD = 1.71...3.60 V.
50-
51-
### Example with ESP32 (I2C)
52-
This example shows how to wire a [ESP32DevKitC](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#get-started-esp32-devkitc-board-front)
53-
with the ENS21x flex foil for I2C communication.
54-
55-
| ENS21x flex foil | ESP32 |
56-
|:----------------:|:-----:|
57-
| VDD | 3V3 |
58-
| GND | GND |
59-
| SDA | G21 |
60-
| SCL | G22 |
61-
62-
<img src="images/i2c_pinout_esp32.png" width="1000">
63-
64-
## Build an example
65-
To build an example sketch
66-
- (Re)start Arduino.
67-
- Open File > Examples > Examples from Custom Libraries > ScioSense_ENS21x > 01_Basic (or any other of the provided
68-
examples you wish to run)
69-
- Make sure Tools > Board lists the correct board.
70-
- Select Sketch > Verify/Compile.
71-
72-
## Contributing
73-
Contributions in the form of issue opening or creating pull requests are very welcome!
74-
75-
## Acknowledgements
76-
This library is developed for ScioSense by [at² GmbH](https://www.at2-software.com/en/)
77-
78-
@at2software
79-
80-
### ScioSense is a Joint Venture of ams AG
1+
# ScioSense ENS21x Arduino Library
2+
Arduino library for the ENS21x temperature & humidity sensor family with I2C interface from ScioSense.
3+
4+
<img src="images/ens21x.png" width="400">
5+
6+
The ENS21x is a family of high-performance digital temperature and humidity sensors produced by
7+
[ScioSense](http://www.sciosense.com). With industry leading accuracies down to 0.1°C temperature and 0.8% relative
8+
humidity, their rapid response and reliable, long-term performance the ENS21x family addresses the fields of home
9+
appliances, building and automotive HVAC, cold chain management, personal health and wellness monitoring, industrial
10+
automation and instrumentation.
11+
12+
The ENS21x family includes the ENS210, ENS211, ENS212, ENS213A and the ENS215.
13+
14+
## Links
15+
* [Further information about the ENS21x](https://www.sciosense.com/ens21x-family-of-high-performance-digital-temperature-and-humidity-sensors/)
16+
* [Datasheet](https://www.sciosense.com/wp-content/uploads/2024/04/ENS21x-Datasheet.pdf)
17+
* Buy the ENS210 on [Mouser](https://mou.sr/3P3DWmK) or [Digikey](https://www.digikey.nl/en/products/detail/sciosense/ENS210-LQFM/6490747)
18+
* Buy the ENS210 evaluation kit on [Mouser](https://mou.sr/44GNQAi)
19+
20+
21+
## Prerequisites
22+
It is assumed that
23+
- The Arduino IDE has been installed.
24+
If not, refer to "Install the Arduino Desktop IDE" on the
25+
[Arduino site](https://www.arduino.cc/en/Guide/HomePage).
26+
- The library directory is at its default location. Normally this is `C:\Users\[your_username]\Documents\Arduino\libraries`.
27+
28+
You might need to add your board to the Arduino IDE. This library was tested with the [Espressif ESP32](https://www.espressif.com/en/products/socs/esp32).
29+
For the installation of the ESP32 in the Arduino IDE, see [Arduino ESP32 Installation](https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html)
30+
31+
32+
## Installation
33+
34+
### Installation via Arduino Library Manager (coming soon)
35+
- In the Arduino IDE, navigate to the Arduino Library Manager on the left side (or, alternatively, select Sketch >
36+
Include Library > Manage Libraries...)
37+
- Search for `ScioSense_ENS21x`
38+
- Select the library from the search results and press `Install`
39+
40+
### Manual installation
41+
- Download the code from this repository via "Download ZIP".
42+
- In Arduino IDE, select Sketch > Include Library > Add .ZIP library... and browse to the just downloaded ZIP file.
43+
- When the IDE is ready this README.md should be located at `C:\Users\[your_username]\Documents\Arduino\libraries\ScioSense_ENS21x\README.md`.
44+
45+
46+
## Wiring
47+
48+
### General
49+
Please make sure that you use the correct supply voltage: The ENS21x runs at VDD = 1.71...3.60 V.
50+
51+
### Example with ESP32 (I2C)
52+
This example shows how to wire a [ESP32DevKitC](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#get-started-esp32-devkitc-board-front)
53+
with the ENS21x flex foil for I2C communication.
54+
55+
| ENS21x flex foil | ESP32 |
56+
|:----------------:|:-----:|
57+
| VDD | 3V3 |
58+
| GND | GND |
59+
| SDA | G21 |
60+
| SCL | G22 |
61+
62+
<img src="images/i2c_pinout_esp32.png" width="1000">
63+
64+
## Build an example
65+
To build an example sketch
66+
- (Re)start Arduino.
67+
- Open File > Examples > Examples from Custom Libraries > ScioSense_ENS21x > 01_Basic (or any other of the provided
68+
examples you wish to run)
69+
- Make sure Tools > Board lists the correct board.
70+
- Select Sketch > Verify/Compile.
71+
72+
## Contributing
73+
Contributions in the form of issue opening or creating pull requests are very welcome!
74+
75+
## Acknowledgements
76+
This library is developed for ScioSense by [at² GmbH](https://www.at2-software.com/en/)
77+
78+
@at2software
79+
80+
### ScioSense is a Joint Venture of ams AG

examples/01_Basic/ENS210/ENS210.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include "ens210.h"
55

6-
using namespace ScioSense;
7-
86
ENS210 ens210;
97

108
void setup()
@@ -14,6 +12,7 @@ void setup()
1412

1513
Wire.begin();
1614
ens210.begin();
15+
ens210.init();
1716

1817
if (ens210.isConnected() == false)
1918
{
@@ -24,7 +23,7 @@ void setup()
2423

2524
void loop()
2625
{
27-
if (ens210.singleShotMeasure() == ENS210::Result::STATUS_OK)
26+
if (ens210.singleShotMeasure() == RESULT_OK)
2827
{
2928
float temperatureCelsius = ens210.getTempCelsius();
3029
float humidityPercent = ens210.getHumidityPercent();

examples/01_Basic/ENS211/ENS211.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include "ens211.h"
55

6-
using namespace ScioSense;
7-
86
ENS211 ens211;
97

108
void setup()
@@ -14,6 +12,7 @@ void setup()
1412

1513
Wire.begin();
1614
ens211.begin();
15+
ens211.init();
1716

1817
if (ens211.isConnected() == false)
1918
{
@@ -24,7 +23,7 @@ void setup()
2423

2524
void loop()
2625
{
27-
if (ens211.singleShotMeasure() == ENS211::Result::STATUS_OK)
26+
if (ens211.singleShotMeasure() == RESULT_OK)
2827
{
2928
float temperatureCelsius = ens211.getTempCelsius();
3029
float humidityPercent = ens211.getHumidityPercent();

examples/01_Basic/ENS212/ENS212.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include "ens212.h"
55

6-
using namespace ScioSense;
7-
86
ENS212 ens212;
97

108
void setup()
@@ -14,6 +12,7 @@ void setup()
1412

1513
Wire.begin();
1614
ens212.begin();
15+
ens212.init();
1716

1817
if (ens212.isConnected() == false)
1918
{
@@ -24,7 +23,7 @@ void setup()
2423

2524
void loop()
2625
{
27-
if (ens212.singleShotMeasure() == ENS212::Result::STATUS_OK)
26+
if (ens212.singleShotMeasure() == RESULT_OK)
2827
{
2928
float temperatureCelsius = ens212.getTempCelsius();
3029
float humidityPercent = ens212.getHumidityPercent();

examples/01_Basic/ENS213A/ENS213A.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include "ens213a.h"
55

6-
using namespace ScioSense;
7-
86
ENS213A ens213a;
97

108
void setup()
@@ -14,6 +12,7 @@ void setup()
1412

1513
Wire.begin();
1614
ens213a.begin();
15+
ens213a.init();
1716

1817
if (ens213a.isConnected() == false)
1918
{
@@ -24,7 +23,7 @@ void setup()
2423

2524
void loop()
2625
{
27-
if (ens213a.singleShotMeasure() == ENS213A::Result::STATUS_OK)
26+
if (ens213a.singleShotMeasure() == RESULT_OK)
2827
{
2928
float temperatureCelsius = ens213a.getTempCelsius();
3029
float humidityPercent = ens213a.getHumidityPercent();

examples/01_Basic/ENS215/ENS215.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include "ens215.h"
55

6-
using namespace ScioSense;
7-
86
ENS215 ens215;
97

108
void setup()
@@ -14,6 +12,7 @@ void setup()
1412

1513
Wire.begin();
1614
ens215.begin();
15+
ens215.init();
1716

1817
if (ens215.isConnected() == false)
1918
{
@@ -24,7 +23,7 @@ void setup()
2423

2524
void loop()
2625
{
27-
if (ens215.singleShotMeasure() == ENS215::Result::STATUS_OK)
26+
if (ens215.singleShotMeasure() == RESULT_OK)
2827
{
2928
float temperatureCelsius = ens215.getTempCelsius();
3029
float humidityPercent = ens215.getHumidityPercent();

examples/02_Continuous_Mode/ENS210/ENS210.ino

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include "ens210.h"
55

6-
using namespace ScioSense;
7-
86
ENS210 ens210;
97

108
void setup()
@@ -14,20 +12,19 @@ void setup()
1412

1513
Wire.begin();
1614
ens210.begin();
15+
ens210.init();
1716

1817
if (ens210.isConnected() == false)
1918
{
2019
Serial.println("Error -- The ENS210 is not connected.");
2120
while(1);
2221
}
2322

24-
ens210.reset();
25-
2623
Serial.print("Starting continous mode..");
27-
while (ens210.startContinuousMeasure() != ENS210::Result::STATUS_OK)
24+
while (ens210.startContinuousMeasure() != RESULT_OK)
2825
{
2926
Serial.print(".");
30-
delay(ENS210::SystemTiming::BOOTING);
27+
delay(ENS21X_SYSTEM_TIMING_BOOTING);
3128
}
3229
Serial.println(" Done!");
3330

@@ -37,7 +34,9 @@ void setup()
3734

3835
void loop()
3936
{
40-
if (ens210.update() == ENS210::Result::STATUS_OK)
37+
ens210.wait();
38+
39+
if (ens210.update() == RESULT_OK)
4140
{
4241
float temperatureCelsius = ens210.getTempCelsius();
4342
float humidityPercent = ens210.getHumidityPercent();
@@ -49,6 +48,5 @@ void loop()
4948
Serial.print("Humidity:");
5049
Serial.print(humidityPercent);
5150
Serial.println("%");
52-
ens210.getStatusH();
5351
}
5452
}

examples/02_Continuous_Mode/ENS211/ENS211.ino

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include "ens211.h"
55

6-
using namespace ScioSense;
7-
86
ENS211 ens211;
97

108
void setup()
@@ -14,20 +12,19 @@ void setup()
1412

1513
Wire.begin();
1614
ens211.begin();
15+
ens211.init();
1716

1817
if (ens211.isConnected() == false)
1918
{
2019
Serial.println("Error -- The ENS211 is not connected.");
2120
while(1);
2221
}
2322

24-
ens211.reset();
25-
2623
Serial.print("Starting continous mode..");
27-
while (ens211.startContinuousMeasure() != ENS211::Result::STATUS_OK)
24+
while (ens211.startContinuousMeasure() != RESULT_OK)
2825
{
2926
Serial.print(".");
30-
delay(ENS211::SystemTiming::BOOTING);
27+
delay(ENS21X_SYSTEM_TIMING_BOOTING);
3128
}
3229
Serial.println(" Done!");
3330

@@ -37,7 +34,9 @@ void setup()
3734

3835
void loop()
3936
{
40-
if (ens211.update() == ENS211::Result::STATUS_OK)
37+
ens211.wait();
38+
39+
if (ens211.update() == RESULT_OK)
4140
{
4241
float temperatureCelsius = ens211.getTempCelsius();
4342
float humidityPercent = ens211.getHumidityPercent();
@@ -49,6 +48,5 @@ void loop()
4948
Serial.print("Humidity:");
5049
Serial.print(humidityPercent);
5150
Serial.println("%");
52-
ens211.getStatusH();
5351
}
5452
}

0 commit comments

Comments
 (0)