Netduino home hardware projects downloads community

Jump to content


Photo

i2c PowerUp


  • Please log in to reply
6 replies to this topic

#1 Roy Salisbury

Roy Salisbury

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 04 June 2015 - 05:11 AM

I am trying to get some sensors working on my N3.  Here is what they are:

 

MLX90614 (IR Temperature Sensor)

HTU21DF (Humidity Sensor)

TSL2591 (Light Sensor)

 

Individually I can get each working fine.  And I can even get the MLX90614 to work with either of the other devices.  However, when I get all three on the same bus none of them work.  

 

Well that's not entirely true. They dont work if they are all connected at the same time when my app stars up.  However, if leave the SDA/SCL lines unplugged on one either the HTU or TSL sensor, and then wait until AFTER the app starts and plug them in (I had a breakpoint set at the start of the app), they work fine. Its like there is too much current pulled during the I2C initialization all at once.

 

Anyone ever see this?  Any ideas on how to get around it?  I have a few more sensors to hook up, and if two is the limit on the bus, this is going to be a very short project on the N3.

 

Roy



#2 Roy Salisbury

Roy Salisbury

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts

Posted 04 June 2015 - 06:52 AM

So, after a bit of digging...  The HTU21DF and the TSL2591 breakout boards (both Adafruit Sensors) are able to source 3.3v-5.0v.  Even though the chips themselves are 3.3v.  So, I decided to power these two sensors with the 5v pin.  That did it.  They all now initialize fine.  Though I think I am still getting over sourced on the i2c bus.  Sometimes the HTU21DF fails when reading the temperature/humidity when all 3 are working.  by itself it never misses a reading.  

 

Roy

 

EDIT: One of the reasons I like these Adafruit breakout boards is the 3.3-5v logic on them.  Interestingly enough these boards even have a 3.3v OUT pin that gives you a regulated 3.3v from 5v input.  So I can actually source the MLX90614 directly from the HTU21DF ... nice and clean.  


Edited by Roy Salisbury, 04 June 2015 - 07:20 AM.


#3 TechnoGuy

TechnoGuy

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • LocationCanada

Posted 30 June 2016 - 12:03 AM

Hi Roy,

 

I have a different but related issue.

 

I have two HTU21D sensor modules.

  • I got one (uses the HTU21D chip) from SparkFun (part #12064) about 2 1/2 years ago and.  They don't carry it anymore & have replaced it with a module which uses an Si7021 sensor instead (part #13763).
  • I got a second one (uses the HTU21D-F chip) from Adafruit (part #1899) more recently.  It's my understanding that an HTU21D-F is just an HTU21D plus a 5 cent PTFE filter.

The problem I have is that I can only get the SparkFun module to work with the Netduino; I can't get the Adafruit one to work.  It fails when I try to do a Soft Reset.

 

I have been successful in getting both modules to work with an Arduino type MCU (Teensy 3.1), using the exact same code.

 

I read your comments with interest and have tried connecting VIn on the HTU21D-F to 5V rather than to 3.3V.  It didn't make a difference for me.

 

Physically, there is a difference between the modules:

  • The SparkFun module has only 4 pins (VIn, GND, SCL, SDA)
  • The Adafruit module has 5 pins (all of the above + the 3.3V VOut)

I guess LadyAda implemented her module a little differently, to incorporate the 3.3 V voltage regulator.  Anyway, I'm at a loss to understand what's so different between the modules that one will work while the other won't.  Hoping you might have some insights on this...

 

Maybe you could post your initialization code?


- Ian

 

My Current Dev Boards:

  • 3 x Netduino Plus 2
  • 1 x Netduino 3 WiFi

#4 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1070 posts
  • LocationNorth Yorkshire, UK

Posted 30 June 2016 - 05:10 AM

Have you considered the pull-up resistors on the I2C bus?

 

There's an article on how multiple I2C devices can change the value used for the pull-up resistors here.

 

Regards,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#5 TechnoGuy

TechnoGuy

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • LocationCanada

Posted 30 June 2016 - 06:53 AM

Mark, thanks for the reference to that article.  I will have a good look at it.

 

I'm pretty certain both my HTU21D breakouts (SparkFun & Adafruit versions) have internal pull up resistors.

 

Ian


- Ian

 

My Current Dev Boards:

  • 3 x Netduino Plus 2
  • 1 x Netduino 3 WiFi

#6 TechnoGuy

TechnoGuy

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • LocationCanada

Posted 28 July 2016 - 10:34 PM

I just wanted to follow up on my June 29th query.

 

This was resolved for me by incorporating the workaround (strobe the SDA line before initializing I2C) posted by KiwiDev over on this forum thread:  i2c strange behaviour

 

In his reply, KiwiDev refers back to an August 2013 forum thread which discusses the basis for the workaround:  Netduino 2 and the Adafruit BMP085 Barometer (I2C)

 

So in short I can now get both of my HTU21D modules (SparkFun & Adafruit versions) to work with both of my Netduino boards (Netduino Plus 2 & Netduino 3 Wi-Fi).

 

As mentioned in my earlier post, there are implementation differences between the two modules.

  • The SparkFun module is the simpler of the two, incorporating two pull up resistors and a capacitor.
  • In contrast, the Adafruit module incorporates two BSS138 FETs, a MIC5225 LDO regulator, four pull up resistors & a couple of capacitors.

I guess that the relative sophistication of the Adafruit design makes it more sensitive to the starting condition of the SDA line when I2C is initialized.


- Ian

 

My Current Dev Boards:

  • 3 x Netduino Plus 2
  • 1 x Netduino 3 WiFi

#7 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1070 posts
  • LocationNorth Yorkshire, UK

Posted 29 July 2016 - 05:27 AM

The Adafruit module uses the FETs to make it 5V tolerant.  They seem to do this as standard on a few of their modules.  I have a few that incorporate a regulator in case you want to supply 5V and the FETs incase the external controller is 5V.

 

Regards,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter





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.