Hi Everybody.
I bought two nanoESP32-C6N16 modules in order to learn using ESP32.
In order to start taking confidence, in my PC running Win10 I installed the Arduino IDE, I correctly connected the module, got a sketch on the internet that manage the builtin RGB LED (WS2812b) using the following code:
void setup() {
// No need to initialize the RGB LED
pinMode(11, OUTPUT); // Just to understand if running
}
void loop() {
#ifdef RGB_BUILTIN
digitalWrite(11, HIGH); // Running?
digitalWrite(RGB_BUILTIN, HIGH); // Turn the RGB LED white
delay(1000);
digitalWrite(RGB_BUILTIN, LOW); // Turn the RGB LED off
delay(1000);
neopixelWrite(RGB_BUILTIN,RGB_BRIGHTNESS,0,0); // Red
delay(1000);
neopixelWrite(RGB_BUILTIN,0,RGB_BRIGHTNESS,0); // Green
digitalWrite(11, LOW); // Running?
delay(1000);
neopixelWrite(RGB_BUILTIN,0,0,RGB_BRIGHTNESS); // Blue
delay(1000);
neopixelWrite(RGB_BUILTIN,0,0,0); // Off / black
delay(1000);
#endif
That code compiles and uploads corretly in the module but the builtin LED doesn't light at all.
None of the two modules I bought can light the LED.
I am not new to these technologies but it's the first time I approach ESP32.
Could please somebody drive me in the right direction in order to have the LED working?
Thank you very much indeed.
nanoESP32-C6N16 - Builtin RGB not working
-
- Posts: 386
- Joined: Mon Jan 04, 2021 2:06 pm
Re: nanoESP32-C6N16 - Builtin RGB not working
Hi,
If you need to test your board using the Arduino IDE, you can try this code (no extra library required).
Change the GPIO that you have the RGB LED connected and the number of LEDs:
The code from RTMWrite_RGB_LED.ino:
If you need to test your board using the Arduino IDE, you can try this code (no extra library required).
Change the GPIO that you have the RGB LED connected and the number of LEDs:
Code: Select all
#define BUILTIN_RGBLED_PIN 8 // ESP32 has no builtin RGB LED (PIN_LED_RGB)
Code: Select all
// Copyright 2024 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @brief This example demonstrates usage of RGB LED driven by RMT
*
* The output is a visual WS2812 RGB LED color moving in a 8 x 4 LED matrix
* Parameters can be changed by the user. In a single LED circuit, it will just blink.
*/
// The effect seen in (Espressif devkits) ESP32C6, ESP32H2, ESP32C3, ESP32S2 and ESP32S3 is like a Blink of RGB LED
#ifdef PIN_LED_RGB
#define BUILTIN_RGBLED_PIN PIN_LED_RGB
#else
#define BUILTIN_RGBLED_PIN 8 // ESP32 has no builtin RGB LED (PIN_LED_RGB)
#endif
#define NR_OF_LEDS 8 * 4
#define NR_OF_ALL_BITS 24 * NR_OF_LEDS
//
// Note: This example uses a board with 32 WS2812b LEDs chained one
// after another, each RGB LED has its 24 bit value
// for color configuration (8b for each color)
//
// Bits encoded as pulses as follows:
//
// "0":
// +-------+ +--
// | | |
// | | |
// | | |
// ---| |--------------|
// + + +
// | 0.4us | 0.85 0us |
//
// "1":
// +-------------+ +--
// | | |
// | | |
// | | |
// | | |
// ---+ +-------+
// | 0.8us | 0.4us |
rmt_data_t led_data[NR_OF_ALL_BITS];
void setup() {
Serial.begin(115200);
if (!rmtInit(BUILTIN_RGBLED_PIN, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 10000000)) {
Serial.println("init sender failed\n");
}
Serial.println("real tick set to: 100ns");
}
int color[] = {0x55, 0x11, 0x77}; // Green Red Blue values
int led_index = 0;
void loop() {
// Init data with only one led ON
int led, col, bit;
int i = 0;
for (led = 0; led < NR_OF_LEDS; led++) {
for (col = 0; col < 3; col++) {
for (bit = 0; bit < 8; bit++) {
if ((color[col] & (1 << (7 - bit))) && (led == led_index)) {
led_data[i].level0 = 1;
led_data[i].duration0 = 8;
led_data[i].level1 = 0;
led_data[i].duration1 = 4;
} else {
led_data[i].level0 = 1;
led_data[i].duration0 = 4;
led_data[i].level1 = 0;
led_data[i].duration1 = 8;
}
i++;
}
}
}
// make the led travel in the panel
if ((++led_index) >= NR_OF_LEDS) {
led_index = 0;
}
// Send the data and wait until it is done
rmtWrite(BUILTIN_RGBLED_PIN, led_data, NR_OF_ALL_BITS, RMT_WAIT_FOR_EVER);
delay(100);
}
-
- Posts: 3
- Joined: Wed Jan 22, 2025 2:57 pm
Re: nanoESP32-C6N16 - Builtin RGB not working
Hi ESP-Minatel,
Thank you for your answer and your time.
Took the code posted by you an modified just the line
#define NR_OF_LEDS 1
as GPIO 8 (RGB LED pin) is already declared correctly.
Compiled correctly with Arduino IDE having "ESP32C6 Dev Module" checked and uploaded without errors into the module.
The RGB LED Still not working.
As far as I have understood (I write from Italy) the modules in my hands are manufactured by Muse-Lab which link to the product seems to be: https://github.com/wuxx/nanoESP32-C6?tab=readme-ov-file.
I tried another example program found on the internet named "GPIOViewer", a web server for GPIO values visualization based on WiFi and it works great.
I can configure and use other digital GPIOs of the module driving normal LED.
Really, I cannot understand what is wrong with the builtin RGB LED driving. It should be a very basic entry-level example, something like "Hello world".
I'm still browsing the internet to find other ideas about the problem.
If the solution comes out I will post it here.
Thank you again for the help.
Thank you for your answer and your time.
Took the code posted by you an modified just the line
#define NR_OF_LEDS 1
as GPIO 8 (RGB LED pin) is already declared correctly.
Compiled correctly with Arduino IDE having "ESP32C6 Dev Module" checked and uploaded without errors into the module.
The RGB LED Still not working.
As far as I have understood (I write from Italy) the modules in my hands are manufactured by Muse-Lab which link to the product seems to be: https://github.com/wuxx/nanoESP32-C6?tab=readme-ov-file.
I tried another example program found on the internet named "GPIOViewer", a web server for GPIO values visualization based on WiFi and it works great.
I can configure and use other digital GPIOs of the module driving normal LED.
Really, I cannot understand what is wrong with the builtin RGB LED driving. It should be a very basic entry-level example, something like "Hello world".
I'm still browsing the internet to find other ideas about the problem.
If the solution comes out I will post it here.
Thank you again for the help.
-
- Posts: 386
- Joined: Mon Jan 04, 2021 2:06 pm
Re: nanoESP32-C6N16 - Builtin RGB not working
Can you measure the signal on the GPIO8 using a logic analyzer or oscilloscope? Also, measure the power on the LED pin.
-
- Posts: 3
- Joined: Wed Jan 22, 2025 2:57 pm
Re: nanoESP32-C6N16 - Builtin RGB not working
Hi ESP_Minatel.
I made the measurements suggested.
I attached a scope to GPIO8 and the signal there is as follows.
I notice that the signal as per the uploaded program is present but its the voltage doesn't start from zero but from approx 2 V.
I expected it starting from zero but as I don't know the architecture of ESP32 output stage I can't figure out how it behaves connected to the R2 attached to the 3.3V (see under schematic of the RGBLED of my module).
In order to understand I wrote a simple program that makes blinking LEDs on GPIO8 and GPIO11 and uploaded it.
The LED connected ti GPIO11 blinks correctly but the one connected to GPIO8 stays always ON. Maybe the reason is the same.
I notice that the schematich of RGB LED of my module is different from the one of the official C6-DevKitC-1 (see in the following)
According to your knownledge, is there a strong reason for that? I suppose that the LED is the same type...
The LED seems corretly powered even the pinout in the ws2812b datasheet seems different from both LED schematics here attached.
I am surprised about a product that seems vastly used in the world for its power and easy use.
I will make other tests and post useful results if any.
TRhank you again for your support.
I made the measurements suggested.
I attached a scope to GPIO8 and the signal there is as follows.
I notice that the signal as per the uploaded program is present but its the voltage doesn't start from zero but from approx 2 V.
I expected it starting from zero but as I don't know the architecture of ESP32 output stage I can't figure out how it behaves connected to the R2 attached to the 3.3V (see under schematic of the RGBLED of my module).
In order to understand I wrote a simple program that makes blinking LEDs on GPIO8 and GPIO11 and uploaded it.
The LED connected ti GPIO11 blinks correctly but the one connected to GPIO8 stays always ON. Maybe the reason is the same.
I notice that the schematich of RGB LED of my module is different from the one of the official C6-DevKitC-1 (see in the following)
According to your knownledge, is there a strong reason for that? I suppose that the LED is the same type...
The LED seems corretly powered even the pinout in the ws2812b datasheet seems different from both LED schematics here attached.
I am surprised about a product that seems vastly used in the world for its power and easy use.
I will make other tests and post useful results if any.
TRhank you again for your support.
Who is online
Users browsing this forum: No registered users and 52 guests