Hello I am trying to create a 360 spinning lidar, this is the hardware I am using:
- Lidar Lite Module v1 silver label by Pulsed light
- Current: <100 mA , as I am using continuous read mode (avg 95 mA)
- Voltage: 5v DC
- Voltage: 12V
- Current: 0.4A
- A4988 current limiting stepper driver with the current limit set to 400mA to match the stepper
- Voltage being used to drive the steppr is 12V (I know it could be run at a higher voltage but 12v works perfectly for now)
I am using a 12.0v DC power supply to power the stepper with the A4988 and this setup works fine in isolation, there appears to be no issue with this stepper or the driver I am using - I can run the stepper using the driver perfectly.
To operate the Lidar module I am using the Arduino’s 5v on board supply and to communicate with the Lidar module I am using I2c (it is also possible to use PWM but I2c appears to be much faster) , again this works fine in isolation, so the Lidar module is working perfectly.
The issue appears when I attempt to use them together, I have the stepper attached to a gearing system that is intended to rotate the Lidar, in this setup the Lidar Lite uses the Arduino’s 5v pin for power and the driver also uses the 5v for its logic supply.
When I switch on the power supply to the Stepper Driver (to the VMOT pin) to power the steppers, communication between the Lidar module and the Arduino breaks down entirely , I am using the Continuous Read I2C example from Pulsed Light to verify the issue is not with my project code and this demo program prints out the current distance reading from the module. I have tried switching on the the power to the stepper driver both before running the example, the result is still the same - the Lidar module hangs and random readings are printed or none at all.
I’d just like to note that I can use the PWM mode and get the readings from the lidar module and use the stepper to rotate it without this issue happening, so it seems to be I2c specific - and I wish to use a gyro next in my project that requires I2c communication so I would like to find and fix the issue.
Note how the two devices are wired to the Arduino on the attachments.
I have also attached the code, if anyone wishes to look at it
- The same seme setup on an Arduino Mega 2560 - SainSmart board
- The same setup on an Arduino R3 Official board
- Giving the Lidar Lite its own power supply
- Larger Decoupling capacitor on the Lidar Lite wiring (1000uF)
- Turning on power supply before running demo program
- Turning on power supply during running demo program
- A different I2c lib (http://dsscircuits.com/articles/86-articles/66-arduino-i2c-master-library)
- 4 Different individual drivers with the same current limit
Believe it or not, while writing this post I found the solution ( always good to keep trying ) :
It turns out that giving the A4988 its own logic power supply fixed the issue entirely.
I don’t really have any idea why this worked (I am a programmer), if any electronics ninjas would be able to explain I would be happy to know
sketch.ino (1.56 KB)