ESP8266 constantly crashing when data from the SCD30 sensor is being outputted

I am using the ESP8266 to read data from the grove SCD30 sensor.

When I upload the code, the sensor starts off fine, after a few returns from the sensor, the LED on the ESP stops flashing and stays lit.

The output on the serial monitor also stops outputting anything with no error.

I tried the same code on the Arduino Mega, and it works fine.

#include "SCD30.h"

#if defined(ARDUINO_ARCH_AVR)
#pragma message("Defined architecture for ARDUINO_ARCH_AVR.")
#define SERIAL Serial
#elif defined(ARDUINO_ARCH_SAM)
#pragma message("Defined architecture for ARDUINO_ARCH_SAM.")
#define SERIAL SerialUSB
#elif defined(ARDUINO_ARCH_SAMD)
#pragma message("Defined architecture for ARDUINO_ARCH_SAMD.")
#define SERIAL SerialUSB
#elif defined(ARDUINO_ARCH_STM32F4)
#pragma message("Defined architecture for ARDUINO_ARCH_STM32F4.")
#define SERIAL SerialUSB
#pragma message("Not found any architecture.")
#define SERIAL Serial

void setup() {
Wire.begin(D4, D5);
Serial.println("SCD30 Raw Data");

void loop() {
float result[3] = {0};
if (scd30.isAvailable()) {
SERIAL.print("Carbon Dioxide Concentration is: ");
SERIAL.println(" ppm");
SERIAL.println(" ");
SERIAL.print("Temperature = ");
SERIAL.println(" ℃");
SERIAL.println(" ");
SERIAL.print("Humidity = ");
SERIAL.println(" %");
SERIAL.println(" ");
SERIAL.println(" ");
SERIAL.println(" ");

The wiring is also not the problem as the sensor is being read at the start, but then crashes jazz daily internet package

The image shows that the last section of code ran, however, nothing comes after the "Humidity = 38.47 %"

This is a guess but do you still have the USB cable plugged in? My NodeMCU uses the same serial pins as the USB.

Below is one of my simple test programs. It shows switching the serial port to different pins. Not sure you ESP8266 is the same but I suspect so.

  Multiple Serial test  (NodeMCU board)
  Code to test the use of both hardware UARTs in the NodeMCU board.
  UART0 input on alternate pin
  UART1 output (note UART1 has only output, no input.  But good for monitoring)
2019-01-15 Functions correctly on our NodeMCU board. 

 Proves we can use NodeMCU hardware serial ports for Vista20P
 1) Swaps output pins for serial
     (GPIO 13 = Rx) 
     (GPIO 15 = Tx)
  2) Receives from serial, sends to the serial

void setup() {
  // initialize both serial ports:

void loop() {
  // read from port 0, send to port 1:
  if (Serial.available()) {
    int inByte =;

Posting a schematic, not a frizzy thing would help. You used two different boards, the hardware has changed. Links to the technical data on the hardware items would also help.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.