|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||||
|
|||||
|
Re: Multiple I2C sensors
I2C is a bus. You can connect multiple devices to it. Each device responds to a specific address.
|
|
#3
|
|||
|
|||
|
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?
|
|
#4
|
|||||
|
|||||
|
Re: Multiple I2C sensors
All devices on the I2C bus connect to the same four wires.
|
|
#5
|
|||
|
|||
|
Re: Multiple I2C sensors
Excellent. Thanks for your help!
|
|
#6
|
||||
|
||||
|
Re: Multiple I2C sensors
Just out of curiosity:
Does the cRIO support a multi-master bus? |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
||||
|
||||
|
Re: Multiple I2C sensors
If you require high sample rate, use an analog accelerometer and DMA.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I2C for NXT sensors | kamocat | Programming | 11 | 25-02-2010 23:02 |
| [FTC]: Multiple Programs or One Program with Multiple Auto Modes | kevin51292 | FIRST Tech Challenge | 4 | 02-01-2009 20:37 |
| Hosting multiple sites in multiple VMs | EHaskins | Website Design/Showcase | 6 | 22-12-2007 01:09 |
| I2C tutorials | John Gutmann | Electrical | 3 | 30-07-2005 10:44 |
| I2C? | John Gutmann | Electrical | 3 | 19-07-2005 22:52 |