Custom sensor communicating with CAN

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?

1 Like

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 my mouse sensor, but it doesn't have a CAN interface that I'm aware of.

3 Likes

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:

3 Likes

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.

7 Likes

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.

1 Like

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

1 Like

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.

1 Like

Then there’s this :blush: 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.