I recently bought a DC and Stepper Motor HAT for Raspberry Pi from Adafruit. I wanted to use it in a project with a stepper motor. During testing I found out that I need more RPM for the stepper motor. I understood that the python application supplied with the HAT is slow because python is an interpreted language. So I started translating the python code to C using the WiringPi library. It turns out that the stepper motor is spinning at the same RPM. I tried to increase the baud rate of the i2c port from /boot/config.txt, but above 100000 it's missing steps. So, I have a couple of questions:
1. What is the maximum baud rate that RPi can handle? Above 100000 it's missing steps. I found out that I2C standard mode is 100000, fast mode is 400000, and even 3.4 Mbps for High speed mode.
2. I noticed that the HAT is using the PCA9685. The data sheet says that it can handle High speed mode if you set the slave address to 00001XX. Please correct me if I am wrong. I noticed that the PCA9685 is hardwired as 1100000 on the A5 pin. Is it possible to configure the chip to use High speed mode, or maybe Fast mode or Fast mode+? If yes, could the RPi handle that speed?
Somehow it seems that the stepper RPM is limited by the I2C baud rate and the RPi is too slow for higher speeds.
gabone wrote:Hi Mikronauts,
You made me laugh . So, in other words, Adafruit's idea to use this i2c chip was not so good.
I spent so much time translating the python code to C and understanding how the i2c chip works that I just had enough of it. I just want to get rid of it and use some ULNs controlled by GPIO. The problem is I don't which one. My steppers are rated 8.8V and 0.8A. I understand that most of them are 0.5A. So your suggestion is very welcome.
Code: Select all
self.regvals = [None] * 256
Code: Select all
def write8(self, reg, value): "Writes an 8-bit value to the specified register/address" if self.regvals[reg] is None or self.regvals[reg] != value: try: self.bus.write_byte_data(self.address, reg, value) self.regvals[reg] = value if self.debug: print("I2C: Wrote 0x%02X to register 0x%02X" % (value, reg)) except IOError as err: return self.errMsg()
As far as I can tell this file is wrapped up in something called an .egg. What is this? How do I edit it? After I edit it, do I need to do something to install the module again?in Adafruit_I2C.py in the constructor add:
Maybe. I was not even trying to sell something. I was trying to point out the difference a dedicated ARM core (in this case a Cortex-M3)Is this getting off-topic?