Logic level shifting with an ESP32

Post a picture.
I assume you did set the relay pins to output with pinMode.
Maybe also wise to digitalWrite a HIGH to those pins before setting the pin to output.
Post your code.
Leo..

Here is my scaled down code for debugging. The 2 “Leg 2” relays are SSRs and work fine. the other 4 go to the relay board.

#include <DallasTemperature.h>
#include <OneWire.h>

//OneWire
#define BOIL_TEMP_BUS D0
#define HLT_TEMP_BUS D1
#define MLT_TEMP_BUS D2
#define TEMP_PRECISION D3
OneWire oneWireBoil(BOIL_TEMP_BUS);
OneWire oneWireHlt(HLT_TEMP_BUS);
OneWire oneWireMlt(MLT_TEMP_BUS);
DallasTemperature boilSensor(&oneWireBoil);
DallasTemperature hltSensor(&oneWireHlt);
DallasTemperature mltSensor(&oneWireMlt);
unsigned int lastTempRequest = 0;

//RELAYS
#define HLT_RELAY_LEG2 D3
#define BOIL_RELAY_LEG2 D4
#define HLT_RELAY_LEG1 D5
#define BOIL_RELAY_LEG1 D6
#define MAIN_PUMP_RELAY D7
#define HERMS_PUMP_RELAY D8

//Ammeter
#define AMMETER_PIN A0
int mVperAmp = 40;
double acsOffset = 2.5;
int rawAmpValue = 0;
double voltage = 0;
double amps = 0;
long previousAmpSampleMillis = 0;
long interval = 1000;

void setup() {
  Serial.begin(115200);
  Serial.flush();
  pinMode(HLT_RELAY_LEG2, OUTPUT);
  pinMode(BOIL_RELAY_LEG2, OUTPUT);
  pinMode(HLT_RELAY_LEG1, OUTPUT);
  pinMode(BOIL_RELAY_LEG1, OUTPUT);
  pinMode(MAIN_PUMP_RELAY, OUTPUT);
  pinMode(HERMS_PUMP_RELAY, OUTPUT);
  digitalWrite(HLT_RELAY_LEG2, HIGH);
  digitalWrite(HLT_RELAY_LEG1, LOW);
  digitalWrite(BOIL_RELAY_LEG2, HIGH);
  digitalWrite(BOIL_RELAY_LEG1, LOW);
  digitalWrite(MAIN_PUMP_RELAY, LOW);
  digitalWrite(HERMS_PUMP_RELAY, LOW);

  //setupTempProbes();
  
}

void loop() {
  //if(Serial.available() > 0){
  //  getNextionEvent();
  //}
  //updateTemps();
  //updateAmps();

  digitalWrite(HLT_RELAY_LEG2, HIGH);
  digitalWrite(HLT_RELAY_LEG1, LOW);
  digitalWrite(BOIL_RELAY_LEG2, HIGH);
  digitalWrite(BOIL_RELAY_LEG1, LOW);
  digitalWrite(MAIN_PUMP_RELAY, LOW);
  digitalWrite(HERMS_PUMP_RELAY, LOW);
  delay(1000);

  
  digitalWrite(HLT_RELAY_LEG2, LOW);
  digitalWrite(HLT_RELAY_LEG1, HIGH);
  digitalWrite(BOIL_RELAY_LEG2, LOW);
  digitalWrite(BOIL_RELAY_LEG1, HIGH);
  digitalWrite(MAIN_PUMP_RELAY, HIGH);
  digitalWrite(HERMS_PUMP_RELAY, HIGH);
  delay(1000);
}


void setupTempProbes(){
  pinMode(BOIL_TEMP_BUS, INPUT);
  pinMode(MLT_TEMP_BUS, INPUT);
  pinMode(HLT_TEMP_BUS, INPUT);

  boilSensor.begin();
  boilSensor.setResolution(TEMP_PRECISION);
  boilSensor.setWaitForConversion(false);
  hltSensor.begin();
  hltSensor.setResolution(TEMP_PRECISION);
  hltSensor.setWaitForConversion(false);
  mltSensor.begin();
  mltSensor.setResolution(TEMP_PRECISION);
  mltSensor.setWaitForConversion(false);
}

