Hello. Ich am making small robot. Arduino Mega, 1x MPU6050(Jeff Rolberg library), 2x VL53L0X(adafruit), lition 7.4V 2.5Ah for power all.
Direkt connection: MPU to pins 21,20 , the distance sensors to other SDA and SCL pins. And all sensors get power from the arduino and the arduino from the battery.
And have such problem:
When the all sensors work together in one code , the mpu start slower work and show wrong values and even sometimes just stop measuring.
If they work in different codes work perfect.
May be I make someting wrong with I2C comunication and the program get slower.
This is not clear to me. On Mega, D20 is SDA and D12 is SCL. Can you confirm all 3 sensors are correctly connected to these same 2 pins? I assume they are since your code works as long as only one sensor is being addressed.
Who knows. I didn't really try hacking into your computer and finding the mystery code you're trying to compile. Or drive to your home and peek through the window to see how you connected everything together.
Would you like me to?
According to the Arduino documentation, they're connected. So both pins marked SCL are in fact the 'D21' and both pins marked SDA are 'D20'. You can (but don't have to) verify this with a continuity meter.
If you want help with your problem, you'll have to post your code.
Can you give a link to the sensor modules (a link to where you bought them), because those sensors are 3.3V sensors and the Arduino Mega is a 5V board.
The Arduino Mega has onboard 10k pullup resistors to 5V for SDA and SCL. If you connect those directly to the MPU-6050, then its voltage gets pushed towards 5V.
The sensor are from Aliexpres - all there are same VL53L0X, i wired them how has the man in the video from Robojax in Youtube.
Vin=> 5V, GND=>GND, SCL,SDA =>SCL, SDA, Xshut to D20. Library from Adafruit.
Alone the code for both VL53L0X work fine. Measuring good.
I am sorry picture couldnt send, they are 50 cables around. And you will see only one mess, but everything is conected good. But without any pullups. directly.
Have you set different I2C addresses on each VL53L0X module?
The VL53L0X has a default I2C address of 0x29!
You can change it, but only in software. That means you have to wire the SHUTDOWN pin and hold all but one sensor in reset while you reconfigure one sensor at a time
1. According to data sheets the I2C address of VL53L0X is 0x52. You have two sensors of this kind in the system. How have you choosen the I2C address for the other sensor given the following pin diagram (Fig-1) of the sensor.
Figure-1:
2. What address have you selected for MU6050? Is it 0x68 or 0x69 (with the help of the AD0-pin)?
2.8 Device programming and control
Device physical control interface is I2C, described in Section 3: Control interface.
A software layer (API) is provided to control the device. The API is described in the VL53L0X API User Manual.
Some VL53L0X modules on AliExpress have level shifters for SDA and SCL, some don't. I don't know if there is a module with a level shifter for the XSHUT pin. So I assume that there is not a single VL53L0X module on AliExpress that you may connect to your Arduino Mega.
Most MPU-6050 modules don't have level shifters for SDA and SCL, so you may not connect that module to your Mega board.
I really would like to know how the wiring is. If you, for example, use a flat ribbon cable with SDA next to SCL, then 20 cm cable length might already be too much.
With my Mega the value of Y get slower in Serial monitor as normal and 10 sec after start to give very wrong haotik numbers and even sometimes just block and nothing more. Need restart. And this is when work together with both VL53L0X
Can you briefly describe the function of your sketch/project so that I can conveniently remove some of the unnecessary/dedundant codes from your sketch?