I have connected my arduino nano 33 iot with a distance sensor (VL6180X) and I am loosing the connection (There is also a stepper motor so there is a lot of noise).
I would like to ask you how will I reduce the clock speed of the I2C protocol, there are some discussions but I didn't manage to follow them.
I moved your topic to an appropriate forum category @koel7.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
Hi ptillisch, thanks for your kind reply. I have tried the setClock function but I am not sure if this is changing the clock, because nothing changes in the behaviour of the circuit.
Unfortunately I do not have an oscilloscope to crosscheck the clock frequency.
Considering that the stepper motor introduces a lot of noise in the I2C protocol, I would like to reduce the clock speed in order to have a more stable I2C connection (now I am loosing the connection due to increased noise levels).
Incorporating the setClock command in my implementation, nothing changes in the stability of the I2C connection, so I am wandering if this command is functional (unfortunately I have not an oscilloscope to check the I2C clock frequency).
Yes it's functional but it won't solve your noise problem.
How long are the wires between the sensor and the Nano
Exactly which sensor are you using the VL6180X or VL53L0X
Wrong approach. Solve the noise problem at source. Your general diagram gives us little information to work with. Power connections, circuit topology, etc. are required for noise issues.
If this is the sort of thing you plan to be interested in on an ongoing basis, you might consider getting a logic analyzer as an alternative or supplement to an oscilloscope. You will likely find that they are significantly more affordable when compared to an oscilloscope with equivalent capabilities. That's not to say that a logic analyzer is a replacement for an oscilloscope in all applications (including the analog noise component of this project), but they are definitely a valuable tool.
If you get a nice name brand logic analyzer, the manufacturer will provide a proprietary front end PC application. But for the cheaper ones (or even the expensive ones if you don't like the proprietary application), there is an excellent free open source front end named sigrok (as well as a companion GUI named PulseView):
Add 10K pull-up resistors to SCL and SDA next to the Nano.
Make sure the I2C wire are as far away from the motor and motor wires as possible.
Set the clock speed to 10000
Hello, I finally found an osciloscope, and the Wire.setClock(); does not change the I2C frequency (whatever I declare, the clock speed is 100KHz). Moreover the Wire.setSpeed(); command is not included in my Wire library. Can you please recommend an alternative way to decrease my arduino nano 33 iot clock speed?
Unfortunately I'm not knowledgeable on this subject matter so I won't be able to assist, but I think the forum helpers who are knowledgeable on the subject will find it useful if you provide a simple sketch they can use to reproduce the problem on their own board.
I've never heard of that function. It is not mentioned in the Wire library reference so its absence from the library should not be considered a defect.
Go to the Arduino IDE and under the EDIT menu item click on "Copy for Forum". Then paste your code here on the forum
Are you using the VL6180x or the VL53l0x?
You previously said the VL53l0x now again you show the VL6180x.