void updateTemps(){
  char command[20];
  char buf[4];
  uint32_t now = millis();
  if (now < lastTempRequest) {
    lastTempRequest = now;
  }
  if ((now - lastTempRequest) > 1000) {
    boilSensor.requestTemperatures();
    mltSensor.requestTemperatures();
    hltSensor.requestTemperatures();
    int currentBoilTemp = round(boilSensor.getTempFByIndex(0));
    int currentHltTemp = round(hltSensor.getTempFByIndex(0));
    int currentMltTemp = round(mltSensor.getTempFByIndex(0));
  
    if(currentBoilTemp > 250){
      char boilBuf[4];
      char boilCommand[20] = "nBoil.val=";
      itoa(currentBoilTemp, boilBuf, 10);
      strcat(boilCommand, boilBuf); 
      sendNextionCommand(boilCommand);
    }
    if(currentMltTemp > 250){
      char mltBuf[4];
      char mltCommand[20] = "nMlt.val=";
      itoa(currentMltTemp, mltBuf, 10);
      strcat(mltCommand, mltBuf); 
      sendNextionCommand(mltCommand);
    }
    if(currentHltTemp > 250){
      char hltBuf[4];
      char hltCommand[20] = "nHlt.val=";
      itoa(currentHltTemp, hltBuf, 10);
      strcat(hltCommand, hltBuf); 
      sendNextionCommand(hltCommand);
    }
      lastTempRequest = now;
    }
}
void getNextionEvent() {
  char receivedCommand[8];
  for(int i=0;i<8;i++){
    receivedCommand[i] = Serial.read();
  }

  if(receivedCommand[0] == 0x65){
    //There was a touch event
    if(receivedCommand[1] == 0x00){
      //The touch event was on page 1
      switch (receivedCommand[2]){
        case 0x02:
          digitalWrite(HLT_RELAY_LEG2, !digitalRead(HLT_RELAY_LEG2));
          break;
        case 0x01:
          digitalWrite(BOIL_RELAY_LEG2, !digitalRead(BOIL_RELAY_LEG2));
          break;
        case 0x03:
          digitalWrite(MAIN_PUMP_RELAY, !digitalRead(MAIN_PUMP_RELAY));
          break;
        case 0x04:
          digitalWrite(HERMS_PUMP_RELAY, !digitalRead(HERMS_PUMP_RELAY));
          break;
       
      }
    }
  }
}

void sendNextionCommand(const char* command){
  Serial.print(command);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
  }

void updateAmps() {
  unsigned long currentMillis = millis();
  if (currentMillis - previousAmpSampleMillis >= interval)
  {
    previousAmpSampleMillis = currentMillis;
    double oldAmpValue = amps;
    rawAmpValue = analogRead(AMMETER_PIN);
    voltage = (rawAmpValue / 1023.0) * 5.00;
    amps = ((voltage - acsOffset) / mVperAmp);
    Serial.println("R V A");
    Serial.println(rawAmpValue);
    Serial.println(voltage);
    Serial.println(amps);
    if (oldAmpValue != amps){
      char buf[3];
      char command[20] = {0};
      itoa(amps, buf, 10);
      strcat(command, "nAmps.val=");
      strcat(command, buf);
      sendNextionCommand(command);
    }
  }
}

So in reading, the 3.3v regulator on the board can reliably supply 600mA to external devices. I still have my 4 onewire busses hooked to the power, so im gonna try removing those too and see if it helps. also only hooking 1 relay up.

Here is a pic, did the best i can to get the wires to where you can see them

20170527_094528[1].jpg

with some troubleshooting from my dad, we found that pin 12 was the reason that the ESP32 wouldnt boot with the LLC in place... kinda odd since: https://cdn.sparkfun.com/assets/learn_tutorials/5/0/7/esp32-thing-graphical-datasheet-v02.png shows that there is nothing special about the pin and 13 and 14 work.

If you read the Technical Manual, it tells you pin 12 changes the Core Voltage of the CPU. Imagine what happens when your CPU is trying to access a Flash EEPROM that is expecting 3.3V on its pins and the ESP32 Core is at 1.8V.

Stay off of the "special" pins. I tried to attach the Manual but the size is too big. Best look for it on the ESP32 site. I got burned using pin 12 with a pullup.

The other damning thing Spark Fun does to you is they claim the Hardware SPI CS pin is pin 2. When you actually USE that pin, it somehow trashes your ability to upload. Everyone else has VSPI CS pin as pin 5 and it works flawlessly that way.

Regards,
Bob M.