-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sciosense/rework_examples_and_documentation
Rework examples and documentation
- Loading branch information
Showing
19 changed files
with
874 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,79 @@ | ||
# ScioSense ENS21x | ||
# ScioSense ENS21x Arduino Library | ||
Arduino library for the ENS21x temperature & humidity sensor family with I2C interface from ScioSense. | ||
|
||
## Introduction | ||
This project is an Arduino *library*. It implements a driver with examples for the ENS21x sensor family. ENS21x chips are digital temperature & humidity sensors with an I2C interface. | ||
<img src="images/ens21x.png" width="400"> | ||
|
||
Note that the ENS21x requires a supply voltage of 1.71V .. 3.60V. | ||
The ENS21x is a family of high-performance digital temperature and humidity sensors produced by | ||
[ScioSense](http://www.sciosense.com). With industry leading accuracies down to 0.1°C temperature and 0.8% relative | ||
humidity, their rapid response and reliable, long-term performance the ENS21x family addresses the fields of home | ||
appliances, building and automotive HVAC, cold chain management, personal health and wellness monitoring, industrial | ||
automation and instrumentation. | ||
|
||
The ENS21x family includes the ENS210, ENS211, ENS212, ENS213A and the ENS215. | ||
|
||
## Links | ||
The ENS21x sensors are made by [ScioSense](http://www.sciosense.com). | ||
- In the library, an implementation for the ENS210 is given. The datasheet and further documents for this sensor can be downloaded here | ||
https://www.sciosense.com/products/relative-humidity-and-temperature-sensors/ens210-relative-humidity-and-temperature-sensor/ | ||
|
||
* [Further information about the ENS21x](https://www.sciosense.com/products/relative-humidity-and-temperature-sensors/ens210-relative-humidity-and-temperature-sensor/) | ||
* [Datasheet](https://www.sciosense.com/wp-content/uploads/2023/06/SC-001822-DS-3-ENS21x-Datasheet.pdf) | ||
* [Application notes](https://www.sciosense.com/wp-content/uploads/documents/SC-001928-AN-1-ENS21xA-Design-Guidelines.pdf) | ||
* Buy the ENS210 on [Mouser](https://mou.sr/3P3DWmK) or [Digikey](https://www.digikey.nl/en/products/detail/sciosense/ENS210-LQFM/6490747) | ||
* Buy the ENS210 evaluation kit on [Mouser](https://mou.sr/44GNQAi) | ||
|
||
|
||
## Prerequisites | ||
It is assumed that | ||
- The Arduino IDE has been installed. | ||
If not, refer to "Install the Arduino Desktop IDE" on the | ||
[Arduino site](https://www.arduino.cc/en/Guide/HomePage). | ||
- The library directory is at its default location. | ||
For me, that is `C:\Users\sciosense\Documents\Arduino\libraries`. | ||
- Install your board. This library was tested with the ESP32. Here is a step-by-step guide for board installation | ||
(coming soon). | ||
|
||
|
||
## Installation | ||
|
||
### Installation via Arduino Library Manager | ||
- In the Arduino IDE, navigate to the Arduino Library Manager on the left side (or, alternatively, select Sketch > Include Library > Manage Libraries...) | ||
### Installation via Arduino Library Manager (coming soon) | ||
- In the Arduino IDE, navigate to the Arduino Library Manager on the left side (or, alternatively, select Sketch > | ||
Include Library > Manage Libraries...) | ||
- Search for `ScioSense_ENS21x` | ||
- Select the library from the search results and press `Install` | ||
|
||
### Manual installation | ||
- Download the code from this repo via Download ZIP. | ||
- Download the code from this repository via "Download ZIP". | ||
- In Arduino IDE, select Sketch > Include Library > Add .ZIP library... and browse to the just downloaded ZIP file. | ||
- When the IDE is ready this README.md should be located at e.g. `C:\Users\sciosense\Documents\Arduino\libraries\ScioSense_ENS21x\README.md`. | ||
- When the IDE is ready this README.md should be located at `C:\Users\[your_username]\Documents\Arduino\libraries\ScioSense_ENS21x\README.md`. | ||
|
||
|
||
## Wiring | ||
|
||
### General | ||
Please make sure that you use the correct supply voltage: The ENS21x runs at VDD = 1.71...3.60 V. | ||
|
||
### Example with ESP32 (I2C) | ||
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) | ||
with the ENS21x flex foil for I2C communication. | ||
|
||
| ENS21x flex foil | ESP32 | | ||
|:----------------:|:-----:| | ||
| VDD | 3V3 | | ||
| GND | GND | | ||
| SDA | G21 | | ||
| SCL | G22 | | ||
|
||
<img src="images/i2c_pinout_esp32.png" width="1000"> | ||
|
||
## Build an example | ||
To build an example sketch | ||
- (Re)start Arduino. | ||
- Open File > Examples > Examples from Custom Libraries > ScioSense ENS21x > 01_Basic (or any other of the provided examples you wish to run) | ||
- Open File > Examples > Examples from Custom Libraries > ScioSense_ENS21x > 01_Basic (or any other of the provided | ||
examples you wish to run) | ||
- Make sure Tools > Board lists the correct board. | ||
- Select Sketch > Verify/Compile. | ||
|
||
## Contributing | ||
Contributions in the form of issue opening or creating pull requests are very welcome! | ||
|
||
## Acknowledgements | ||
This library is developed for ScioSense by [at² GmbH](https://www.at2-software.com/en/) | ||
|
||
@at2software | ||
|
||
|
||
### ScioSense is a Joint Venture of ams AG | ||
### ScioSense is a Joint Venture of ams AG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <Arduino.h> | ||
#include <Wire.h> | ||
|
||
#include "ens211.h" | ||
|
||
using namespace ScioSense; | ||
|
||
ENS211 ens211; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
Serial.println(); | ||
|
||
Wire.begin(); | ||
ens211.begin(); | ||
|
||
if (ens211.isConnected() == false) | ||
{ | ||
Serial.println("Error -- The ENS211 is not connected."); | ||
while(1); | ||
} | ||
} | ||
|
||
void loop() | ||
{ | ||
if (ens211.singleShotMeasure() == ENS211::Result::STATUS_OK) | ||
{ | ||
float temperatureCelsius = ens211.getTempCelsius(); | ||
float humidityPercent = ens211.getHumidityPercent(); | ||
|
||
Serial.print("Temperature:"); | ||
Serial.print(temperatureCelsius); | ||
Serial.print("°C\t"); | ||
|
||
Serial.print("Humidity:"); | ||
Serial.print(humidityPercent); | ||
Serial.println("%"); | ||
} | ||
|
||
delay(1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <Arduino.h> | ||
#include <Wire.h> | ||
|
||
#include "ens212.h" | ||
|
||
using namespace ScioSense; | ||
|
||
ENS212 ens212; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
Serial.println(); | ||
|
||
Wire.begin(); | ||
ens212.begin(); | ||
|
||
if (ens212.isConnected() == false) | ||
{ | ||
Serial.println("Error -- The ENS212 is not connected."); | ||
while(1); | ||
} | ||
} | ||
|
||
void loop() | ||
{ | ||
if (ens212.singleShotMeasure() == ENS212::Result::STATUS_OK) | ||
{ | ||
float temperatureCelsius = ens212.getTempCelsius(); | ||
float humidityPercent = ens212.getHumidityPercent(); | ||
|
||
Serial.print("Temperature:"); | ||
Serial.print(temperatureCelsius); | ||
Serial.print("°C\t"); | ||
|
||
Serial.print("Humidity:"); | ||
Serial.print(humidityPercent); | ||
Serial.println("%"); | ||
} | ||
|
||
delay(1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <Arduino.h> | ||
#include <Wire.h> | ||
|
||
#include "ens213a.h" | ||
|
||
using namespace ScioSense; | ||
|
||
ENS213A ens213a; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
Serial.println(); | ||
|
||
Wire.begin(); | ||
ens213a.begin(); | ||
|
||
if (ens213a.isConnected() == false) | ||
{ | ||
Serial.println("Error -- The ENS213A is not connected."); | ||
while(1); | ||
} | ||
} | ||
|
||
void loop() | ||
{ | ||
if (ens213a.singleShotMeasure() == ENS213A::Result::STATUS_OK) | ||
{ | ||
float temperatureCelsius = ens213a.getTempCelsius(); | ||
float humidityPercent = ens213a.getHumidityPercent(); | ||
|
||
Serial.print("Temperature:"); | ||
Serial.print(temperatureCelsius); | ||
Serial.print("°C\t"); | ||
|
||
Serial.print("Humidity:"); | ||
Serial.print(humidityPercent); | ||
Serial.println("%"); | ||
} | ||
|
||
delay(1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <Arduino.h> | ||
#include <Wire.h> | ||
|
||
#include "ens215.h" | ||
|
||
using namespace ScioSense; | ||
|
||
ENS215 ens215; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
Serial.println(); | ||
|
||
Wire.begin(); | ||
ens215.begin(); | ||
|
||
if (ens215.isConnected() == false) | ||
{ | ||
Serial.println("Error -- The ENS215 is not connected."); | ||
while(1); | ||
} | ||
} | ||
|
||
void loop() | ||
{ | ||
if (ens215.singleShotMeasure() == ENS215::Result::STATUS_OK) | ||
{ | ||
float temperatureCelsius = ens215.getTempCelsius(); | ||
float humidityPercent = ens215.getHumidityPercent(); | ||
|
||
Serial.print("Temperature:"); | ||
Serial.print(temperatureCelsius); | ||
Serial.print("°C\t"); | ||
|
||
Serial.print("Humidity:"); | ||
Serial.print(humidityPercent); | ||
Serial.println("%"); | ||
} | ||
|
||
delay(1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include <Arduino.h> | ||
#include <Wire.h> | ||
|
||
#include "ens211.h" | ||
|
||
using namespace ScioSense; | ||
|
||
ENS211 ens211; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
Serial.println(); | ||
|
||
Wire.begin(); | ||
ens211.begin(); | ||
|
||
if (ens211.isConnected() == false) | ||
{ | ||
Serial.println("Error -- The ENS211 is not connected."); | ||
while(1); | ||
} | ||
|
||
ens211.reset(); | ||
|
||
Serial.print("Starting continous mode.."); | ||
while (ens211.startContinuousMeasure() != ENS211::Result::STATUS_OK) | ||
{ | ||
Serial.print("."); | ||
delay(ENS211::SystemTiming::BOOTING); | ||
} | ||
Serial.println(" Done!"); | ||
|
||
Serial.println(); | ||
Serial.println("----------------------------------------"); | ||
} | ||
|
||
void loop() | ||
{ | ||
if (ens211.update() == ENS211::Result::STATUS_OK) | ||
{ | ||
float temperatureCelsius = ens211.getTempCelsius(); | ||
float humidityPercent = ens211.getHumidityPercent(); | ||
|
||
Serial.print("Temperature:"); | ||
Serial.print(temperatureCelsius); | ||
Serial.print("°C\t"); | ||
|
||
Serial.print("Humidity:"); | ||
Serial.print(humidityPercent); | ||
Serial.println("%"); | ||
ens211.getStatusH(); | ||
} | ||
} |
Oops, something went wrong.