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 issue with multiple sensors

I2C multiple

Best Answer 366cobra, 28 December 2014 - 05:00 AM

just to close things off, the solution was to use the right resistor values.

 

did not know about having to use certain ohms depending on the capacitance of the bus.

When I was using one device, I had the right resistance and it worked.

using two devices, the capacitance changed, but the resistance stayed the same, which did not let the bus function properly.

the more devices you have, the less resistance you need.

 

Hope this will help someone who got stuck like i did ;)

Go to the full post


  • Please log in to reply
5 replies to this topic

#1 366cobra

366cobra

    Member

  • Members
  • PipPip
  • 16 posts

Posted 09 October 2014 - 11:23 AM

Hi,

 

If I use one device, all is good.

If I connect a second one, without even communicating with it, I cannot get any more readings.

 

My base class creates only one I2CDevice and for a read, the configuration is assigned and then the "Execute" is called inside a lock of the device.

Have found a post of someone using a similar technique: http://forums.netdui...bus/#entry41552

Only difference I have, is that I create the array inside the function and throw an exception in case of an error.

 

I have no idea where I am going wrong.

Would be great, if someone has an idea or comment.

 

Thanks

Martin

 

Netduino Plus 2, firmware 4.3.1

I2C Lux sensor

I2C PH meter

 


Can't wait for my Agent watch to arrive..........


#2 JoopC

JoopC

    Advanced Member

  • Members
  • PipPipPip
  • 148 posts

Posted 10 October 2014 - 05:34 AM

do you have the 2 devices on the same I2C address, thats the first thing you have to tackle.

#3 366cobra

366cobra

    Member

  • Members
  • PipPip
  • 16 posts

Posted 10 October 2014 - 02:15 PM

do you have the 2 devices on the same I2C address, thats the first thing you have to tackle.

Thanks for the reply.

 

the PH sensor has addr 0x4D and the Lux sensor has 0x23

the thing i do not understand is that even though the second sensor is not even initialized, the reading of the first one fails.

the app is setup to only read the Lux sensor and by just adding the second hardware to the bus, reading of the firs one fails.


Can't wait for my Agent watch to arrive..........


#4 baxter

baxter

    Advanced Member

  • Members
  • PipPipPip
  • 415 posts

Posted 11 October 2014 - 08:34 PM

Have you looked at this for multiple devices on the I2C bus?
http://forums.netdui...e-i2cbus-class/



#5 366cobra

366cobra

    Member

  • Members
  • PipPip
  • 16 posts

Posted 22 October 2014 - 12:40 PM

Have you looked at this for multiple devices on the I2C bus?
http://forums.netdui...e-i2cbus-class/

Thanks for the reply and sorry for the late response.

I am using something similar to the second post in the link.


Can't wait for my Agent watch to arrive..........


#6 366cobra

366cobra

    Member

  • Members
  • PipPip
  • 16 posts

Posted 28 December 2014 - 05:00 AM   Best Answer

just to close things off, the solution was to use the right resistor values.

 

did not know about having to use certain ohms depending on the capacitance of the bus.

When I was using one device, I had the right resistance and it worked.

using two devices, the capacitance changed, but the resistance stayed the same, which did not let the bus function properly.

the more devices you have, the less resistance you need.

 

Hope this will help someone who got stuck like i did ;)


Can't wait for my Agent watch to arrive..........





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.