Hello Everyone, we are having weird issues with our REV Color Sensor. The color sensor seems to be like “not plugged in” and cannot be detected. We tried with two REV Color Sensor V3, two Rios (one 1.0 and one 2.0), connecting the color sensor to the Rio either by using NAVX and Raspberry Pi Pico.
However, none of the methods works. We cannot detect the color sensor. (We had a variable to show the status of color sensor connection by using the “isSensor0Connected” and “isSensor1Connected” methods in picocolorsensor.java picocolorsensor/wpilib/java at main · TFM110/picocolorsensor (github.com)
We checked our code for multiple times and there aren’t bugs in it. (At the beginning the code works, but after one time we removed the color sensor, it never works again)
The white LED on the color sensor does light, and we checked that all four pins are well connected.
Does anyone has any ideas to debug or alternatives?
edit: I think the RIO I2C pinout might be part of what led to the confusion
edit2: I was a little unclear about how you mentioned it working once but then not again. You were able to see it connect/get values the first time? The light still working indicates you still have power connected, but not much more on the signal. You may want to post your code if it seems to be potentially programming related if there isn’t something wrong with the data connections.
How long are your wires? We tried using a color sensor at the end of our arm this year and just could not get it to work with the wire length needed. Can you get it working with short wires?
For reference, we just cut the regular length cables with the REV color sensor at one end to solder to the pico. And I think the pico had a longer PWM cable to connect to the MXP slot SPI pins.
At least for why the Rio isn’t running correctly, the i2c and the Rio have different pin maps with SDL and SDA swapped. This is why the light turns on but the Rio cannot detect the color sensor. Although be warned that the color sensor with the Rio is sensitive to lock-ups, so plugging into the Navx or using the Pico would be better.
For clarity, the i2c lockups on the Rio aren’t exclusive to only the REV color sensor.
I’m jumping into this thread a little late. That said, I am also learning a bit about color sensor and roboRio compatibility. Am I safe in assuming that using the NAVX or Pico in between the Rio and the color sensor is so that it addresses an issue with the compatibility between the color sensor and the Rio?
What specifically does the intermediary address?
The i2c busses on the roboRIO have some instability on them that can result in the roboRIO locking up. This can happen with any i2c device, not just the color sensor.
What the intermediary does is do the i2c communication to the color sensor on another device, and then use a more stable bus (like UART in the Pi Pico case) to get the data back to the roboRIO.
Ah, got it. The Pi Pico or NAVX is just moving the data between i2C and serial busses, somewhat like a “gateway”.
I read you have written code to do this. Does it handle more that one i2C device per pico, or is it restricted to one device per gateway?
The way the code is written it will send 2 color sensors. Since there are 2 busses on the pico, and the address of the color sensor is not changeable. But if you had devices with different addresses, you could easily have more devices.