Responsibility of the Sonar System
In our setup, sonars are meant to be used to detect obstacles close by when it is moving slowly. For example, in instances when the vehicle needs to reverse, the SICK laser range finder is not able to detect obstacles behind or next to the vehicle and we would use the sonar readings to determine whether there are obstacles close by. Each sonar should reliably estimate obstacles between 10cm to 3m away. The sonar information is intended to be presented through a SONAR server which replies with the current readings on each of the sonars. We had planned for 16 sonars at first but cut that down to 6.
There is a fundamental problem with sonars -- crosstalk. This and other relevant basics about sonars can be found here. A lot of references are provided there.
Difficulties and Alternatives
Although seemingly an easy task, interfacing water proof automotive grade sonars with a computer proves to be difficulty for many reasons and can be seen in the alternatives we have explored.
Choice and Problems
In the end, I opted for solution 5. We have in stock 2 functional I2C-to-RS232 converters from Emicros, 7 functional SRF08 units from Devantech, a 7 port I2C bus distribution board from MCC and some special I2C cables from MCC (the distribution board needs special connectors).
I did not take long to get each sonar unit to talk through the I2C-to-RS232 converters. The distance estimation obtained is surprisely good and good to centimeter accuracy.
I then tried changing the transducers on the SRF08 from their stock 400ET180 (transmitter) and 400ER180 (receiver) with the waterproof 400ET250 and 400ER250 from prowave. After much experimentation, it seems with the new transducers, the distance estimation is good only at short distances. At longer distances, they are totally wrong. I also tried experimenting with Murata transducers from reversing parking sensors. That did not work at all. In the end, we are left with using the SRF08 with their native non-waterproof transducers.
It also turns out that I2C signals from the SRF08 units are very sensitive to electrical noise. I tried using 15 yard long shielded cables between the I2C-to-RS232 converters and the SRF08 units. That failed to work. Cutting the cables down to 8 yards or less seemed to work. In the end, I opted to use the distribution board and the special I2C cables from MCC.
The schematic is shown below. The I2C-to-RS232 converter takes 12V while the SRF08 units take 5V, thus the use of the voltage regulator below. The single I2C cable (with the MCC connector) leaves the sonar box and connects to the MCC I2C distribution board just outside the Back Box. Then each SRF08 is connected to this distribution board via an 8 feet I2C cable.
The software can be found in the Overbot CVS source tree at sandbox/gc/src/qnx/drivers/sonars/.
The program man page can be found at sandbox/gc/doc/manuals/.
To communicate with each of the SRF08, the address of each one has to be set differently. Currently, they have been set to 0, 1, ... 5.
The following (as found in main.cc) can be used to change the I2C addresses of the SRF08. Fresh out of the factory, their default number is 0. For example, the following snippet changes the address of the unit currently at address 5 to address 1.
Currently, the software continuously fires and polls each sonar in turn for range estimations. An example of how to do a ping is:
int dist = srf08_ping(SRF08_UNIT_0);
This currently is the simplest possible way to ensure no crosstalk. But through experiment, it seems that this slow process takes 1 second to cycle through all 6 sonars and thus the update rate of each reading is 1hz.
Due to the slow microcontroller on board the I2C-to-RS232 converter, care must be taken in writting the serial interfacing code. The software right now will wait for each expected reply from the converter before sending the next string of commands to prevent overrunning the slow microcontroller.
The I2C-to-RS232 converter has a baud rate setting (currently factory defaulted to 9600) that can be tweaked and experimented with. I refer you to the I2C-to-RS232 converter documentation.
Changes Needed to Add More Sensors
Because the I2C distribution board can be stacked, additional SRF08 can be added by:
Current Status and Work Needed
It might be much easier (both for mounting and programming) to have gone with option 2 or 3 instead.