|
Re: Attaching MaxBotix Ultrasonic Sensor to RoboRIO
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?
__________________
|