Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Sensors (http://www.chiefdelphi.com/forums/forumdisplay.php?f=173)
-   -   Multiple I2C sensors (http://www.chiefdelphi.com/forums/showthread.php?t=82130)

ajd 07-02-2010 19:28

Multiple I2C sensors
 
Researching the selection of additional sensors available for purchase (from various vendors), it seems that many use the I2C protocol for communication with the digital sidecar and cRIO. However, with two digital sidecars, it looks like we only get 2 I2C ports. Is it possible/recommended to use a multiplexer to attach more than two I2C sensors to the robot? Is there another way to access these sensors so we could use more than two I2C sensors?

Thanks.

Alan Anderson 07-02-2010 21:00

Re: Multiple I2C sensors
 
I2C is a bus. You can connect multiple devices to it. Each device responds to a specific address.

ajd 07-02-2010 21:59

Re: Multiple I2C sensors
 
So how do I connect multiple devices when there are only 4 pins? Can I just splice wires together and connect each pin to the corresponding pin on each sensor?

Alan Anderson 07-02-2010 22:35

Re: Multiple I2C sensors
 
All devices on the I2C bus connect to the same four wires.

ajd 07-02-2010 22:50

Re: Multiple I2C sensors
 
Excellent. Thanks for your help!

kamocat 16-02-2010 22:13

Re: Multiple I2C sensors
 
Just out of curiosity:
Does the cRIO support a multi-master bus?

David Fort 19-02-2011 22:01

Re: Multiple I2C sensors
 
I haven't tried this myself, but since the topic of multiple I2C sensors has become of interest to our team (after 2 days of extensive failures on other topics, followed by a pretty good FTC day at Erie PA), I looked in the sensor manual for the ADXL345 which can be used via I2C.

It says there is a way to change the Address on I2C by shorting 2 pads on the circuit board with a blob of solder.

The example LabView Open VI for the ADXL345 (which can be found in the sample FRC programs, on the link in the bottom right of the first screen, in the I2C bucket) has the "default" (non-solder-blobbed) ADXL345 I2C address connected to the underlying WPI I2C Open block via a "constant" wired to the pin.

Therefore, I would bet that the CRIO can support multiple I2C peripherals on the bus, and (for example) if you wanted to use 2 ADXL345's, you would add the solder blob to one of them and modify the example ADXL345 Open Vi to pass in the I2C address on one of the function block Terminals (or copy the whole thing and change the constant value in one of the copies).

I use this only as a silly example, since who in their right mind would use 2 3 axis accelerometers on one robot, but since FRC teams are known to not be in their right minds, our team tried to do just that last year, to measure the acceleration at opposite ends of the robot to see if we could figure out (and control) the center of rotation. The answer was, uh. no. (but perhaps with more patience, and filtering, and resolution we could have).

Another angle(weak pun intended) to consider is that some sensors (again, the ADXL345 for example) can be used on both I2C and SPI, so perhaps you can move one of your sensors to SPI and avoid the whole question of multidropped I2C.

Please let us know if you attempt this and whether or not you succeed!

Thanks,
David Fort
Mentor, Team 1001

kamocat 20-02-2011 00:55

Re: Multiple I2C sensors
 
If you require high sample rate, use an analog accelerometer and DMA.


All times are GMT -5. The time now is 08:08.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi