I have a BrickPi+ + RPi 2 configuration with 4x EV3 Ultrasonic sensors and two large EV3 motors. I use the BrickPi python library to connect to the sensors and followed exactly the example code for communicating with the EV3_US sensor. In my case when I sample the sensors through my program I get readings from all of them but only two give meaningful readings (e.g. 40 cms) while the other two give a constant value of 65532. The sensors are placed according to the North-South-East-West directions (each in right angles to adjacent ones).
I ran successfully the example code reading from a single EV3 sensor. I also use the 8x AA battery pack to power the robot and sensors. Researching the problem I found that possibly the problem is related to read-write time parameter of the BrickPi which is set to 7 in the formware. Modifying the time delay period that I allow after each sensor reading from 10 ms to 2 secs didn’t solve the problem. With a value of 1sec delay I can read up to 2x EV3_US meaningful values from the four sensors. For lower or higher values (in the aforementioned range) I can only read one out of the four.
Any help in sorting this problem out will be appreciated.
Can we ask a few more questions:
1). Two of the sensors are working. Two are not giving meaningful values. Are these all on the same side, or are these on opposite sides of the BrickPi board? Which sensor ports are working, and which are having trouble?
2). Can you send a link to the code you’re running that’s having trouble?
3). Just to speed my rsponse up a bit, can you send a link to where you’re modifying this:
"“I found that possibly the problem is related to read-write time parameter of the BrickPi which is set to 7 in the formware. Modifying the time delay period that I allow after each sensor reading from 10 ms to 2 secs didn’t solve the problem.”"
thanks for the prompt reply. Concerning your questions:
There are two pairs of EV3_US. Each member of the pair faces opposite from the other member and they have a distance 10cms (approx) between their back sides. The two pairs are in a cross pattern like the geographical North-East-South-West indicators. Thus all sensors face outwards from the BrickPi board and they are rotated by 90 deg to the left and right neighbors.
Please send me an email address to post you the trouble code.
I have found a discussion of two BrickPi users searching for answers in the Internet, but I have not kept the link. However, I copied example code from the topic which supposedly corrects the problem. The code contributor claimed that the problem was with the speed parameter setting in the I2C bus. Changing this from 7 to 8 corrected the problem. I am happy to post the code to a provided email address.