FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read data from a sensor with USB or Serial interface?

We are planning to use some extra sensors with USB  or Serial (RS232) interface, and need some suggestions on how to connect them to cRIO-FRC and how to program the code to read from those sensors.

1) How do we connect a sensor with USB interface? The cRIO modules (Analog, digital and solenoid interface) coming with competition kit will not work. Am I right? So we need to purchase other module which handles usb interface. Any particular module you could kindly suggest?

2) Same question with RS232 interface - we need to purchase a module with RS232 interface to connect sersors with serial port? Any particular module you could kindly suggest?

3) Or can we just get a module which handles RS232 interface and use a usb-serial cable to connect it to a usb sensor?

4) In WPI liberary, there are some VIs for serial communication - those VIs are written for RS232 interface, am I correct? Any particular cRIO Modules which works with these VIs? Any examples?

Thank you for your kind help!

Qing

0 Kudos
Message 1 of 6
(5,882 Views)

The only option you have for any of the things you talked about is to use the RS-232 port that is already on the cRIO.  That is what WPILib supports.  You cannot use any other modules in the cRIO for FRC.  There is no way to connect a USB sensor directly to the cRIO or any module.

Perhaps if you indicate what problem you are trying to solve by adding "some extra sensors" or even what the "extra sensors" are, we can suggest some alternatives.

0 Kudos
Message 2 of 6
(3,593 Views)

Hello, I work with Qing.  We'd love to connect a laser range finder with built-in inclinometer that can interface with the CPU by RS232 to give the height, distance and angle.  The CPU will then set another angle for the shot and get readings to stop moving when the range finder's inclinometer reads the desired shot angle.  We want to look through the range finder with a webcam that has optical zoom to acquire the target. 

The CPU must also turn an air compressor off and on based on readings it receives from a pressure gauge.  It will turn on and stay on until it reaches the calculated pressure required based on readings it gets from the range finder.  When the desired pressure is reached the CPU opens the valve to fire the shot. The valve shuts itself and the process for the second shot starts again.

0 Kudos
Message 3 of 6
(3,593 Views)

If you are using a sensor that has an RS232 port on it, then you simply need to power it and wire the RS232 port to the RS232 port on the cRIO.  The cRIO can already turn a compressor on and off.

-Joe

0 Kudos
Message 4 of 6
(3,593 Views)

There's only one port.  We need multiple ports.  Is it legal to add more ports?  Will a serial hub work?  Please give details if the hub is legal and will work.

0 Kudos
Message 5 of 6
(3,593 Views)

There is only one port and only one port is possible directly to the cRIO.  Perhaps you could get some sort of serial to ethernet device to work.  I've never seen a serial hub, but I guess it could potentially work.  I haven't seen anything that makes it illegal.

0 Kudos
Message 6 of 6
(3,593 Views)