Background:
Currently working on a project involving the use of a servo motor, and encountered a problem with the length of the wire used to control the servo. The servo operates correctly when connected to a shorter wire, but when using a longer wire, it does not function as expected. My colleagues and I could not figure out the problem. The long wire works with an arduino but not with the custom board programmed by the nRF5340DK and so we thought it has something to do with the DK and not the physical connections.
Issue Description:
The servo motor is being controlled by toggling the serv2/serv3 GPIO pin (custom board) on and off with the appropriate delay. When connected with a short wire, the servo operates smoothly and responds to given signals. However, when we switch to a longer wire, the servo fails to respond at all. We are programming the custom board using the nRF5340 DK.
We have tried measuring the signals from the pin using an oscilloscope (images attached). As the wire gets longer, the signal becomes worse. The first image shows the expected signal (short wire) whereas the second image shows the signal we get from using a much longer wire.
/cfs-file/__key/communityserver-discussions-components-files/4/20240124_5F00_124131.mp4
I have also attached our code set in a zip file. It contains all the necessary files to run the sample program (toggling the servo motor) to work on our custom board. Basically, we just plug the servo motor (MG92B) to our custom board serv2/serv3 pin. When we flash servotest_main_v1.c as main, it should hold the servo at a certain angle. Again, the servo will only turn when using the short wire and not the long one.
Additional Information:
- Long wire works fine when using an Arduino
- Tested resistance with multimeter and signal with oscilloscope
- Already tried making a new wire and checked physical connections.
- Using serv2 and serv3 (configured as &gpio0 2 and &gpio0 3 in .overlay file)
- Using VS code and nRF extension to build and flash the application.
- OS: Windows. nRF toolchain version: v2.5.1
I am a beginner and would really appreciate your help with this issue. Thanks!