====== I2C Sensors for 2019 Deep Space Robot ====== The team picked out several sensors to enable robot code to respond to the environment. All turned out to have an I2C interface. Fortunately, the RoboRIO has two I2C controllers: one on the base unit {{ :roborio-i2c.png |}} and one on the MXP expansion connector and broken out by the NavX board. {{ :navx-i2c.png |}} ===== Eastbots Standard 4-pin I2C: same as RoboRIO ===== Since the two rio native i2c connectors have the same pin order, we standardize on that, and adapt all sensors to that pinout. These connectors have 4 pins, in this order, on a 0.1" header: * Ground * +3.3v Power * SCL * SDA 0.1" COTS cables like this are helpful for wiring: https://www.sparkfun.com/products/10369 ===== Rev Color Sensor ===== http://www.revrobotics.com/rev-31-1537/ We're using two of these. Since they all have the Same I2C address, we can't connect both of them to the i2c host controller without special care. Fortunately, The RoboRIO has two controllers, so we connect one to each. A short 4-wire cable is built to adapt from the JST connector on the Rev sensor to an 0.1" female connector. This adaptor cable can plug directly into the RoboRIO for software development. It adapts the pinout to our (Rio) standard, which requires flipping SDA and SCL. ===== Adafruit VCNL4010 Proximity Sensor ===== https://www.adafruit.com/product/466 {{ :adafruit-vcnl4010.jpg?200|}} This sensor is useful for sensing distances to a target of about 10-150mm. It has 6 pins, which isn't a connector housing size that we normally stock. Besides, we want to adapt to somthing close to the standard pinout. But this sensor recommends using +5v power supply for best output power from its LED light source. So, we chose this modified pinout using a 5-pin connector, to reduce the chances that 5v and 3.3v sensors can be mixed up accidently: * +5v * GND * no connection on pin 3 * SCL * SDA Note that the last 4 pins match up exactly with the standard 4 pin connector above, but there's the extra 5v power pin to the outside of the ground pin. {{ :vcnl4010-cable.jpg?600 |}} TODO redraw this more clearly. ===== Adafruit VL53L0X Distance Sensor ===== https://learn.adafruit.com/adafruit-vl53l0x-micro-lidar-distance-sensor-breakout {{ :adafruit-vl53l0x.jpg?200|}} This sensor is useful for distances from about 50mm to 1200mm. We're planning to use it to detect distance from the robot to the cargo hatch placement sites on the field. It runs directly on 3.3v power, so no need for funny business there. We just need to adapt it to the standard i2c pinout by ignoring the pins we don't need, and putting the rest in the right order. {{ :vl53l0x-hookup.jpg?600 |}} ===== I2C multi-sensor breakout panel ===== To connect three sensors, one of which requires oddball power, to one I2C port, we built a little breakout adaptor. It has 5 connectors: * one 4-pin header that is cabled to the RoboRIO * Two more 4-pin headers for Rev Color and VL53L0X sensors adapted to our standard pinout * one 5-pin header providing +5v power for a VCNL4010 * one 3-pin DIO-pinout header that needs to be connected to +5v power from a DIO port {{ :i2cboard-top.jpg?600 |}} Ground, SCL, and SDA are simply wired together on all four headers. +3.3v power connects between the three 4-pin headers. The 5th pin on the 5-pin header goes to the center pin of the 3-pin power header. {{ :i2cboard-bottom.jpg?600 |}} TODO draw a proper schematic of this board. In addition, there's a yellow LED that indicates presence of 3.3v power - proper connection to the 4-pin rio connector. ==== hookup ==== NOTE: the black text annotations on this picture are WRONG. but the cables in the picture are correct. we'll replace this photo shortly. {{ :i2cboard-hookup-annotated.jpg?400 |}}