Adding LIDAR Lite v3 to Ultraborg I2C wiring

Forums:

I'm in the process of trying to add a Lidar unit connected via I2C because SR04 units are not as accurate as I would like.

I currently have an Ultraborg and two PicoBorg Reverse connected to a RPi3b driving various motors. (One PBR will be upgraded to ThunderBorgs at some point).

I need to add a 680uF capacitor between the 5v supply and Ground that go to the Lidar unit. The 5v and Ground also goes to the Borg units in the daisy chain. All three PiBorg units wiring comes off a Hat I have added to the Pi, is there an issue in adding the capacitor? Will it affect the running of the PiBoprg stuff or visa versa?

Hope this makes sense.

piborg's picture

The capacitor you are adding between 5V and GND is used to keep the 5V level stable. In this case the added stability is likely to help all of the boards work properly by removing any "noise" they each add to the 5V line.

Both the UltraBorg and the PicoBorg Reverses already have capacitors onboard for either the 5V or 3V3 lines for exactly the same reason, as do the ThunderBorgs. As these lines are supposed to be a nice steady level adding more capacitors will generally improve on their effect, or at worst will have no effect at all.

The only things to make sure are:

  1. The capacitor is rated for a higher voltage than you require so it can handle any spikes. 6V or more should be fine for a steady 5V line.
  2. The capacitor is connected so that the - side is connected to GND. Larger capacitors can usually only be connected one way (such as electrolytic), if so they will be damaged if connected the wrong way!

Thanks for that, now working but had to roll back kernel to 4.4.50 from Feb 2017 to get it working.

Any hints on implementing this where I have the LIDAR sweeping across the front from about -45 to +45 (using a servo) to avoid obstacles. With the SR04 units it was easy - if distance to USM1 < x turn right if distance to USM2 < x turn left etc.

With one lidar sensor in a sweeping action I feel lost?

/

piborg's picture

I would start with the following logic:

  1. Sweep from one end to the other making a note of the distances for each angle measured
  2. If all of the -15 to +15 distances are far enough away keep going forward
  3. If any of the -15 to +15 distances are getting low we should start turning:
    1. work out which reading was the lowest distance, ignoring the 0 degree reading
    2. If the smallest distance is at an angle below 0, turn to the right
    3. If the smallest distance is at an angle above 0, turn to the left

This assumes that above 0 means the LIDAR is pointing right, if not swap the left and right turns above.

With that in place you should be able to avoid obstacles, but it will not be the best movement. You can then build upon it by steering harder if the objects are closer to 0 degrees and less sharply if they are at a greater angle.

Alternatively you can try and aim the robot for the angle with the largest distance reading. This will be smoother and find a better path, but it runs the risk of trying to get through a gap which is too small for the robot :)

Subscribe to Comments for &quot;Adding LIDAR Lite v3 to Ultraborg I2C wiring&quot;