Description:
Hello everyone,
I am facing an issue with my NodeMCU board (ESP8266 with CH340 USB-to-Serial chip). After uploading code for the AHT10 temperature and humidity sensor, the board frequently reboots or disconnects from USB. I’m hoping to get some advice on troubleshooting this problem.
Hardware Details:
- Board: NodeMCU ESP8266 (CH340)
- Sensor: AHT10 (temperature and humidity sensor)
- Connections: The board is powered via USB, and only the AHT10 sensor is connected. SDA is on D2, SCL is on D1.
Problem Description:
- After flashing the firmware (using
esptool.py
) and uploading the AHT10 sensor test code, the board starts to behave inconsistently:
- It often reboots or disconnects from USB.
- Sometimes I have to press the Reset or Flash button multiple times or unplug/replug the USB cable to make it work temporarily.
- When the board does work for a short while, it prints correct temperature and humidity data to the Serial Monitor.
Here’s an example of the Serial Monitor output when it starts to fail:
lua
CopyEdit
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Soft WDT reset
Exception (4):
epc1=0x40201068 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffffe50 end: 3fffffd0 offset: 0160
3fffffb0: feefeffe feefeffe 3ffee714 402022bc
3fffffc0: feefeffe feefeffe 3fffdab0 40100f91
<<<stack<<<
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v000436c0
~ld
Occasionally, after several reset attempts, I see correct sensor readings like this:
makefile
CopyEdit
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v000436c0
~ld
Temperature: 28.61 °C
Humidity: 69.79 %
Temperature: 28.68 °C
Humidity: 75.04 %
Temperature: 28.77 °C
Humidity: 74.64 %
Temperature: 28.80 °C
Humidity: 71.56 %
Temperature: 28.76 °C
Humidity: 68.53 %
Temperature: 28.71 °C
Humidity: 66.23 %
Temperature: 28.65 °C
Humidity: 64.54 %
Temperature: 28.60 °C
Humidity: 63.48 %
Temperature: 28.56 °C
Humidity: 62.78 %
...
What I’ve Tried:
- Checked connections: All sensor wires are securely connected.
- Flashed firmware: Used
esptool.py
to reflash the firmware. Flashing completes successfully. - Tried different USB cables: Tested with high-quality cables to ensure stable power and data.
- Modified code: Added
delay(1000)
at the beginning ofsetup()
andyield()
in loops, but the issue persists.
Additional Notes:
- Power Supply: The board is powered via USB. I’ve tested it with different USB ports and external power supplies (5V, 1A).
- Arduino IDE Settings:
- Flash Size:
4M (FS:2MB OTA:~1MB)
- CPU Frequency:
80 MHz
- Upload Speed:
115200
- Flash Size:
- Exception Decoder: I’m not familiar with how to interpret the exception logs. Any help with decoding this would be appreciated.
Questions:
- Could this be a hardware issue (e.g., a faulty NodeMCU board or sensor)?
- Is there a way to fix the rebooting and USB disconnection problem?
- What other troubleshooting steps should I try?
Any guidance or suggestions would be greatly appreciated!
Thank you in advance.
Feel free to copy, paste, and adjust this post as needed for the forum!