IoT Node

Installation

You'll need to install a library to make Arduino IDE support the sensor. This library includes drivers for the BME680 sensor and sample code for you to jumpstart your project.

Software

For ESP32 based systems, we're currently supporting Arduino core. Please make sure you've installed the following:

  • Arduino IDE.

  • ESP32 Hardware libraries for the Arduino IDE.

  • Python for the compilation of Arduino projects.

  • Drivers for your host device, e.g., USB Virtual Serial Port driver.

Libraries

Please download the library archive from https://github.com/Turta-io/Modular

Then, copy its contents to your Arduino Libraries folder.

You can find the Arduino Libraries folder inside your Arduino sketch directory. It is generally located inside the My Documents folder.

Samples

The library comes with included samples. There is no need to download additional files for the examples.

Source Code

The hardware, its drivers and the sample code are open source. You can use them under the terms of the MIT license. Please feel free to customize and prototype them for your projects.

Arduino Library

Turta_Environmental_Module library is responsible for initializing the sensor, reading calibration data and reading temperature, humidity, pressure, and gas resistance values with respect to calibration data. It also controls the heater in the sensor for gas resistance measurement.

To use the library on Arduino IDE, add the following #include statement to the top of your sketch.

#include <Turta_Environmental_Module.h>

Then, create an instance of the Turta_Environmental_Module class.

Turta_Environmental_Module en

Now you're ready to access the library by calling the en instance.

Initialization

To initialize the sensor, call the begin method.

begin()

This method turns the sensor on and then reads the calibration coefficients to the memory. It also sets the heater temperature to 250 °C and heating time to 250 ms for gas resistance reading.

Basic Members

Read Temperature

Returns the last temperature reading from the sensor.

double readTemperature()
  • Parameters

    • None

  • Returns

    • Double: Temperature

Read Humidity

Returns the relative humidity reading from the sensor.

double readHumidity()
  • Parameters

    • None

  • Returns

    • Double: Humidity

Read Pressure

Returns the pressure reading from the sensor.

double readPressure()
  • Parameters

    • None

  • Returns

    • Double: Pressure

Read Humidity

Returns the relative humidity reading from the sensor.

double readHumidity()
  • Parameters

    • None

  • Returns

    • Double: Humidity

Calculate Altitude

Returns the altitude from the sea level.

double calcAltitude(double meanSeaLevelPressureInBar)
  • Parameters

    • Double: meanSeaLevelPressureInBar

  • Returns

    • Double: Altitude

Read Gas Resistance

Returns the gas resistance reading from the sensor.

double readGasResistance()
  • Parameters

    • None

  • Returns

    • Double: Gas Resistance in Ohms

Read Temperature, Pressure, and Humidity in One Shot

Returns the temperature, pressure, and humidity reading from the sensor.

void readPressure(double temperature, double pressure, double humidity)
  • Parameters

    • Double: temperature out

    • Double: pressure out

    • Double: humidity out

  • Returns

    • None

Advanced Members

Advanced Initialization

To initialize the sensor with manual hot plate configuration, call the begin advanced method.

beginAdvanced(ushort heatDuration, uint heatTemperature)

This method turns the sensor on and then reads the calibration coefficients to the memory. It configures heater duration and temperature according to the given parameters.

  • Parameters

    • ushort: heatDuration

    • uint: heatTemperature

Examples

You can open the example from Arduino IDE > File > Examples > Examples from Custom Libraries > Turta Environmental Module. There are three examples of this sensor.

Single Readings SampleOne Shot TPH SampleGas Settings Sample

Troubleshooting

If you're experiencing difficulties while working with your device, please try the following steps.

Problem: You're reading NaN instead of sensor data. Cause: The host device does not communicate with the sensor over the I2C protocol. There is a software bug on the ESP32 Arduino hardware library which prevents I2C communication. Solution: Please update the ESP32 hardware library.

Problem: Temperature reading is above, and humidity reading is below from it should be. Cause: ESP32's CPU can reach up to 240MHz, which heats itself and surroundings. Solution: For temperature and humidity reading applications, it would be better first to read the sensor data, then run the other tasks. If you're making just a temperature & humidity sensing device, you may wish to DeepSleep the host device while it is idle.

Problem: Humidity reading is much higher than it should be. Cause: In some cases, moisture does not escape from the sensor quickly. Solution: Please run the example application for a few hours and observe if the humidity level is decreasing. If not, you can bake the sensor module at 100 °C for 15 minutes to make moisture escape from the sensor's measuring hole.

Problem: Sensor readings are not accurate after inserting the sensor to the slot, while the application is running. Cause: The sensor library reads the calibration coefficients at the beginning of the application. If you insert the sensor module after the application is started, the library does not get the calibration coefficients and return inaccurate readings. Solution: Please press the reset button on the host board, or upload the application again while the sensor module is in the sensor slot.

Last updated