You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/06.nicla/boards/nicla-sense-env/tutorials/user-manual/content.md
+157-4Lines changed: 157 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,8 @@ This user manual provides a comprehensive Nicla Sense Env board overview, highli
42
42
43
43
Enhance your environmental sensing capabilities with the Nicla Sense Env board. This board combines three cutting-edge sensors from Renesas® with the Arduino ecosystem's ease of integration and scalability. This board is well-suited for augmenting your Portenta or MKR-based projects with environmental sensing capabilities.
44
44
45
+

46
+
45
47
The Nicla Sense Env includes an ultra-low power temperature and humidity sensor, complemented by two sophisticated industrial-grade gas sensors capable of assessing air quality in indoor and outdoor settings. Its compact dimensions (22.86 x 22.86 mm) and sturdy build make the Nicla Sense Env an excellent choice for projects that demand sensor fusion and the computational capabilities of Arduino boards.
46
48
47
49
### Nicla Sense Env Architecture Overview
@@ -62,8 +64,8 @@ Here's an overview of the board's main components shown in the images above:
62
64
-**Onboard humidity and temperature sensor**: The Nicla Sense Env features an onboard humidity and temperature sensor, the [HS4001 from Renesas](https://www.renesas.com/us/en/products/sensor-products/environmental-sensors/humidity-temperature-sensors/hs4001-relative-humidity-and-temperature-sensor-digital-output-15-rh). This highly accurate, ultra-low power, fully calibrated relative humidity and temperature sensor features proprietary sensor-level protection, ensuring high reliability and long-term stability.
63
65
-**Onboard indoor air quality sensor**: The Nicla Sense Env features an onboard gas sensor, the [ZMOD4410 from Renesas](https://www.renesas.com/us/en/document/dst/zmod4410-datasheet). This sophisticated sensor was designed to detect total volatile organic compounds (TVOC), estimate CO<sub>2</sub>, and monitor and report indoor air quality (IAQ).
64
66
-**Onboard outdoor air quality sensor**: The Nicla Sense Env features an onboard gas sensor, the [ZMOD4510 from Renesas](https://www.renesas.com/us/en/document/dst/zmod4410-datasheet). This sophisticated sensor was designed to monitor and report outdoor air quality (OAQ) based on nitrogen dioxide (NO<sub>2</sub>) and ozone (O<sub>3</sub>) measurements.
65
-
-**Onboard user LEDs**: The Nicla Sense Env has two onboard user-programmable LEDs; one is a white LED, and the other one is an RGB LED.
66
-
-**ESLOV connector**: The Niclas Sense Env has an onboard ESLOV connector to extend the board communication capabilities via I<sup>2</sup>C.
67
+
-**Onboard user LEDs**: The Nicla Sense Env has two onboard user-programmable LEDs; one is a orange LED, and the other one is an RGB LED.
68
+
-**ESLOV connector**: The Nicla Sense Env has an onboard ESLOV connector to extend the board communication capabilities via I<sup>2</sup>C.
67
69
-**Surface mount**: The castellated pins of the board allow it to be positioned as a surface-mountable module.
68
70
69
71
### Board Libraries
@@ -73,7 +75,7 @@ The [`Arduino_NiclaSenseEnv` library](https://github.com/arduino-libraries/Ardui
- Onboard indoor air quality sensor control (sulfur detection, odor intensity, ethanol level, TVOC, CO<sub>2</sub>, IAQ measurements)
78
80
- Onboard outdoor air quality sensor control (NO<sub>2</sub>, O<sub>3</sub>, OAQ measurements)
79
81
- Temperature and humidity sensor control
@@ -83,7 +85,7 @@ The [`Arduino_NiclaSenseEnv` library](https://github.com/arduino-libraries/Ardui
83
85
84
86
To install the `Arduino_NiclaSenseEnv` library, navigate to `Tools > Manage libraries...` or click the **Library Manager** icon in the left tab of the Arduino IDE. In the Library Manager tab, search for `Arduino_NiclaSenseEnv` and install the latest version of the library.
85
87
86
-

88
+

87
89
88
90
### Pinout
89
91
@@ -517,6 +519,157 @@ You can download the example sketch [here](assets/nicla_sense_env_low_power_mode
517
519
518
520
## LEDs
519
521
522
+
This section of the user manual explains how to control both the onboard orange and RGB and LEDs on the Nicla Sense Env board using the `Arduino_NiclaSenseEnv` library API. The LEDs can be used to provide visual feedback for various operations, such as indicating status, warnings, or sensor errors. This section covers the basic usage of both LEDs, including turning them on, changing colors, and adjusting brightness.
523
+
524
+
### Orange LED
525
+
526
+
The onboard orange LED on the Nicla Sense Env board can be controlled using the `Arduino_NiclaSenseEnv` library. The example sketch shown below shows how to smoothly increase and decrease the brightness of the onboard orange LED. The LED pulses continuously in the `loop()` function.
Serial.println("- Failed to initialize the device. Please check the connection!");
560
+
}
561
+
}
562
+
563
+
void loop() {
564
+
// Get the orange LED object
565
+
auto orangeLED = device.orangeLED();
566
+
567
+
// Set the brightness level
568
+
orangeLED.setBrightness(brightness);
569
+
570
+
// Change the brightness for next time through the loop
571
+
brightness += fadeAmount;
572
+
573
+
// Reverse the direction of the fading at the ends of the fade (0 and 255)
574
+
if (brightness <= 0 || brightness >= 255) {
575
+
// Change the direction of the fade
576
+
fadeAmount = -fadeAmount;
577
+
}
578
+
579
+
// Wait for a short time before updating the brightness again
580
+
delay(30);
581
+
}
582
+
```
583
+
584
+
Here is a detailed breakdown of the example sketch shown before and the `Arduino_NiclaSenseEnv` library API functions used in the sketch:
585
+
586
+
-`device.begin()`: Initializes the Nicla Sense Env board, setting up communication with all onboard sensors and components, including the orange LED.
587
+
-`orangeLED.setBrightness(uint8_t brightness)`: Adjusts the brightness of the orange LED. The brightness ranges from `0` (off) to `255` (full brightness). In this sketch, the brightness gradually increases from `0` to `255` and then decreases back to 0, creating a smooth pulsing effect.
588
+
-`fadeAmount`: Controls the rate of change of brightness. When the brightness reaches either 0 or 255, the direction of change is reversed, making the LED brightness smoothly cycle up and down.
589
+
590
+
After uploading the example sketch to the Nicla Sense Env board, you should see the orange LED smoothly increase and decrease in brightness, creating a continuous pulsing effect.
591
+
592
+
You can download the example sketch [here](assets/nicla_sense_env_orange_led_control_example.zip).
593
+
594
+
### RGB LED
595
+
596
+
The onboard RGB LED on the Nicla Sense Env board can be controlled using the `Arduino_NiclaSenseEnv` library. The example sketch shown below shows how to turn on the LED with different colors and then turn it off using the `setColor()` and `setBrightness()` functions. The LED colors cycle continuously in the `loop()` function.
597
+
598
+
```arduino
599
+
/**
600
+
RGB LED Control Example for Nicla Sense Env (with brightness control)
Serial.println("- Failed to initialize the device. Please check the connection!");
624
+
}
625
+
}
626
+
627
+
void loop() {
628
+
// Get the RGB LED object
629
+
auto rgbLED = device.rgbLED();
630
+
631
+
// Turn on the LED with red color
632
+
rgbLED.setColor(255, 0, 0);
633
+
// Ensure maximum brightness, wait for one second
634
+
rgbLED.setBrightness(255);
635
+
Serial.println("- RGB LED is now red!");
636
+
delay(1000);
637
+
638
+
// Turn on the LED with green color
639
+
rgbLED.setColor(0, 255, 0);
640
+
// Ensure maximum brightness, wait for one second
641
+
rgbLED.setBrightness(255);
642
+
Serial.println("- RGB LED is now green!");
643
+
delay(1000);
644
+
645
+
// Turn on the LED with blue color
646
+
rgbLED.setColor(0, 0, 255);
647
+
// Ensure maximum brightness, wait for one second
648
+
rgbLED.setBrightness(255);
649
+
Serial.println("- RGB LED is now blue!");
650
+
delay(1000);
651
+
652
+
// Set the LED color to black and brightness to 0 to turn it off
653
+
rgbLED.setColor(0, 0, 0);
654
+
// Ensure minimum brightness, wait for one second
655
+
rgbLED.setBrightness(0);
656
+
Serial.println("- RGB LED is now off!");
657
+
delay(1000);
658
+
}
659
+
```
660
+
661
+
Here is a detailed breakdown of the example sketch shown before and the `Arduino_NiclaSenseEnv` library API functions used in the sketch:
662
+
663
+
-`device.begin()`: Initializes the Nicla Sense Env board, setting up communication with all onboard sensors and components, including the RGB LED.
664
+
-`rgbLED.setColor(uint8_t red, uint8_t green, uint8_t blue)`: This function sets the RGB LED to a specific color by specifying the intensity of the red, green, and blue components. Each value can range from `0` (off) to `255` (full brightness). In the example, the RGB LED cycles through red (255, 0, 0), green (0, 255, 0), and blue (0, 0, 255).
665
+
-`rgbLED.setBrightness(uint8_t brightness)`: Adjusts the brightness of the RGB LED. The value ranges from `0` (off) to `255` (full brightness). In the sketch, the brightness is set to 255 (maximum) when the LED is on, and to 0 (off) when the LED is turned off.
666
+
667
+
After uploading the example sketch to the Nicla Sense Env board, you should see the following output in the Arduino IDE's Serial Monitor:
668
+
669
+

670
+
671
+
You can download the example sketch [here](assets/nicla_sense_env_rgb_led_control_example_brightness.zip).
672
+
520
673
## Temperature and Humidity Sensor
521
674
522
675
The Nicla Sense Env board has an onboard temperature and humidity sensor, the HS4001 from Renesas. The HS4001 is a highly accurate, ultra-low power, fully calibrated automotive-grade relative humidity and temperature sensor. Its high accuracy, fast measurement response time, and long-term stability make the HS4001 sensor ideal for many applications ranging from portable devices to products designed for harsh environments.
0 commit comments