TeensyLC I2C pull-up resistance and GPIO opendrain button presser

jdogg

New member
Hi,

I have three primary objectives for my project:
  1. Use a GPIO pin to simulate a button press on an external circuit.
  2. Interact cleanly as a secondary master on an existing I2C bus.
  3. Prevent my Teensy from pulling current from the external circuitry via any of the connected pins, including ground, while not connected to a power supply (USB or Vcc).

For Objective 1:
In the attached schematic, the existing circuit is in BLACK and my circuit is in RED. Vcc is 3.3v and SW1 is normally open. I can't be absolutely sure of the pullup resistor value but a probe reading gave me 20K from the IN1 pin and IN2 (IN2 is not shown).

button_presser.png

Here is some code:

Code:
void setup()
{
   pinMode(button, OUTPUT_OPENDRAIN);
}
void loop()
{
   //short button press and hold for 1/2 second.
   digitalWrite(button, LOW);
   delay(500);
   digitalWrite(button, HIGH);
   //wait ten seconds
   delay(10000);
}

  • What are the implications of opendrain in this circuit?
  • Could the Teensy become damaged from asserting OUT1 low for too long?
  • Would a transistor be a good idea to gate IN1 to GND from OUT1? Drawing? :)

For Objective 2:
According to the Teensy website, it is required to add pullup resistors to SDA and SCL.

  • What is an appropriate resistance value?
  • What could happen if R > 20K
  • Under what circumstances would the value of R cause current drain from the bus? (e.g. Teensy pulls current when SDA/SCL go low from another device.)
  • What if Teensy remains connected to an active bus without a power source (USB or VCC)?
  • What conditions should be avoided within the code that might cause I2C registers to be unsafe? (e.g. Objective 1)

For Objective 3:
Ideally, the Teensy could be left attached to the external circuit via SDA0, SCL0, OUT1, and GND without being powered via USB or Vcc (3.3 or 5) without drawing current from the external circuit. What should I be aware of here?
 
Back
Top