I'm using a WROOM 32s module. voltage is supplied cleanly at 3.3v via an ams1117 LDO.
I'm seeing only 0.8v when a GPIO pin is set to high. Which surprises me as I had expected closer to vcc (the datasheet says minimum is 0.8 * vcc). a read of the pin-state after the write says that it is still low.
the test code I'm using is very straight forward (leaving out unnecessary functions)
Code: Select all
#include <WiFi.h>
#include <ArduinoOTA.h>
const byte livePin = 4; //IO4
const byte neutralPin = 21; //IO21
void setup() {
Serial.begin(115200);
WifiStart();
digitalWrite(livePin, LOW); digitalWrite(neutralPin, LOW);
pinMode(neutralPin, OUTPUT);
pinMode(livePin, OUTPUT);
ArduinoOTA.setHostname("**");
ArduinoOTA.setPassword("**");
startOTA();
}
void loop() {
ArduinoOTA.handle();
int state = digitalRead(neutralPin);
if(state == LOW){
Serial.println("Turning pins on");
digitalWrite(neutralPin, HIGH);
digitalWrite(livePin, HIGH);
} else {
Serial.println("Turning pins off");
digitalWrite(neutralPin, LOW);
digitalWrite(livePin, LOW);
}
delay(1000);
ArduinoOTA.handle();
Serial.println("Port State:");
Serial.print("Live Pin: ");
Serial.println(digitalRead(livePin));
Serial.print("Neutral Pin: ");
Serial.println(digitalRead(neutralPin));
delay(1000);
}
this is the serial output I get
Code: Select all
Port State:
Live Pin: 0
Neutral Pin: 0
Turning pins on
Port State:
Live Pin: 0
Neutral Pin: 0
Whilst 0.8v is just enough for the transistors, I do need a way of determining port state; and forever reading low is not going to be very useful!
can anyone shed any light on this behaviour?
thanks in advance
Justin