#### zazas321

Joined Nov 29, 2015
784

This is the schematic I have drawn. and the code :
Code:
#include <NeoPixelBus.h>
uint64_t chipid;
const uint16_t PixelCount = 6; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t PixelPin = 2;  // make sure to set this to the correct pin, ignored for Esp8266
#define colorSaturation 20
NeoPixelBus<NeoGrbFeature, NeoEsp32Rmt0800KbpsMethod> strip(PixelCount, PixelPin);
RgbColor red(colorSaturation, 0, 0);
RgbColor green(0, colorSaturation, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);
RgbColor purple(colorSaturation, 0, colorSaturation);
HslColor hslRed(red);
HslColor hslGreen(green);
HslColor hslBlue(blue);
HslColor hslWhite(white);
HslColor hslBlack(black);
void setup() {
Serial.begin(115200);
strip.Begin();
}

void loop() {
chipid=ESP.getEfuseMac();//The chip ID is essentially its MAC address(length: 6 bytes).
Serial.printf("ESP32 Chip ID = %04X",(uint16_t)(chipid>>32));//print High 2 bytes
Serial.printf("%08X\n",(uint32_t)chipid);//print Low 4bytes.
LED_strip_ON(green,6);
delay(1000);
LED_strip_ON(black,6);
delay(3000);

}
void LED_strip_ON(RgbColor colour,int number){
for (int i=0;i<number;i++)
strip.SetPixelColor(i, colour);
strip.Show();
}
The program is very simple, just blink and LED strip and read device ID.

I have also implemented a sensor but not currently using it. It is 12V proximity sensor using open collector transistor. I just use a voltage divider circuit to step the voltage down to 3.3V logic level and connect it to GPIO pin of my ESP32 device. I have tested and the sensor works, it outputs me 3.3V when there is no obstacle in front of it and 0V when I put my hand in front of it.

I have 2 seperate power supplies. 5V and 12V. The very weird problem I have , when i switch 12V supply ON to power the sensor (also sends HIGH signal to one of the GPIO), after switching on 5V, the onboard LED on my esp32 turns ON, but the board does not execute code!. When I do it the other way arround, first powering the board (5V) board immidiately starts executing code, I can see LEDS blinking then I can power up my sensor by enabling 12V.

basically:
1. turn ON 12V
2. turn ON 5V
3. Board turned ON but not executing code

1. turn ON 5V
2. Board immidiately starts working(executing code)
3. turn ON 12V.

When I disconnect the GPIO sensor pin from the board, the board works fine when enabling 12V first. Can someone explain me how does sending HIGH signal to one of the GPIOs before powering board not allowing it to execute code????

#### BobTPH

Joined Jun 5, 2013
2,881
How do you know it is not executing code? Perhaps having that pin high changes the path in the code.

Bob

#### zazas321

Joined Nov 29, 2015
784
How do you know it is not executing code? Perhaps having that pin high changes the path in the code.

Bob
I know its not executing cause cause leds are not blinking.

#### GetDeviceInfo

Joined Jun 7, 2009
1,754
Some of the GPIO pins are bootstrap. Care to tell us which ones you are using.

#### zazas321

Joined Nov 29, 2015
784
Some of the GPIO pins are bootstrap. Care to tell us which ones you are using.
You are right. I was using GPIO18, I switched to GPIO2 and problem solved. How do I know which pins I cannot use since the pinout does not really point it out?

#### Analog Ground

Joined Apr 24, 2019
447
You don't say what the power/GPIO sequences are which cause the problem but you could have what is called a "false power down". Moving the input to a different GPIO pin may have fixed the problem for now but without knowing the cause of the problem, it could come back at any time. Is the brown out reset circuit in the microcontroller enabled? If not, try going back to the original pin and enable the BOR circuit. If the problem goes away, there is your problem. Here is an article on the subject.

#### zazas321

Joined Nov 29, 2015
784
You don't say what the power/GPIO sequences are which cause the problem but you could have what is called a "false power down". Moving the input to a different GPIO pin may have fixed the problem for now but without knowing the cause of the problem, it could come back at any time. Is the brown out reset circuit in the microcontroller enabled? If not, try going back to the original pin and enable the BOR circuit. If the problem goes away, there is your problem. Here is an article on the subject.
What exactly do you mean by power/gpio sequence? I have shown a code and schematic and I described the sequence of actions I do to get the problem. Thanks I will check the article

#### Analog Ground

Joined Apr 24, 2019
447
What exactly do you mean by power/gpio sequence? I have shown a code and schematic and I described the sequence of actions I do to get the problem. Thanks I will check the article
Your right, you did describe the 12V coming on first. Your problem is the 12V through the 12K resistor is injecting current (~1 mA) into your microcontroller and causing mischief. If you have both the micro power and the 12 V on and them turn off the micro power and turn it back on, that would be a false power down problem which might be able to fix with the BOR. In any case, your problem is the current from the 12V supply.

#### zazas321

Joined Nov 29, 2015
784
Your right, you did describe the 12V coming on first. Your problem is the 12V through the 12K resistor is injecting current (~1 mA) into your microcontroller and causing mischief. If you have both the micro power and the 12 V on and them turn off the micro power and turn it back on, that would be a false power down problem which might be able to fix with the BOR. In any case, your problem is the current from the 12V supply.
Ah I asusmed that could cause a problem but was not too sure.. The problem remains even when i use DC/DC buck/boost converter module to power the sensor/microcontroller so I do not need to use 2 seperate DC power supplies. I just supply 12V to DC/DC converter and output 5V to my microcontroller. ( That was also avoided by swapping GPIO18 to GPIO2)

#### BobTPH

Joined Jun 5, 2013
2,881
I know its not executing cause cause leds are not blinking.
So you have never experienced code that is executing but not doing what you expect it to?

Bob

#### zazas321

Joined Nov 29, 2015
784
So you have never experienced code that is executing but not doing what you expect it to?

Bob
The board does not output anything even in the serial monitor. Why would it execute code and not do what I expect ( What I programmed it to do)?

#### zazas321

Joined Nov 29, 2015
784
Another quite strange thing I am noticing with power:

I have 6 seperate ESP32 devices that all connect to the WIFI. All of them use DC/DC boost/buck converter module and everything is fine. I only had 5 DC/DC buck/boost modules at a time so I swapped one with this little guy AMS1117-5

When I power this device on its own(applying 12V to this DC converter and outpitng 5V) it is able to power ON sucessfully ( starts executing code). However, when I connect this ESP32 with 5 others (the only common connection is 12V and GND), this board is no longer able to power ON properly, I have measured the Vin of the board:
After enabling 12v, it takes 27ms to reach 5V, could that be the black out problem you were mentioning? Also, when I manually press reset button on the board, it does start!