I am a software engineering student and took one hardware class, so I’m VERY new to hardware! I had a project in school that I’m trying to finish out of class to put to use in my house. I’m making Alexa enabled roller shades. I have a Particle Photon and I’m using the MP6500 stepper motor driver. I have just two quick questions that I didn’t really understand about the MP6500 stepper driver.
First, I want to see if I can connect the current and step size pins on the MP6500 to the particle photon pins so that I can control them via software if/when I may need to configure the step size or current limit. That way if I need to change to a different motor size its not permanently hard wired on the PCB board like it currently is.
Second, It says on the driver description on the website that the current limit pins (I1 & I2) can be connected to a microcontroller pin as an input, which I wasn’t really sure what that meant…? I’m assuming that means I can connect it to the Photon, but it doesn’t say if that can be done with the M1 & M2 pins for step size? I’m kind of assuming if it is doable then I just set those Photon pins high or low via code, depending on what step size or current limit I need, right?
Thank you again! Any help at all is greatly appreciated!!
On the digital current control version of the MP6500 carrier, most of the current limit settings require at least one pin (l1 or l2) to be high-impedance (designated with a Z in the current limit table). To set a pin on your microcontroller as high impedance, you can configure it as an input. For example, to set the current limit to 1A, you would configure the microcontroller pin connected to l1 as an output and drive it low, and configure the one connected to l2 as an input.
The microstepping mode pins (MS1 and MS2) function differently and are pulled down on the board by default. To control the microstepping mode from a microcontroller, you can configure the microcontroller pins you are using to drive them as outputs so you can drive them high or low to get the corresponding microstep resolution shown in the Microstep Resolution table. For example, to put the driver in quarter step mode, you would drive the microcontroller pin connected to MS1 low and the one connected to MS2 high.
Thank you so much, that is exactly what I needed to know!
@BrandonM I just thought of one last question regarding above…I’m not sure if you know the Photon, but I can use any of those pins for the I1, I2 & M1, M2 pins? It said something about analog for the step size pins, but I figured any digital pin on the photon is ok to connect to? The pins that I’d use on the Photon are either the A pins → “12-bit Analog-to-Digital (A/D) inputs (0-4095), and also digital GPIOs”. Or the D pins → “Digital only GPIO pins. D0~D3 may also be used as a PWM output.”
If you don’t mind I have another question about the MP6500 driver. I’m a little confused by the Enable and Sleep pins on the driver. Currently I am using the sleep pin to put the motor to sleep after it runs to either open or close the blinds, that way it isn’t constantly powered 24/7 and then wake it up next time it needs to be used. It seems like the Enable pin works similarly and I wasn’t sure the difference? Thank you again and any insight is greatly appreciated!
Unfortunately, I am not very familiar with the Particle Photon, so I cannot give specific advice, but you should generally be able to use any digital output pins to drive the microstepping pins (MS1 and MS2), since they can just be driven high or low.
For the current limiting pins (l1 and l2), if you only need to set the current limit to the steps specified in the current limiting table (i.e. 0.5A, 1A, 1.5A, or 2A), then any IO pin should generally be fine. However, a PWM can be supplied to the I1 pin while I2 is driven low to allow for finer control of the current limit. So, if you want to take advantage of that, you should select a pin that supports a PWM output (we recommend a frequency of 1kHz or greater).
As mentioned on the MP6500 carrier’s product page, the driver’s datasheet does not describe how nSLEEP and nENBL affect the driver’s internal logic, but based on our testing, bringing nSLEEP low disables and resets the entire driver (including the microstep position) while bringing nENBL high disables only the motor outputs while retaining the microstep position.
You are awesome Brandon, thank you so much for taking the time to answer all my questions!