Servo stops working and works again after 15 minutes of trying.

Jingaa
Posts: 3
Joined: Thu Apr 11, 2024 9:57 am

Servo stops working and works again after 15 minutes of trying.

Postby Jingaa » Thu Apr 11, 2024 10:15 am

Greetings. I'm facing a very strange problem and neither Google nor chatbots can help me.
I apologize in advance, I'm new, I'm probably missing something obvious.

I have a PCA9685 and a servo motor connected to the ESP32(ESP32-D0WDQ6). There is a simple code that turns the servo back and forth and everything works well.

If I connect a voltage sensor to the same I2C pins, then everything still works. The scan shows that the ESP32 sees both the PCA9685 at 0x40 and the sensor at 0x70.

When I try to initialize the sensor in code, suddenly the servo stops moving. I'm probably doing it wrong, but that's not the question.

What's strange to me is that if I return the working code, the servo still doesn't work. It usually takes me about 15 minutes to rewrite the code multiple times, reset, run another code, turn off the sensor and servo, and then suddenly it starts working again. All contacts are reliable, there is voltage everywhere.

What could be the problem? Or in what direction should I at least look for the answer? Thank you.

ccrause
Posts: 15
Joined: Wed Feb 27, 2019 7:42 am

Re: Servo stops working and works again after 15 minutes of trying.

Postby ccrause » Mon Apr 15, 2024 5:56 am

Just a guess - is an I2C bus error causing a stall in communication? Are you tracking the status of each I2C call? Does the problem persist after a power cycle to all components (since this will clear the I2C state of all I2C components)? Do you ensure that the I2C communication between the two devices are non-overlapping?

Jingaa
Posts: 3
Joined: Thu Apr 11, 2024 9:57 am

Re: Servo stops working and works again after 15 minutes of trying.

Postby Jingaa » Mon Apr 15, 2024 9:45 am

Thanks for the answer, I haven't tried any of the above. So far I have solved the problem by correcting the code, now both the servo and the voltage sensor are working, no errors. But I will need this information if I encounter the same problem in the future.

Who is online

Users browsing this forum: No registered users and 389 guests