I'm trying to connect my ESP32 to this CO2 measurement device. I admit I am clueless about connecting devices with independent power sources to one another.
I connected ground to ground and CLK to PIN2. Just to be on the safe side, I put a resistor between CLK and PIN2.
I started with 4.8KOhm of resistance. ESP's ADC measured 2.1V and it seemed fine. But when I switched to 1K resistor, trying to get closer to the level of "logical 1" (the way I understand it), something unexpected happened. ADC measured 2.65V, which is still beyond 3.3V ESP should be able to handle, and the built-in LED lit up, although nothing in my sketch called for it.
Though the configuration worked stably for some minutes while I was testing it, and no smoke appeared, I am afraid the LED lighting spontaneously might be a sign of an electrical breakdown.
The both devices are sitting on the same USB hub.
Here is the sketch I am using:
#define PIN_CLOCK 2
void setup() {
pinMode(PIN_CLOCK, INPUT);
Serial.begin(4800);
}
bool last = 0;
void loop() {
int x = analogRead(PIN_CLOCK);
bool val = x > 1500;
if (last != val)
Serial.println(x*3.3/4095);
last = val;
}
Can someone explain why the LED lights up?
Can someone recommend a good article/video on basic rules about interconnecting such devices?