Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Laser Range Finder on Arduino I2c slave — Parallax Forums

Parallax Laser Range Finder on Arduino I2c slave

jonathan_gjonathan_g Posts: 2
edited 2015-04-17 06:03 in Accessories
I would like to use two Parallax laser range finders on a robot that also has an I2c LCD screen. The LRF communicates using Asynchronous serial and it takes a second to get a reading after pinging the sensor. because of the relatively slow refresh rate, I'd like to put the LRFs on separate Arduinos and report their results via I2c. (We are using the same approach for other sensors on the robot and wes have three slave Arduinos communicating successfully with a master Arduino via I2c.) To test the idea out with the LRFs, we put it together as a standalone system (ie no other I2c devices attached to the bus.) and it works well. The LRF slave Arduino sends the info to the master as expected. The problem is, that as soon as we connect other I2c devices to the I2c bus (e.g., an I2C LCD or a second LRF), the bus fails.

We were wondering if we might be doing something wrong. Does anyone know if it's possible to use the LRF on an Arduino I2c slave with other I2c devices connected to the bus? Thanks.

Comments

  • prof_brainoprof_braino Posts: 4,313
    edited 2015-04-15 16:26
    Are all the I2C devices 5 volts?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-04-15 22:20
    Are all the I2C devices 5 volts?

    This generally isn't a problem if the I2C bus isn't actively driven high (which it should not be). The Propeller can tolerate a 5V I2C bus as long as the pull-up resistors are 3K ohm are more.

    When using multiple I2C devices, you want to make sure not all the devices are not all pulling the line high. Multiple pull-up resistors will be in parallel and end up pulling the line so hard it can't be easily driven low. The parallel pull-up resistors may lower the combined resistance to less than the safe 3K ohm needed to protect the Propeller chip.

    I also just realized, the Propeller is probably not connected to the I2C bus. Only the Arduinos are connected to the bus; the Propellers are connected to Arduinos via a asynchronous serial line. Right?

    What's your power supply like? The extra devices may be causing power issues. Adding some extra capacitors near the various Vdd pins may help.
  • jonathan_gjonathan_g Posts: 2
    edited 2015-04-17 06:03
    First, thanks for trying to help. All I2C devices are 5v. To be specific, the devices on the I2C bus are: (1) three arduino nanos, (2) a Pololu LSM303 accelerometer/magnetometer, and (3) an Adafruit I2C LCD Arduino shield. All I2C devices are communicating with an Arduino Mega, which is the master (not a Propeller). The clock and data lines are pulled up through 10k resistors. The laser range finder is connected to one of the Arduino nanos, and the Nano is supposed to send the data back to the mega.

    It works as long as only the nano is connected to the mega. As soon as I connect one other I2C device, the system fails. Also, note that, without the laser range finder Nano connected, the system works (ie all four devices on the I2C bus work). The Arduinos are powered via a 2 cell LiPo. Each sensor is powered via the 5v pin of the Arduino to which it is connected.

    One threshold question that I have, which may have no bearing on the answer to the problem, is: assuming the LRF nano receives an I2C request to send data to the master when it is in the middle of getting data from the LRF (ie it is waiting one second for the data to arrive from the LRF via serial), what happens? Does the I2C line hang pending the nano's receipt of data from the LRF? Or, does, the I2C request interrupt the serial data retrieval?

    Thanks again for the help.
Sign In or Register to comment.