Freenove / Freenove_Robot_Dog_Kit_for_Raspberry_Pi

Apply to FNK0050
Other
137 stars 93 forks source link

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

Open SijieDingEsna opened 2 months ago

SijieDingEsna commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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

SijieDingEsna commented 1 month ago

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 commented 1 month ago

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

SijieDingEsna commented 1 month ago

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 commented 1 month ago

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.