Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to run the command "sudo python Servo.py" #28

Open
SijieDingEsna opened this issue Aug 29, 2024 · 9 comments
Open

Failed to run the command "sudo python Servo.py" #28

SijieDingEsna opened this issue Aug 29, 2024 · 9 comments

Comments

@SijieDingEsna
Copy link

When I run the command Servo.py. I get the following error:
Now servos will rotate to 90°.
If they have already been at 90°, nothing will be observed.
Please keep the program running when installing the servos.
After that, you can press ctrl-C to end the program.
Traceback (most recent call last):
File "/home/pi/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server/Servo.py", line 28, in
S=Servo()
^^^^^^^
File "/home/pi/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server/Servo.py", line 8, in init
self.pwm = PCA9685(address=0x40, debug=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server/PCA9685.py", line 32, in init
self.write(self.__MODE1, 0x00)
File "/home/pi/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server/PCA9685.py", line 36, in write
self.bus.write_byte_data(self.address, reg, value)
OSError: [Errno 5] Input/output error

I use the command "sudo i2cdetect -y 1" to get connected device information. It shows there is no valid device.
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

I am sure I already enabled i2c and reboot system multiple times.
If you need more information, please let me know.

@Shaynee-MO
Copy link
Member

Please check the following:

  1. Whether connector is connected well.
    image

  2. Whether both S1 and S2 are turned ON. Do the power and battery indicators light up?

  3. Whether the batteries contact well with the battery holder. Please try to push them towards positive end.
    image

@SijieDingEsna
Copy link
Author

Please see the attached pic of my work. And I already put the batteries into the charger for over 2 nights.
IMG_5927
I don't connect any servos on the board. And I think it will not effect the result of i2cdetect. BTW I use wifi to connect raspberry pi with my laptop.

@Shaynee-MO
Copy link
Member

Please remove the Raspberry Pi and the mpu6050 chip from the robot board.

Connect the MPU6050 chip directly to the raspberry pi and run i2cdetect -y 1 to see if its i2c address can be detected.
image
image
image

@SijieDingEsna
Copy link
Author

The previous pictures make me confused. The first pic shows
vcc -> right pin 2nd row
gnd -> right pin 3td row
scl -> left pint 2nd row
sda -> left pin 3td row

The second pic shows
vcc -> right pin 1st row
gnd -> right pin 2nd row
scl -> left pin 2nd row
sda -> left pin 1st row

Would you please tell me which connect method is right?

@Shaynee-MO
Copy link
Member

Sorry for the confusion it caused. It has to do with the angle of the shot.
image
image

@SijieDingEsna
Copy link
Author

SijieDingEsna commented Sep 4, 2024

I connect with mpu6050 as your guidance. But I still cannot get device by the command "i2cdetect -y 1" .
Please see my connection in the attached pic.
IMG_5934

@Shaynee-MO
Copy link
Member

The issue may be on your Raspberry Pi.
Do you have other control boards such as Arduino and ESP32 to check?

@SijieDingEsna
Copy link
Author

I don't have other control board. In your mind which board is easier to do such test. I have poor knowledge about it. Thank you

@Shaynee-MO
Copy link
Member

You can buy an Arduino board.

BTW, you can connect the Raspberry Pi back to the robot board without the mpu6050 chip connected and run i2cdetect -y 1 again to see if it can detect the i2c addresses of other chips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants