jsharlan wrote:I'm using (5) SRF02s on the same I2C bus in a star configuration. I can read all sensors in a round robin mode when the time between pings is >= 70 ms as you would expect. This gives me a total loop time of 350ms, I would like to reduce this time. My program sequence is: ping(0), read(1), delay(70), ping(1), read(2), delay(70)... ping(4), read(0), delay(70), ping(1).... the reads are going into a Ranges[] array. In theory I should be able to sequence through all 5 sensors within a 100ms cycle and get back to read the first one within the minimum time. When I try to reduce the delay(70), I start to get bad numbers. I have isolated the sensors from each other to eliminate interference without success. When viewed with a scope, the I2C signals are just where they should be. I'm using an ATmega32(16MHz) and am reading the Ranges[] array via the serial port at 19200 connected to a PC.
Any ideas on the subject would be appreciated.
Thanks,
The "ping" takes 60-70mS to fade away to the point where it will not interfere with the next ranging. During this time it is bouncing around all over the place. If you start the next SRF02 too soon, it will detect this fading echo giving the bad results. You need to wait 60-70ms between rangings - OR ....
You could try firing all 5 SRF02's at the same time (no delay at all). i.e.
ping(0), ping(1) ... Ping(4)
then wait 70mS
then read(0), read(1) ... read(4).
This works well with the SRF08 where we can fire all rangers together using the general call at address 00. The pic chip used on the SRF02 doesn't have the general call, so you will need to write to all 5 SRF02's as quickly as possibe to set them ranging.
It works because each SRF02 completes its ranging to the nearest target before the collective "ping" spreads out and bounces around enough to be troublesome. I have to say though, that I've never acually tried this with the SRF02's, only the SRF08's so I'd be interrested in the feedback.
Not sure wherethe 100mS comes from, since 5*70 = 350mS. Is that the upload time to the PC?