Hi, I am a programmer from team 2035 (“The Rockin’ Bots”) and we are trying to use an MaxBotix Ultrasonic sensor for autonomous. We are wondering how to hook it up to the custom electronics port on the roboRIO and how to program it as well? Our robot is in java. Any help would be appreciated, thank you!
It can be connected to either an Analog Input or the TTL serial port.
Check the datasheet for your model. Here is a datasheet for the EZ-1:
EZ1 datasheet
Page 2 describes the pins.
For instance, an Analog hookup uses
- GND
- +5V
*]AN - ~9.8mV per inch
How do we hook up two Maxbotix ultrasonic sensors to RoboRIO? According to the spec, to do multiple sensors, you need to daisy chain them using one digital output channel connected to the RX pin and then chain the TX pin to the RX pin of another sensor. Then each sensor is connected to a separate analog input channel. Am I interpreting the spec correctly? Also, I looked at ultrasonic.java in WPILibJ, am I correct that I cannot use that module because that module seems to use one digital output (ping channel) and one digital input channel (echo channel) and it’s timing the interval between ping and echo. It has hinted you can use multiple sensors (m_firstSensor) but I can’t figure out how. In addition, the comment in the code seems to say the code is really for Daventech SRF04 or a Vex ultrasonic sensors. That leads me to think it cannot be used for the Maxbotix sensors. So is it correct that I just write a pulse out (20uS or more) to the digital out channel (RX pin) then delay 50msec and read the Analog channel scaling it back to inches according to the spec (9.8mV/inch)? Or alternatively, I can do automatic range mode by chaining RX and TX in a loop (i.e. TX of sensor 1 connects to RX of sensor 2 and TX of sensor 2 connects to RX of sensor 1 through a 1K resistor) so it will keep ranging over and over again. But it sounds like I still need an digital output channel connected to the RX pin of the first sensor to start the cycle. Will this work as expected? Automatic range mode is only appealing to me if I can avoid using a digital output channel. If I can’t avoid using a digital output channel, then I may just do single range by writing a pulse (> 20us) to the digital output channel and then wait for 100 msec before reading both analog channels. Am I correct here?
You state the following information: According to the spec, to do multiple sensors, you need to daisy chain them using one digital output channel connected to the RX pin and then chain the TX pin to the RX pin of another sensor. Then each sensor is connected to a separate analog input channel. Am I interpreting the spec correctly?
I apologize, but I do not know which specific sensor line you are using. As such I will provide this link to our general information on using multiple sensors in chained operation.
Multiple Sensor Chaining: http://maxbotix.com/articles/031.htm
You state the following information: Also, I looked at ultrasonic.java in WPILibJ, am I correct that I cannot use that module because that module seems to use one digital output (ping channel) and one digital input channel (echo channel) and it’s timing the interval between ping and echo. It has hinted you can use multiple sensors (m_firstSensor) but I can’t figure out how. In addition, the comment in the code seems to say the code is really for Daventech SRF04 or a Vex ultrasonic sensors. That leads me to think it cannot be used for the Maxbotix sensors.
Excluding our USB and 4-20mA lines of sensors, all MaxBotix sensors include serial data and analog voltage outputs and either a choice between pulse-width and analog envelope depending on the sensor line. In essence the Ping pin described is similar to the RX pin on a MaxBotix sensor, and the Echo pin is similar to the pulse-width pin. However, we recommend using the analog voltage pin in chaining operations.
You state the following information: So is it correct that I just write a pulse out (20uS or more) to the digital out channel (RX pin) then delay 50msec and read the Analog channel scaling it back to inches according to the spec (9.8mV/inch)?
This is correct.
You state the following information: Or alternatively, I can do automatic range mode by chaining RX and TX in a loop (i.e. TX of sensor 1 connects to RX of sensor 2 and TX of sensor 2 connects to RX of sensor 1 through a 1K resistor) so it will keep ranging over and over again. But it sounds like I still need an digital output channel connected to the RX pin of the first sensor to start the cycle. Will this work as expected?
Yes that is accurate, but I strongly recommend looking through the previously linked chaining guide or the datasheet specific to the sensor you choose to use.
You state the following information: Automatic range mode is only appealing to me if I can avoid using a digital output channel. If I can’t avoid using a digital output channel, then I may just do single range by writing a pulse (> 20us) to the digital output channel and then wait for 100 msec before reading both analog channels. Am I correct here?
If free run mode (automatic ranging), you just need to hook your sensor to a power supply at the proper voltage and supply a ground reference and then you can choose to read the analog voltage or pulse-width output on our sensors without the need for a digital output channel.