Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

I2C buss works on Arduino, not on Netduino


  • Please log in to reply
22 replies to this topic

#21 anthrolume

anthrolume

    Member

  • Members
  • PipPip
  • 15 posts

Posted 16 May 2011 - 05:16 AM

I got a couple ULN2004As and I'm trying to put together an I2C bus driver using that part. I only have the vaguest idea what I'm doing.

Here's my current schematic:

Posted Image

This is just the schematic for SCL - I'm doing the same thing to the data line too.

Since the ULN2004A elemnts are inverters, I've put two in serial to get the same signal out as I put in.

Pin 8 is grounded. Pin 9 is tied to +5V.

My questions:
1) Am I powering this chip correctly?
2) I think I still need to pull up the I2C bus. But where? At point A on the schematic? Or at point B?
3) Pulling up at point B, I seem to get a reasonable signal at the other side of the first inverter, but not after the second. Why is that?

Thanks in advance for any advice.

-Bryan

#22 mikepo

mikepo

    Member

  • Members
  • PipPip
  • 29 posts

Posted 17 May 2011 - 01:38 AM

Hi anthrolume,

if you look at the datasheet for the ULN2004 (http://www.datasheet...ts/uln2004a.pdf) (Page 3) you'll see that they are "just" glorified darlington transistors with some protection logic.
As such, you'd need a pull-up resistor on Points A AND B in your schematic - and also between the two ULN2004 inverters
- Point B to pull up the base of the ULN2004 transistor (can probably be about 2.2KOhm)
- Point A - the regular pull-up for the I2C bus since the ULN2004 is not a push-pull output (approx 2.2k or less)
- BETWEEN then 2 inverters of the ULN2004, to pull up the base of the second inverter (I would try a 2.2KOhm resistor here)

Since the ULN2004 has a 10k internal resistor in the line to the base and you need to get the base above 1.4V (2 x 0.7V for the base-emitter voltage), and based on the statement in the datasheet "The ULN2004A and ULQ2004A have a 10.5-kΩ series base resistor to allow operation directly from CMOS devices that use supply voltages of 6 V to 15 V." it might be a bit close to get sufficient voltage to the base of the ULN2004 inverters from a 3.3V output, it might not be enough to get the transistors saturated. On page 5 of the datasheet it says that the VI(on) voltage for the ULN2004 is between 5V and 8V in the worst case. It could be lower, but it's not guaranteed. Also this datasheet is for the Texas Instruments version of the ULN2004, depending on the manufacturer of your parts, it might be slightly different, but usually they're pretty much the same for the same part number.

You can try to use lower resistors, but keep in mind the max output current that a Netduino pin can drive, I think Chris mentioned 8 mA further up in this thread.

Regards,
Mike

#23 anthrolume

anthrolume

    Member

  • Members
  • PipPip
  • 15 posts

Posted 21 May 2011 - 02:10 AM

As such, you'd need a pull-up resistor on Points A AND B in your schematic - and also between the two ULN2004 inverters
- Point B to pull up the base of the ULN2004 transistor (can probably be about 2.2KOhm)
- Point A - the regular pull-up for the I2C bus since the ULN2004 is not a push-pull output (approx 2.2k or less)
- BETWEEN then 2 inverters of the ULN2004, to pull up the base of the second inverter (I would try a 2.2KOhm resistor here)


Awesome! Thanks a ton Mike. I'll try that this weekend.

-Bryan




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.