I’m currently working on an odometry system for our robot using some mice sensors. As far as i can see, connecting it with CAN would be the easiest option. I have no clue how to do this though. Is it possible to do this with an arduino? And how would I send/receive signals from this device in java?
The FRC CAN protocol spec is here: FRC CAN Device Specifications — FIRST Robotics Competition documentation
As most microcontrollers don’t have CAN built in, I suspect it would be easier to implement with I2C or SPI.
As far as mice, last time I looked they wouldn’t keep up with a typical FRC robot’s max speed. Have they improved?
I did some custom CAN work from Java on the RIO a while back. This code probably won’t compile directly with the 2022 release, but might be a viable reference to start with?
Note the CAN bus on the RIO is locked to 1000Mb/sec (250 or 500 are common in some industries, and not possible without additional hardware).
Using an external processor like an Arduino to interpret the sensor readings and forward them to the RIO is viable. Note that CAN has specific electrical requirements, so circuitry outside the processor is sometimes needed.
SPI, I2C, or Ethernet could be used to communicate many things between the two devices. If simple “single-value, one-way” transmission is needed, PWM could also be useful.
Do you have datasheets for the sensors you’re looking to incorporate? That could help inform advice on how to get it integrated into a robot (or help folks propose alternatives that are easier).
This is probably not actually the case, CAN is a bit trickier than something like I2C/SPI/UART as @Joe_Ross and @gerthworm have pointed out. I would recommend something that is not CAN.
If you really do want to go down the CAN route, here are some resources:
- Arduino Shield which uses MCP2515 for CAN
- ThadHouse’s Arduino Library for FRC CAN no idea of whether this is compatible with that shield as is, or if it needs modification. Also no idea of the state of the library. Maybe @Thad_House has an idea.
- FRC CAN Spec to make sure you don’t interfere with anything else on the bus
Another option to put sensors on the FRC CAN bus is:
Additionally, if you have a Spark MAX for which you’re not using the sensor port, you can connect there.
Try the CAN opener, I bet she’ll come running.
That’s a CAT sensor. Different interface. Runs on biofuel last I checked so you’ll have to check the rules on alternative ways to power CUSTOM CIRCUITS.
If you get it working, share the code! I would love to see it working. I was looking at putting some custom sensors on CAN
We did a custom sensor board that communicated over CAN using a Teensy in 2020, worked great once we got the FRC CAN protocol figured out.
It was a fun project that took a few weeks but it definitely opens up a whole realm of things that you can do.
Then there’s this I couldn’t find it yesterday - CTRE has it under “limit switch” on their website; go figure.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.