Issue - Not getting expected voltage from pin set to Digital Out OD Pullup

I purchased an imp in Dec '12 and using an April board and a simple transistor - relay circuit, created a garage door opener that I control by sending HTTP from an IOS app. The circuit worked fine for a few months, and then failed. I didn’t pay a lot of attention to it until recently when I decided to pick the project up and troubleshoot it.

I am using a single pin as a digital pull up to power the transistor and switch the relay. If there is no load on the pin, and I switch it, my meter reads 3.24v, which is correct. As soon as I add any load to the circuit, the voltage never goes that high. For example, connected to my relay circuit, I read .67 volts when the pin is set high, and when connected to a simple resistor-led circuit, I read 1.76 volts.

The first April board that I used was from Sparkfun, and I ordered one from Adafruit as well, after thinking that I may have damaged the board, but the new board does the same thing.

Any ideas? Is my imp itself damaged? Why would the pin not go to 3.3v under load?

This is the code that runs on the imp. The IOS app simply sends an HTTP GET with ?value=2

// Garage Door Opener for HTTP control

// input class for Switch control channel
class input extends InputPort
name = "Switch control"
type = “number”

function set(value)
// Momentary On/Off for Garage Door App
if(value == 2)

      //Switch pin to HIGH
      server.log("Setting PIN 9 == HIGH.");
      // Wait one second
      //Switch pin to LOW    
      server.log("Setting PIN 9 == LOW");


// Configure pin 9 as an open drain output with internal pull up
//Set pin 9 to LOW initially

// Register with the server
imp.configure(“Garage Door”, [input()], []);

// End of code.

If you’re driving a transistor, you should be using DIGITAL_OUT. This will drive hard high and low.

DIGITAL_OUT_OD_PULLUP is an open drain output. It will pull hard low, but the pull-up is weak (could be 50-200k).

There seem to be a lot of people using DIGITAL_OUT_OD_PULLUP… can anyone tell me why they prefer this to DIGITAL_OUT? Bit of a mystery to me! Open drain has its uses, but driving transistors and LEDs aren’t amongst them.

Truthfully, I am using it because it was used in the Blink tutorial, and I don’t fully understand the hardware settings. Thanks for clarifying, I’ll make the changes ASAP. The odd thing is that it did work fine for several months.

Works like a charm now. Thanks for clarifying, Hugo!

@jwehr A-ha! Hoist by our own petard, so to speak. I’ve adjusted the example to use a push-pull GPIO - even though open-drain works fine there, push-pull works just as well and is more applicable to more suitations :slight_smile:

Oh and you know, a while ago there used to be a bug whereby even if you asked for DIGITAL_OUT_OD_PULLUP you in fact got a DIGITAL_OUT. This might count as a small lapse of our backwards-compatibility goals :frowning: but it’s not clear what else we could have done – DIGITAL_OUT_OD_PULLUP_LIKE_SRSLY?


And I just adjusted the other three places in that example where it mentioned open-drain :wink: :wink: