Hello! I am trying to use a Raspberry Pi 3 to communicate with the Basic ESC via I2C; my main goal is to read the RPM’s from it, for the purpose of controlling a quadcopter.
Background: I have 4 regular off-the-shelf Afro ESC’s which I purchased from HobbyKing. I have the Afro USB Programming tool that can flash them. I can set their motor speed using the Adafruit PCA9685 PWM board; however, the quadcopter wobbles significantly for a given constant applied PWM pulse width from the PCA9685. I measured the RPM’s during this wobbling using Sunfounder IR sensors and a strip of white-out on the motors. It’s crude, but it confirmed that the RPM’s were indeed changing significantly (+/- 50 or more for a given constant PWM pulse width, which is enough to tip the copter.) I am writing the PID control loop for the quadcopter myself that the Raspberry Pi will execute, and thus it is important that I be able to read the RPM’s accurately, so I can control them if they go out of whack for whatever reason. I purchased the BlueRobotics Basic ESC because the I2C documentation for the Afro ESC’s online consists of a single vague PDF document.
I have purchased and installed your off-the-shelf Basic ESC on the quadcopter, and I have successfully sent an integer (from 0 to 255) from the Pi to the ESC via the smbus write_byte() command, to no particular register at the default 0x29 address, and can thus set the speed. The write_byte_data() command sent to the 0x00 register gets the motors “just” spinning without getting anywhere close to max speed. I’d like to “properly” use the write_byte_data() method if I can.
Most importantly, I am having trouble reading any information from the ESC over I2C - whether I use read_byte(), read_byte_data(), read_block_data(), what I read is either zero, or some constant value that doesn’t seem affected by the motor speed, which I know is changing. This same result occurs whether I read from no particular register, or from registers 0x02 or 0x03.
I’m using the Adafruit BSS138 logic level converter (5V high side corresponding to the ESC’s I2C pins, and 3.3V low side corresponding to the Pi’s I2C pins), and I am able to communicate with other I2C devices using the Raspberry Pi, so I don’t think there are any issues there.
Aside from needing to remove the shrink wrap to get access to the I2C pins, are there other fundamental differences between the Basic ESC and the BlueESC? Does the I2C documentation for the BlueESC apply to the Basic ESC as well? If not, can I make it so? I have the tool to flash the Basic ESC.
Sorry for the wall of text.