I'm trying to switch a ATX PSU on and off by serial command. My code is as follows:
#include <Arduino.h>
#define PIN_LOW_FOR_POWER PIN_F0
void setup() {
Serial.begin(115200);
}
void loop() {
String sCode = Serial.readStringUntil('\n');
if (sCode == "M80"){
digitalWrite(PIN_LOW_FOR_POWER, LOW);
}
else if (sCode == "M81"){
digitalWrite(PIN_LOW_FOR_POWER, HIGH);
}
else{
Serial.println("Unknown command");
return;
}
Serial.println("OK");
}
I'm getting "OK" back, and the power switches. After sending M81 I read 5V across the pin and ground, but after sending M80 for some reason I read 2.37V and not 0V. If I switch to "F1" (keep the wire connected to F0) I do read 0V.
The ATX PSU needs F0 to be pulled down in order to turn on. I soldered the ground of the ATX PSU to the Teensy ground, and the wire to be pulled down (green) to F0. I supply the 5V to the Teensy through USB, so the VCC pin is left unconnected.
The PSU does turn on if I manually create a short between F0 and ground.
Why doesn't the Teensy pull F0 down, and how do I resolve this? (All I could come up with is something of internal resistance within the Teensy being too high, which seems unlikely to me. (If the resistance within the PSU and wires between "green" and ground is equal to the resistance within the Teensy this would happen, right?))
PS: It turns out I bought a fake Teensy from China, if it's related. Ordered a new one for a different project, but still had this one laying around.