Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: I2C question..

  1. #1
    Senior Member
    Join Date
    Dec 2016
    Posts
    116

    I2C question..

    Does the I2C NOT work when only running on USB? (Teensy 3.2)

    Wait! I think I figured out what was going on. Other circuits were drying to draw too much power.

    A better question would be, is there any way to tell if I'm only running on USB power?

    -jim lee

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    Quote Originally Posted by jim lee View Post
    Does the I2C NOT work when only running on USB? (Teensy 3.2)

    -jim lee
    Context? Lots of i2c samples run scanner or other and print info to Serial USB.

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,069
    Note, with i2c on the Teensy, you need to have two pull-up resistors (typically 2.2K each), one resistor between SCL (19/A5) and 3.3v and the other resistor between SDA (18/A4) and 3.3v. If you have an i2c device on the bus, it may already have pull-up resistors (and if it does, you typically don't need more). If you don't have the pull-up resistors, the i2c scanner will often times hang. When I'm laying out a protoboard for the Teensy or use a breadboard that doesn't have the prop shield mounted, I almost always set up the pull-up resistors, even if I'm not immediately planning to use i2c.

    Typically with i2c, you would want to feed 3.3v to the i2c's VCC power. If you have an older i2c device that requires 5 volts, you need to use a logic level shifter to convert the SDA and SCL pins to 5v. Back when I still used a display that was 5v, I tended to use this level shifter from pololu:


    In terms of power usage, the modern Teensys (3.2, 3.5, 3.6, 4.0) tend to give you about 250 maA of 3.3v and the VIN pin has a fuse set roughly at 500 mA. I believe the LC is 120 mA for 3.3v, and 350 mA for VIN. These aren't hard/fast limits, but more the design limits to prevent overheating. The 3.3v power obviously has to include the power to run the Teensy as well as other devices.

  4. #4
    Senior Member
    Join Date
    Dec 2016
    Posts
    116
    Well I'm running this : Adafruit moisture sensor And it looks like its working fine. Well, if I fire it up with the line power 120AC->12DC->5DC->Teensy, everything seems to be happy. Sometimes, when just starting up the machine with the USB wire, it will not be able to bring the moisture sensor online. Its possible that it just isn't giving it enough time to "wake" up?

    What started me thinking along these lines, was that I was reading somewhere that the 3.3V pin uses the power from the Battery pin. This got me wondering, maybe it doesn't use the USB power pin?

    -jim lee

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    T_3.2 has onboard regulator that takes 5V (or VIN in range) an makes the 3.3V noted in post #3. The VBat pin is powered in some fashion from that on the PCB when VBat not externally powered by 3V battery.

    Starting up too fast is possible with some devices when connected to Teensy if those devices from a cold start are not online as fast as the Teensy that will be up and running into setup in 300 to 400 ms. Adding an extreme delay(4000) before starting the i2c will show that - then that can be reduced to a reasonable working value tested to work.

  6. #6
    Senior Member
    Join Date
    Dec 2016
    Posts
    116
    Maybe I should start a new thread? Its all related though..

    Same project: Moisture sensor as note above. Water pump, Motor Driver board and a Buck converter from 12V battery to 5V logic.

    Originally I designed this around a Trinket MO. Was going along great, 'till I found out that there was no EEPROM to store setup parameters in. While trying a workaround, I killed the Trinket. At the same time the one that had been running for weeks watering plants, up and died as well. Odd that..

    Whatever, spend a couple days redesign the thing to hold a Teensy3.2 wire it in and.. I got one of these systems running last night. I checked, and it was happily running this morning.

    Now, I wonder how I was able to get one running? Because, I can't get the second one to work at all.

    1) Take fresh Teensy 3.2 out of bag.. Flash any code in it that prints to the serial monitor to show that your code is alive.

    2) Test it on a USB cable.. Good.

    3) Solder the buck converter to it. But don't connect its input to anything. - The teensy won't talk to the host computer.

    4) Hook the power source to the buck converter. It shuts down your computer's USB port.

    I'm stumped. Is there a trace I should cut that I'm missing here?

    -jim lee

  7. #7
    Senior Member
    Join Date
    Dec 2016
    Posts
    116
    There IS a jumper I need to cut

    Straight from my little picture card here..
    Code:
    Cut to seperate VIN fromVUSB, if
    using a battery charger or external
    power for USB Device mode.
    I'll try that.

    -jim lee

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •